Repository navigation
feat(rbac): dev-admin cannot create/delete pipelines & workflows #7043
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3853f15
feat(rbac): add createPipeline/deletePipeline actions
Shivam-nagar23 f54dc8e
feat(rbac): gate CI pipeline create on createPipeline
Shivam-nagar23 d9cb238
feat(rbac): gate CD pipeline create on createPipeline
Shivam-nagar23 9fd8217
fix(rbac): gate CD_CREATE via PatchCdPipeline on createPipeline
Shivam-nagar23 1dcfb97
feat(rbac): gate workflow create on createPipeline (apps)
Shivam-nagar23 cef8bc0
feat(rbac): gate workflow delete on deletePipeline (apps)
Shivam-nagar23 03ab785
feat(rbac): gate bulk CD pipeline delete on deletePipeline
Shivam-nagar23 3e1417c
feat(rbac): whitelist createPipeline/deletePipeline for applications
Shivam-nagar23 46079f0
feat(rbac): gate CI pipeline add/delete via patch on create/deletePip…
Shivam-nagar23 85c6387
chore(rbac): bump dev-admin pipeline migration to 36904600
Shivam-nagar23 7ec202a
chore(rbac): bump dev-admin pipeline migration to 37004800 (packet 48)
Shivam-nagar23 cd80dd9
fix(rbac): close dev-admin pipeline/workflow bypasses from review
Shivam-nagar23 1e68ac0
fix(rbac): match CI patch DELETE before create/linked/switch to preve…
Shivam-nagar23 b7e7c1d
Merge branch 'develop' into feat/dev-admin-pipeline-lifecycle
Shivam-nagar23 af3f3db
fix(rbac): gate CoreApp CreateAppWorkflow on createPipeline only when…
Shivam-nagar23 d4761c0
fix(rbac): gate non-cascade CD pipeline delete (force=true) on delete…
Shivam-nagar23 18fda2e
fix(rbac): lowercase dev-admin lifecycle action constants to match ca…
Shivam-nagar23 2215491
Merge branch 'develop' into feat/dev-admin-pipeline-lifecycle
Shivam-nagar23 e739e08
Merge remote-tracking branch 'origin/develop' into feat/dev-admin-pip…
Shivam-nagar23 6f1ca8a
chore(rbac): bump dev-admin pipeline migration 37004800 -> 37704800 a…
Shivam-nagar23 875d18f
Merge remote-tracking branch 'origin/feat/dev-admin-pipeline-lifecycl…
Shivam-nagar23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
scripts/sql/37704800_dev_admin_pipeline_lifecycle.down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| -- Reverse Increment 2: remove pipeline lifecycle actions and restore Release-1 lifecycle actions to | ||
| -- their original mixed-case form (as 36504600 left them), so down returns to the pre-migration state. | ||
|
|
||
| -- 1) remove pipeline lifecycle actions | ||
| UPDATE rbac_policy_resource_detail | ||
| SET allowed_actions = array_remove(array_remove(allowed_actions, 'createpipeline'), 'deletepipeline'), | ||
| updated_on = now() | ||
| WHERE resource = 'applications'; | ||
|
|
||
| -- 2) restore Release-1 application lifecycle actions to mixed case | ||
| UPDATE rbac_policy_resource_detail | ||
| SET allowed_actions = array_replace(array_replace(allowed_actions, 'createapp', 'createApp'), 'deleteapp', 'deleteApp'), | ||
| updated_on = now() | ||
| WHERE resource = 'applications' | ||
| AND allowed_actions IS NOT NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| -- Increment 2: add createpipeline / deletepipeline to the applications resource whitelist so custom | ||
| -- roles can grant/withhold pipeline lifecycle independently of config actions. dev-admin omits them. | ||
| -- | ||
| -- Action values are lowercase on purpose: the casbin store normalizes policy actions to lowercase on | ||
| -- AddPolicy (strings.ToLower) while enforcement passes the action unchanged, so a mixed-case whitelist | ||
| -- label would never match the stored grant. This migration also normalizes the Release-1 lifecycle | ||
| -- actions (createApp/deleteApp, added by 36504600) to lowercase here rather than editing that already | ||
| -- shipped migration, so the whitelist is internally consistent on both fresh and upgraded installs. | ||
|
|
||
| -- 1) normalize Release-1 application lifecycle actions to lowercase (no-op if already lowercase) | ||
| UPDATE rbac_policy_resource_detail | ||
| SET allowed_actions = array_replace(array_replace(allowed_actions, 'createApp', 'createapp'), 'deleteApp', 'deleteapp'), | ||
| updated_on = now() | ||
| WHERE resource = 'applications' | ||
| AND allowed_actions IS NOT NULL; | ||
|
|
||
| -- 2) add pipeline lifecycle actions (lowercase) | ||
| UPDATE rbac_policy_resource_detail | ||
| SET allowed_actions = array_cat(allowed_actions, ARRAY ['createpipeline','deletepipeline']), | ||
| updated_on = now() | ||
| WHERE resource = 'applications' | ||
| AND allowed_actions IS NOT NULL | ||
| AND NOT ('createpipeline' = ANY (allowed_actions)); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.