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

feat(rbac)!: disable fine-grained inheritance by default (#19988) #20671

Merged
merged 6 commits into from
Jan 17, 2025

Conversation

fffinkel
Copy link
Contributor

@fffinkel fffinkel commented Nov 5, 2024

We would like to allow our engineers to use the rollback functionality while having auto-sync enabled, without granting them the ability to edit an application's sub-resource manifests. For compliance purposes, we can only deploy using a known set of manifests from a protected source, which is the git repo holding our manifests that engineers do not have access to.

Using the rollback functionality when auto-sync is enabled requires the user to disable auto-sync, which in turn requires update permissions on the application itself. We can allow this by doing the following:

p, my-user, applications, update, */*, allow

However, this will also allow engineers to edit application manifests. It follows that we would like to add a deny for the application's sub-resources, but as the RBAC documentation states, this deny is ignored.

This PR changes application resource RBAC to allow users to set separate update/delete permissions for the application itself, but still deny sub-resources. We can then do something like this:

p, my-user, applications, update, */*, allow
p, my-user, applications, update/*/Deployment/*, */*, deny

It introduces a breaking change to RBAC (see #19988), so it will have to wait until V3. To allow this functionality in V2, a config value (server.rbac.enablev3 in argocd-cm) was added that allows the user to opt in to this new behavior. I did my best to implement #19988 in the first commit, and then to add the config value gating in a following commit, so that the first commit can be cherry-picked or the second commit reverted when the V3 release is cut.

RBAC docs: https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/#fine-grained-permissions-for-updatedelete-action

The cherry pick in v2 will be for #20600
Closes #19988

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@fffinkel fffinkel requested review from a team as code owners November 5, 2024 18:48
Copy link

bunnyshell bot commented Nov 5, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.29%. Comparing base (d4d6713) to head (f49008c).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
server/application/application.go 62.50% 2 Missing and 1 partial ⚠️
util/settings/settings.go 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20671      +/-   ##
==========================================
- Coverage   55.31%   55.29%   -0.03%     
==========================================
  Files         337      339       +2     
  Lines       56824    57172     +348     
==========================================
+ Hits        31430    31611     +181     
- Misses      22710    22842     +132     
- Partials     2684     2719      +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@andrii-korotkov-verkada andrii-korotkov-verkada left a comment

Choose a reason for hiding this comment

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

I think instead of introducing a breaking change we should create a new mechanism for setting permissions for applications themselves only.

Maybe we introduce the new permission terms like update_self or delete_self.

I'd probably comment on the issue and continue the discussion there.

USERS.md Outdated Show resolved Hide resolved
@fffinkel fffinkel mentioned this pull request Dec 5, 2024
14 tasks
@fffinkel fffinkel force-pushed the fine-grained-update-delete-rbac branch from f258ae5 to bfb52e4 Compare December 5, 2024 14:05
server/application/application.go Outdated Show resolved Hide resolved
docs/operator-manual/rbac.md Outdated Show resolved Hide resolved
server/application/application.go Outdated Show resolved Hide resolved
@reggie-k reggie-k requested a review from agaudreault December 12, 2024 16:28
@fffinkel fffinkel force-pushed the fine-grained-update-delete-rbac branch 2 times, most recently from 9d6f8a7 to c44747f Compare January 8, 2025 15:15
…oj#19988)

Change applications resource RBAC to use fine-grained update/delete
enforcement by default. This allows us to enforce RBAC on the
application itself, separately from the sub-resources related to it.

(see also argoproj#18124, argoproj#20600)

Signed-off-by: Matt Finkel <[email protected]>
A breaking change was introduced in a previous commit that is planned to
be a part of the next major version of Argo CD (v3) where it's okay to
introduce breaking changes. We want this feature before we hit v3, so we
add a config setting that allows us to explicitly turn this new v3
behavior on in v2. The current v2 behavior is the default, so this
change will not affect folks who do not explicitly opt in.

This commit to add the gating code is added separately so it will be
easy to either cherry pick that pervious commit or revert this one.

(see also argoproj#18124, argoproj#19988)

Signed-off-by: Matt Finkel <[email protected]>
@fffinkel fffinkel force-pushed the fine-grained-update-delete-rbac branch from c44747f to 78d89af Compare January 8, 2025 18:12
@fffinkel
Copy link
Contributor Author

I've updated this PR per @agaudreault 's comments. Thanks everyone!

@agaudreault agaudreault changed the title feat: Fine grained update delete RBAC w/ v3 gate feat!(rbac): disable fine-grained inheritance by default (#19988) Jan 17, 2025
@agaudreault agaudreault added this to the v3.0 milestone Jan 17, 2025
@agaudreault agaudreault changed the title feat!(rbac): disable fine-grained inheritance by default (#19988) feat(rbac)!: disable fine-grained inheritance by default (#19988) Jan 17, 2025
Copy link
Member

@agaudreault agaudreault left a comment

Choose a reason for hiding this comment

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

Merged master with v3 changes and updated the current code to reflect the behavior for v3.

The only change for a cherry pick in v2 would be

  • Docs update
  • Change the flag default to false.
  • Update tests for the behavior when the flag is not specified

Signed-off-by: Alexandre Gaudreault <[email protected]>
@agaudreault agaudreault enabled auto-merge (squash) January 17, 2025 19:46
@agaudreault agaudreault merged commit 606bd5b into argoproj:master Jan 17, 2025
26 checks passed
@agaudreault
Copy link
Member

/cherry-pick release-2.14

Copy link

Cherry-pick failed with Merge error 606bd5b04393a06461d007d066da0f0d4a6c6d95 into temp-cherry-pick-a6393d-release-2.14

agaudreault added a commit to agaudreault/argo-cd that referenced this pull request Jan 17, 2025
…) (argoproj#20671)

---------

Signed-off-by: Matt Finkel <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
dudo pushed a commit to dudo/argo-cd that referenced this pull request Jan 18, 2025
) (argoproj#20671)

---------

Signed-off-by: Matt Finkel <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Brett C. Dudo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable fine-grained update/delete RBAC enforcement by default
4 participants