-
Notifications
You must be signed in to change notification settings - Fork 102
IAM Roles | Store roles in accounts with type=role instead of a separate iam_roles collection #9916
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
base: master
Are you sure you want to change the base?
Changes from all commits
558706a
0d8c22e
ce352a3
8a58fdc
7a08834
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,11 @@ module.exports = { | |
| enum: ['DISABLED', 'SUSPENDED', 'ENABLED'] | ||
| }, | ||
|
|
||
| identity_type: { | ||
| type: 'string', | ||
| enum: ['ACCOUNT', 'USER', 'ROLE'] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we planning to add type for users too?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we set it for all three:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current accounts saved in the DB don't have this enum ( |
||
| }, | ||
|
|
||
| assume_role_policy: { | ||
| type: 'object', | ||
| required: ['statement'], | ||
|
|
@@ -586,7 +591,7 @@ module.exports = { | |
| } | ||
| }, | ||
|
|
||
| iam_user_policy: { | ||
| iam_inline_policy: { | ||
| type: 'object', | ||
| required: ['policy_name', 'policy_document'], | ||
| properties: { | ||
|
|
@@ -596,7 +601,10 @@ module.exports = { | |
| } | ||
| } | ||
| }, | ||
|
|
||
| // TODO: NC compatibility alias, remove after NC migrates to iam_inline_policy | ||
| iam_user_policy: { | ||
| $ref: '#/definitions/iam_inline_policy', | ||
| }, | ||
| // IAM role trust policy (who can assume this role) | ||
| iam_trust_policy_principal: { | ||
| allOf: [{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ type ID = mongodb.ObjectID; | |
| type DBBuffer = mongodb.Binary | Buffer; | ||
|
|
||
| type LockType = "EXCLUSIVE" | "SHARED" | undefined; | ||
| type IdentityType = 'ACCOUNT' | 'USER' | 'ROLE'; | ||
|
|
||
| interface System extends Base { | ||
| _id: ID; | ||
|
|
@@ -92,25 +93,28 @@ interface Account extends Base { | |
| email: SensitiveString; | ||
| next_password_change: Date; | ||
| is_support?: boolean; | ||
| identity_type?: IdentityType; | ||
| access_keys: Array<{ | ||
| access_key: SensitiveString; | ||
| secret_key: SensitiveString; | ||
| }>; | ||
| master_key_id: ID; | ||
| iam_path?: string; | ||
| iam_inline_policies?: object[]; | ||
| description?: string; | ||
| max_session_duration?: number; | ||
| assume_role_policy_document?: object; | ||
|
Comment on lines
+104
to
+106
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment so it would be clear that those fields are only relevant for roles? |
||
| creation_date?: Date; | ||
|
shirady marked this conversation as resolved.
|
||
| deleted?: Date; | ||
| } | ||
|
|
||
| interface IamRole extends Base { | ||
| _id: ID; | ||
| /** IAM role identity stored in accounts with identity_type === 'ROLE' */ | ||
| type IamRole = Account & { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we use it? |
||
| identity_type: 'ROLE'; | ||
| owner: ID; | ||
| name: string; | ||
| iam_path: string; | ||
| description?: string; | ||
| max_session_duration?: number; | ||
| assume_role_policy_document: object; | ||
| iam_role_policies?: object[]; | ||
| creation_date: Date; | ||
| deleted?: Date; | ||
| } | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where do you use those
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have used
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure you need to remove, we just need to understand where it is used. |
||
| interface NodeAPI extends Base { | ||
| _id: ID; | ||
|
|
||
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.
will make this field name consistent in NC. I had used 'type', will rename to 'identity_type'