Skip to content
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

feat(aws-iam): Add permissionsBoundary to IAM Role L2 construct #2919

Closed
wants to merge 3 commits into from

Conversation

robertd
Copy link
Contributor

@robertd robertd commented Jun 19, 2019

Closes #2915

@eladb @rix0rrr @skinny85 Please review... I hope I did it right 😅.


Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
    • Design: For significant features, design document added to design folder
  • Title and Description
    • Change type: title prefixed with fix, feat and module name in parens, which will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@robertd robertd requested a review from a team as a code owner June 19, 2019 03:45
@robertd robertd force-pushed the iam-role-add-permissions-boundary branch from 9244fbf to 9c2b7af Compare June 19, 2019 03:46
* @link https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html
*/

readonly permissionsBoundary?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t that be IPolicy?

@robertd robertd force-pushed the iam-role-add-permissions-boundary branch from 9c2b7af to cf1a17f Compare June 20, 2019 01:40
@robertd
Copy link
Contributor Author

robertd commented Jul 3, 2019

@eladb I'm going to need a bit of help with this PR. I can't figure out why IPolicy change is not working as intended. Any help/pointers is more than appreciated.

@robertd robertd force-pushed the iam-role-add-permissions-boundary branch 4 times, most recently from e4851b9 to 6fe42ee Compare July 6, 2019 02:07
@robertd robertd force-pushed the iam-role-add-permissions-boundary branch from 6fe42ee to 9891b25 Compare July 6, 2019 19:15
@robertd
Copy link
Contributor Author

robertd commented Jul 6, 2019

@eladb @rix0rrr I've taken a stab at this. It needs a review. One can now pass permissions boundary policy in L2 role construct. I apologize for so many forced pushes, but master has been somewhat of a moving target lately :). I'm open for feedback.

Few things to consider. I was not able to figure out how to create setPermissionsBoundary method that would be used after role has been created (i.e. role.setPermissionsBoundary(boundaryPolicy). Perhaps someone can guide me how to accomplish that.

*
* @default - No permissions boundaries required.
*/
readonly permissionsBoundary?: IPolicy;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this needs to be a managed policy instead of a policy. AFAIK you can not attach an inline policy as a permissions boundary. Once this proposed change is through (#2974 (comment)), customer managed policies will then also be supported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a PR for that change here #3578 so people can get some eyes on it

@SanderKnape
Copy link

@robertd are you able to make the required changes to this PR? If not I can have a look at implementing this.

@robertd
Copy link
Contributor Author

robertd commented Aug 8, 2019 via email

@@ -240,6 +262,13 @@ export class Role extends Resource implements IRole {
}
return result;
}

function _setPermissionsBoundary(policy?: IPolicy) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather inline this as a ternary.

*
* @attribute
*/
readonly permissionsBoundary?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it a string?

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 9, 2019

Superseded by Sander's PR.

@rix0rrr rix0rrr closed this Aug 9, 2019
@robertd robertd deleted the iam-role-add-permissions-boundary branch August 9, 2019 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(iam) Ability to set PermissionBoundary when creating IAM Role using L2 construct
5 participants