Repository navigation
feat(policy): add the s3files action namespace for AIStor Files - #281
Conversation
|
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 (5)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe policy package adds a Files action namespace, supports Files actions in action sets and policy statements, and adds tests for parsing, validation, authorization, and default-policy behavior. ChangesFiles policy actions
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change adds a separate Files action namespace to policy validation and evaluation. No concrete defects were found, and default policies do not grant Files actions, so the merge risk is minimal. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Existing default policies do not gain Files permissions, and ordinary Files grants preserve action separation, conditions, and explicit-deny precedence. No introduced security defect was established. Production enforcement remains uncertain because the management endpoints and their identity mapping are not available for review. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 checks each Files action, Comment |
AIStor Files is an NFSv4.1 gateway whose management API (add, remove and configure exports) is granted independently of AIStor admin, so its actions get their own namespace rather than joining admin:. Adds FilesAction with six actions and s3files:*: s3files:CreateExport s3files:DeleteExport s3files:UpdateExport s3files:SetExportAccess s3files:GetExportStatus s3files:GetExportStats FilesAction joins the ActionType union, the action-type exclusivity check, and statement validation. Files statements accept the common condition keys. They take no Resource or NotResource, and one is refused rather than ignored: an export is named by the request, not by an ARN, and an ignored Resource on an Allow would read as scoped to one export while granting every export. Refusing it now also leaves export-scoped ARNs free to be added later without changing what an existing policy means. No canned policy grants the namespace yet, consoleAdmin included.
0c3dca2 to
1cd7d2f
Compare
Description
Adds the
s3files:*policy action class (FilesAction) for the AIStor Files management API: adding, removing and configuring NFS exports. It is granted independently of AIStor admin, so it gets its own namespace rather than joiningadmin:.s3files:CreateExports3files:DeleteExports3files:UpdateExports3files:SetExportAccesss3files:GetExportStatuss3files:GetExportStatss3files:*It follows the other service-action classes: constants,
SupportedFilesActions,IsValid, and a condition-key map with the common keys. It is wired into theActionTypeunion, the action-type exclusivity check, and statement validation.Files statements take no
ResourceorNotResource, and refuse one rather than ignore it. An export is named by the request, not by an ARN. If a Resource were silently ignored, anAllowthat looks scoped to one export would grant every export. Refusing it now also keeps export-scoped ARNs open as a later, additive change: no existing policy can hold one whose meaning would shift.SetExportAccessis separate fromUpdateExporton purpose. Access rules decide which hosts may mount an export, so a grant to resize an export should not also open it to more clients.No canned policy grants the namespace,
consoleAdminincluded. That can follow separately, asmemory:*did in #269.Motivation and Context
AIStor's Files admin API needs these actions to authorize each endpoint. Landing them here first lets AIStor and
mcbump to a release that carries them.How Has This Been Tested?
go test ./...for the whole module,-raceand thenoasm,puregoandnounsafetag variants for./policy/, andgo tool golangci-lint(0 issues). New tests inpolicy/files-action_test.go:ParseConfigandParseConfigStrict, accepts single actions,s3files:*,Deny, and a common condition key. It refuses mixing withs3:oradmin:, anyResourceorNotResource(including*), and a non-common condition key;s3files:GetExportStatusallows that and denies the other five;s3files:*grants all six and nos3:,admin:ormemory:action;s3:*plusadmin:*grants none of them; an explicitDenywins;aws:SourceIpis enforced;Mutation-checked: removing the Resource refusal, or the Files arm of the exclusivity check, each fails the tests.
Summary by CodeRabbit