feat: add example ValidatingAdmissionPolicy to block param interpolation. Fixes #5114 #14045
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5114
Motivation
This PR builds off #14044
As @crenshaw-dev explained in #5114, allowing string interpolation inside the
command
,args
, andsource
fields can be dangerous in the presence of user input, since it can lead to command injection vulnerabilities. These vulnerabilities are ubiquitous with GitHub Actions, and barely a month goes by before another high-profile open-source project gets compromised (example).For security-conscious organization, providing options to prevent these kind of vulnerabilities is important and would go a long way to distinguishing Argo Workflows from the competition in the CI space.
Modifications
@crenshaw-dev suggested adding a controller option to disable interpolation. That works and would be fairly easy to implement, but the problem is flexibility. It's likely some organizations would want to narrowly target the option, or provide an allowlist that bypasses validation, which is difficult to do with custom logic.
Validating admission policies are a new feature in Kubernetes v1.30 that allows highly flexible, in-process validation logic using CEL. The downside is the CRD needs to specify all fields that are being validated, which necessitates the changes in #14044.
This PR adds a
ValidatingAdmissionPolicy
to https://github.com/argoproj/argo-workflows/blob/5e634fd24012db2c482daed465943081c0c408c2/examples/argo-dangerous-interpolation-vap.yaml that rejects workflows that interpolate parameters in thecommand
,args
, and/orsource
fields. I also added a test attest/e2e/argo_server_test.go
that verifies it. Initially, I includedValidatingAdmissionPolicy
in the release manifests undermanifests/quick-start/
, but then I realized we still support Kubernetes v1.29, which requires enabling a feature gate to use validating admission policies. Once we drop support for v1.29, then I think we should include this in the release manifests.TODO: I need to add documentation for this and update the examples that are currently using dangerous interpolation
Verification
E2E tests