Repository navigation
policy: refuse condition variable suffixes only when saving - #280
Conversation
minio#276 ran the suffix check in isValid, so it also ran when a stored bucket policy was decoded and on every request that parses a session policy: a policy saved before minio#276 failed to load. Loading now accepts it and its suffixed conditions fail closed; CheckVariables refuses it before a save. A trailing slash round-trips instead of failing to parse.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (8)
💤 Files with no reviewable changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughCondition keys with disallowed or empty variable suffixes can now be parsed and retained when policies load. Statement validation no longer performs variable checks. ChangesCondition Variable Validation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No confirmed issue blocks merging this library change. Servers must call the new variable checks before saving policies. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Stored policies should become readable again without letting invalid condition suffixes grant access. The remaining risk is that policy-saving services must adopt the new explicit check; this change does not establish that they do so. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. A rabbit checked each policy key, Comment |
#276 put the suffix check in
isValid, which also runs when a policy isloaded, not just when it is saved:
BucketPolicy.UnmarshalJSONandParseBucketPolicyConfigrun it, so astored bucket policy with
aws:SourceIp/xfailed to load, and with it thebucket's metadata.
ParseConfigon every request, so aservice account or STS credential whose session policy had such a key was
denied everything.
parseKeyrejected a trailing slash (aws:username/) during decode, sosuch an IAM policy failed to load too.
What changes
Statement.isValidandBPStatement.isValidno longer check suffixes.isValidStrictstill does.Policy.CheckVariablesandBucketPolicy.CheckVariablesfor serversto call before saving, whatever the strictness setting.
marshals back with its slash, so a re-save or replication does not rewrite
it.
CheckVariablesrefuses it (ends in a slash that names no variable).value, so the condition fails closed and a caller cannot satisfy it.
Tests
CheckVariablesrefuses it.decodes, and its suffixed Allow is not satisfied by a caller-supplied value;
aws:username/fails closed likeaws:username/x.CheckVariablesa no-op, dropping theslash on marshal, or letting a trailing slash read a value each fail a test.
Servers need a follow-up to call
CheckVariableson their save paths; theAIStor change follows once this merges.
🤖 Generated with Claude Code
Summary by CodeRabbit