fix(rbac): add ActionPlaybookCancel to AllActions#1871
fix(rbac): add ActionPlaybookCancel to AllActions#1871adityathebe wants to merge 1 commit intomainfrom
Conversation
Benchstat (Other)Base: 📊 1 minor regression(s) (all within 5% threshold)
Full benchstat output |
Benchstat (RLS)Base: 📊 4 minor regression(s) (all within 5% threshold)
✅ 3 improvement(s)
Full benchstat output |
WalkthroughThe Changes
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rbac/policy/policy.go`:
- Around line 272-279: AllActions includes ActionPlaybookCancel but
ABACObjectSelector still only treats run/approve as playbook wildcard actions,
causing RBAC/ABAC mismatch; update the ABACObjectSelector implementation (the
code that checks playbook wildcard actions and the logic that maps playbook
actions to wildcard selectors) to include ActionPlaybookCancel alongside
ActionPlaybookRun and ActionPlaybookApprove so cancel permissions are recognized
by ABAC matching the RBAC list (locate the ABACObjectSelector function and the
branch handling playbook action wildcards and add ActionPlaybookCancel to that
set).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bcee0c01-d6c4-436c-9178-36157e4425e1
📒 Files selected for processing (1)
rbac/policy/policy.go
| var AllActions = []string{ | ||
| ActionCreate, | ||
| ActionDelete, | ||
| ActionRead, | ||
| ActionUpdate, | ||
| ActionDelete, | ||
| ActionPlaybookApprove, | ||
| ActionPlaybookCancel, | ||
| ActionPlaybookRun, |
There was a problem hiding this comment.
Add ABAC companion support for ActionPlaybookCancel to avoid auth mismatch.
Line 278 adds ActionPlaybookCancel to AllActions, but ABACObjectSelector still only treats run/approve as playbook wildcard actions (Line 321). This can cause cancel permissions to be recognized in RBAC lists but fail ABAC-based permission matching.
Proposed fix
diff --git a/rbac/policy/policy.go b/rbac/policy/policy.go
@@
- if lo.Contains([]string{ActionPlaybookRun, ActionPlaybookApprove}, action) {
+ if lo.Contains([]string{ActionPlaybookRun, ActionPlaybookApprove, ActionPlaybookCancel}, action) {
return []byte(`{"playbooks": [{"name":"*"}]}`)
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rbac/policy/policy.go` around lines 272 - 279, AllActions includes
ActionPlaybookCancel but ABACObjectSelector still only treats run/approve as
playbook wildcard actions, causing RBAC/ABAC mismatch; update the
ABACObjectSelector implementation (the code that checks playbook wildcard
actions and the logic that maps playbook actions to wildcard selectors) to
include ActionPlaybookCancel alongside ActionPlaybookRun and
ActionPlaybookApprove so cancel permissions are recognized by ABAC matching the
RBAC list (locate the ABACObjectSelector function and the branch handling
playbook action wildcards and add ActionPlaybookCancel to that set).
Summary by CodeRabbit