Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent memoization accessing wrong config-maps #11225

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

Joibel
Copy link
Member

@Joibel Joibel commented Jun 16, 2023

Ensure that config-maps used for memoization aren't actually important for other uses. Config-maps created for memoization would have the label workflows.argoproj.io/configmap-type: Cache, but this was not validated.

This commit changes that, and both load and saving to an existing config-map will require that label to be present, or else the workflow will error with a hopefully helpful message indicating the problem.

All existing config-maps which were created by memoization will have this label already. The only concern is where a config-map existed prior to the first save by memoization. Before this change the config-map could still be used, and now workflows will error instead.

This improves security and prevents writing to the workflow-controller-configmap by memoization.

I considered alternative paths for excluding
workflow-controller-configmap, such as a hardcoded list or a configurable list, but this seems like the best longer term solution, and requires zero configuration.

fixes: #5538

Verification

Tested locally by attempting to memoize using workflow-controller-configmap which I could do before this change, but afterwards was prevented from doing.
Existing tests updated to add labels to config-maps which show that it works as intended as they fail without the changes, and a new test for the failing case added by attempting to use an existing un-labelled configmap.

Ensure that config-maps used for memoization aren't actually important
for other uses. Config-maps created for memoization would have the
label `workflows.argoproj.io/configmap-type: Cache`, but this was not
validated.

This commit changes that, and both load and saving to an existing
config-map will require that label to be present, or else the workflow
will error with a hopefully helpful message indicating the problem.

All existing config-maps which were created by memoization will have
this label already. The only concern is where a config-map existed
prior to the first save by memoization. Before this change the
config-map could still be used, and now workflows will error instead.

This improves security and prevents writing to the
`workflow-controller-configmap` by memoization.

I considered alternative paths for excluding
workflow-controller-configmap, such as a hardcoded list or a
configurable list, but this seems like the best longer term solution,
and requires zero configuration.

fixes: argoproj#5538

Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel Joibel marked this pull request as ready for review June 16, 2023 17:27
Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@terrytangyuan terrytangyuan merged commit fa95f8d into argoproj:master Jun 19, 2023
JPZ13 pushed a commit to pipekit/argo-workflows that referenced this pull request Jul 4, 2023
jeremyhager pushed a commit to jeremyhager/argo-workflows that referenced this pull request Jul 7, 2023
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Jeremy Hager <47301461+jeremyhager@users.noreply.github.com>
terrytangyuan pushed a commit that referenced this pull request Jul 19, 2023
Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel Joibel deleted the memo-cm branch November 20, 2023 21:40
dpadhiar pushed a commit to dpadhiar/argo-workflows that referenced this pull request May 9, 2024
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Guard workflow controller's configmap from being modified by memoization
3 participants