-
Notifications
You must be signed in to change notification settings - Fork 89
IAM | Account Schema Changes for Supporting Inline User Policy #9269
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
Conversation
WalkthroughAdds new IAM user policy JSON Schema definitions to the common API and exposes an Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/server/system_services/schemas/account_schema.js (1)
37-42: Consider adding validation constraints for the policy array.While the schema structure is correct, consider adding constraints to align with AWS IAM limits and prevent potential issues:
maxItemsconstraint (AWS allows up to 10 inline policies per IAM user)- Policy name uniqueness validation (though this might be enforced at the application level)
Apply this diff to add a maximum items constraint:
iam_user_policies: { type: 'array', + maxItems: 10, items: { $ref: 'common_api#/definitions/iam_user_policy', } },src/api/common_api.js (1)
563-572: Consider adding validation constraints for policy_name.The
policy_namefield currently has no length or pattern constraints. To align with AWS IAM requirements and ensure data quality, consider adding validation rules:
- AWS IAM policy names: 1-128 characters
- Allowed characters: alphanumeric and
+=,.@-_Apply this diff to add validation constraints:
iam_user_policy: { type: 'object', required: ['policy_name', 'policy_document'], properties: { - policy_name: { type: 'string' }, + policy_name: { + type: 'string', + minLength: 1, + maxLength: 128, + pattern: '^[\\w+=,.@-]+$' + }, policy_document: { $ref: 'common_api#/definitions/iam_user_policy_document', } } },
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/api/common_api.js(1 hunks)src/server/system_services/schemas/account_schema.js(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Noobaa Image
- GitHub Check: run-package-lock-validation
- GitHub Check: run-jest-unit-tests
🔇 Additional comments (1)
src/api/common_api.js (1)
490-561: LGTM! Schema structure correctly implements IAM user policy document.The
iam_user_policy_documentdefinition correctly adapts thebucket_policystructure for inline user policies by removingPrincipal,NotPrincipal, andConditionfields. The mutual exclusivity validation usingallOfwithoneOfschemas properly enforces that statements must have eitherActionorNotAction, and eitherResourceorNotResource.
liranmauda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: shirady <[email protected]>
acec4d0 to
b92c485
Compare
Describe the Problem
Adding the schema for IAM User Policy inline policy.
The API implementation would be in a separate PR.
Explain the Changes
common_apiiam_user_policy_documentbased onbucket_policystructure withoutPrincipalandNotPrincipal(andCondition), and createiam_user_policy.iam_user_policiesinaccountschema (which also serves for IAM users).Note: the explanation why I could not just
refbucket_policyin the comments (link).Issues:
Testing Instructions:
Summary by CodeRabbit