Add IAM Permissions Boundary support for environments#1928
Open
Add IAM Permissions Boundary support for environments#1928
Conversation
e9f6db7 to
eee7891
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to configure an IAM Permissions Boundary policy on data.all environments. When set, the boundary is automatically applied to all IAM roles created by the environment, dataset, and pipeline CDK stacks — including roles auto-generated by CDK constructs (e.g.
cr.Provider,BucketDeployment).This is a common requirement for organizations that enforce permissions boundaries as part of their AWS account governance.
Changes
Backend
input_types.py,types.py): AddedPermissionsBoundaryPolicyArnas an optional string field toNewEnvironmentInput,ModifyEnvironmentInput, and theEnvironmenttype.environment_models.py): Added nullablePermissionsBoundaryPolicyArncolumn to theEnvironmentmodel.environment_service.py): Handles the new field on create and update. On update, the field is set when the key is present in the input (including empty string to clear it).permissions_boundary_aspect.py): NewPermissionsBoundaryAspectclass that walks the construct tree and addsPermissionsBoundaryto everyAWS::IAM::Roleresource. Applied in:environment_stack.pydataset_stack.pydatapipelines_pipeline.pya4f8b2c1d3e5): Adds thePermissionsBoundaryPolicyArncolumn to theenvironmenttable.Migration fix
ba2da94739ab: Replaced ORMsession.query(Environment)andsession.query(DatasetBase)with raw SQL queries. The ORM model now includes the new column, which doesn't exist in the DB when this older migration runs — causing aProgrammingError. Using raw SQL with only the needed columns avoids this.Frontend
getEnvironment.js: AddedPermissionsBoundaryPolicyArnto the GraphQL query.EnvironmentCreateForm.js: Added optional text field in the Deployment card and included the value in the create mutation payload.EnvironmentEditForm.js: Added optional text field in the AWS Information card and included the value in the update mutation payload.EnvironmentConsoleAccess.js: Displays the boundary ARN in the AWS Information section on the environment details page (conditionally rendered when set).Integration tests
queries.py: AddedPermissionsBoundaryPolicyArnto theENV_TYPEfragment and as an optional parameter tocreate_environment.global_conftest.py: Passed the new parameter through thecreate_envcontext manager.session_env1now creates withPermissionsBoundaryPolicyArn='arn:aws:iam::aws:policy/AdministratorAccess'.test_environment.py: Addedtest_env_permissions_boundarywhich asserts the boundary ARN is returned by the API and verifies the environment's default IAM role in AWS has the boundary attached.How it works
Testing
PermissionsBoundaryproperty set after stack deploymentResolve #1233