List safe subresources instead of sensitive ones #25
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 399 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.358
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #25"
general
weight: 0.35
stlaz
Follow-up to #22, addressing @enj's review comment: https://github.com/Azure/guard/pull/22#discussion_r3761244900
Why
getResourceAndActionlisted the subresources that must keep their own DataAction and collapsed everything else into the parent resource action. That default is the wrong way round - a subresource nobody has classified yet is silently covered by the parent resource's permission, so the list has to grow every time someone notices a new one. That list has in fact grown three times (exec, thennodeclient, thenproxy, thenattach/portforward), each time after the gap was found rather than before.What changed
Collapse only the subresources upstream treats as part of the parent resource's permission, and give every other subresource its own
<resource>/<subresource>/action.The safe set is taken from the upstream
viewClusterRole (bootstrappolicy.viewRules), which grants exactly these subresource kinds alongside their parent:status,scale, andpods/log. SosafeSubresources = {status, scale, log, logs}(logsbecause guard has historically seen the plural spelling).Unchanged by design:
resource/subresource/verb) - expanded from the operations map elsewhere.bind,escalate,use,impersonate,inference) - there the verb, not the subresource, identifies the operation, souserextras/scopes+impersonatestaysuserextras/impersonate/action.Behavioral impact - please review
Anything not on the safe list now resolves to
<resource>/<subresource>/action. TheMicrosoft.ContainerServiceoperations registry currently defines onlymanagedClusters/pods/{read,write,delete}andmanagedClusters/pods/exec/action, so these actions match only roles carrying a wildcard (managedClusters/,pods/*) and are denied for roles that enumerate leaf actions. That is the intended fail-closed direction, but it is a behavioral change.Two points that need an explicit decision:
1. CSR subresources are now gated.
certificatesigningrequests/approvaland/approvalsno longer collapse into the parent write/delete, and the same rule would apply to/nodeclient. #23 reverted #12, which had gatednodeclient, so this rule partially re-applies what that revert removed. If CSR should stay collapsed until the corresponding DataActions exist in the registry, say so and I will add the CSR subresources to the safe set explicitly.2. Safe-set completeness. If any other subresource is expected to be covered by the parent permission today, it should be added to
safeSubresourcesrather than discovered through a denial.Testing
go build ./...,gofmt -l,golangci-lint runinghcr.io/appscode/golang-dev:1.25- 0 issuesgo test ./authz/providers/azure/rbac/... ./auth/providers/azure/graph/...- all passstatus/log/scalecollapsing, an unclassified subresource getting its own action (the fail-closed default), and the existing exec/attach/portforward/proxy and special-verb cases.