argoproj / argoproj/argo-workflows

enum: values not validated, any value accepted

Open
#6,959 12 comments 4 reactions 0 assignees View on GitHub
area/ui
Dominant language
Go
Stars
17k
Forks
3.7k
Avg merge
1d 20h
Merged PRs (30d)
138

Description

## Summary

Expected:
- Input parameter in the workflow template has enum: with several values.
- Workflow submitted with a value not in the enum: list must return an error.
- Only values defined in the "enum:" must be allowed for the workflow input parameter.

What version of Argo Workflows are you running?
v3.1.3

## Diagnostics

Either a workflow that reproduces the bug, or paste you whole workflow YAML, including status, something like:

1. Create a Workflow Template with enum for the "state" parameter:
```
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: test1
spec:
templates:
- name: shell
inputs:
parameters:
- name: cmdline
container:
image: alpine:3.14
command:
- "sh"
- "-c"
- |
{{inputs.parameters.cmdline}}
- name: enum-test
metadata:
dag:
tasks:
- name: enum-test
templateRef:
name: test1
template: shell
arguments:
parameters:
- name: cmdline
value: |
echo State: "{{inputs.parameters.state}}"
inputs:
parameters:
- name: state
enum: ["hugo", "bunny"]
```
Submit the workflow with a state parameter not in enum:
```
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: enum-tests-
spec:
entrypoint: test-targets
ttlStrategy:
secondsAfterCompletion: 600
arguments:
parameters:
- name: state
value: "ggggggggg"
templates:
- name: test-targets
dag:
tasks:
- name: enum-test
templateRef:
name: test1
template: enum-test
arguments:
parameters:
- name: state
value: "{{workflow.parameters.state}}"
```

What Kubernetes provider are you using?
Ubuntu Microk8s

What executor are you running? Docker/K8SAPI/Kubelet/PNS/Emissary

PNS

```bash
---

**Message from the maintainers**:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the WorkflowTemplate and submitted Workflow YAML shown in the report, focusing on the state parameter's enum and the submission path. Trace where workflow input parameters are validated, then add coverage showing that a value outside ["hugo", "bunny"] is rejected while listed values remain accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
backend, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.