Skip to content

Conversation

@kenibrewer
Copy link
Member

@kenibrewer kenibrewer commented Sep 18, 2025

Summary

  • Restricts IAM policy permissions to follow the principle of least privilege
  • Scopes IAM roles and instance profiles to TowerForge* prefix instead of wildcard resources
  • Adds resource-level restrictions for EC2 operations based on TowerForge-* instance naming
  • Splits launch policy into granular statements with appropriate conditions

Test plan

  • Verify that AWS Cloud compute environments can still be created with the new scoped policies
  • Test that only resources with the TowerForge prefix can be managed
  • Confirm pipeline launches and Studio sessions work as expected

🤖 Generated with Claude Code

- Scope IAM roles and instance profiles to TowerForge* prefix
- Add resource-level restrictions for EC2 operations
- Split launch policy into granular statements with conditions
- Restrict instance operations to TowerForge-* tagged resources

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@netlify
Copy link

netlify bot commented Sep 18, 2025

Deploy Preview for seqera-docs ready!

Name Link
🔨 Latest commit e764a5b
🔍 Latest deploy log https://app.netlify.com/projects/seqera-docs/deploys/68cc7eb613f10d0008b309e7
😎 Deploy Preview https://deploy-preview-839--seqera-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@justinegeffen justinegeffen added the 1. Dev/PM/SME Needs a review by a Dev/PM/SME label Sep 22, 2025
@justinegeffen
Copy link
Contributor

Thanks, @kenibrewer! Adding Georgi for a dev review and then good to merge.

Copy link
Contributor

@georgi-seqera georgi-seqera left a comment

Choose a reason for hiding this comment

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

At a glance looks good to me, but I've not really been involved in the AWS Cloud CE work, so I'll defer to @stefanoboriero who is more familiar with the resource management of the AWS Cloud CE

@kenibrewer
Copy link
Member Author

Do the same changes need to be made for Enterprise docs too? Or are the pages linked?

Copy link
Contributor

@stefanoboriero stefanoboriero left a comment

Choose a reason for hiding this comment

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

The main reason why I didn't scope them down by prefix in the docs is that the prefix is actually configurable by Enterprise users (see TOWER_FORGE_PREFIX in https://docs.seqera.io/platform-enterprise/enterprise/configuration/overview), and I wanted to be as generic as possible. If we want to add this to the docs, we should be clear that if you override the default forge prefix this permissions cannot be copy-pasted.

Comment on lines +132 to +138
"arn:aws:ec2:*:*:instance/*",
"arn:aws:ec2:*:*:volume/*",
"arn:aws:ec2:*:*:network-interface/*",
"arn:aws:ec2:*:*:subnet/*",
"arn:aws:ec2:*:*:security-group/*",
"arn:aws:ec2:*:*:key-pair/*",
"arn:aws:ec2:*:*:image/*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really any different than using *? Actions are anyhow not applicable to all resource types, so defining individual resource types still with a star permission doesn't seem to change much the scope of the actual permissions.

For example, with the current config I can't use ec2:RunInstances on a Kinesis stream, because the action already carries the scope of what resource type it can be taken against.

On the other hand I get this might have a placebo effect if someone reads it through without giving it much thought, it seems more scoped.

"Sid": "AwsCloudLaunchInstances",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you test this? AWS Docs say that using the ec2:ResourceTag/Name condition key is not supported for action ec2:DescribeInstances. See https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonec2.html#amazonec2-actions-as-permissions.

"Action": [
"logs:GetLogEvents"
],
"Resource": "arn:aws:logs:*:*:log-group:*:log-stream:*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above, this does not seem to move the needle much in terms of actual permission scopes. However here we could be more specific, since we know the exact log group we're interested into, which is tower/nextflow-run

Copy link
Member Author

Choose a reason for hiding this comment

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

Great. Please implement.

"Action": [
"s3:GetObject"
],
"Resource": "*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Leaving the star here is inconsistent with the general approach taken of specify arns, even if the actual scoping outcome is the same. I would either do it everywhere or nowhere

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed.

@kenibrewer
Copy link
Member Author

I don't have the bandwidth to bring this PR to completion. Can someone else work on this and ping me for a review so I can ensure it meets pre-sales needs?

Addressing the specific feedback. It is VERY IMPORTANT in my view to scope things using the TowerForge-* prefix. It also provides the best scoping in terms of reduced permissions. The most important customer consuming these docs are prospects working through a POC. They're probably on Seqera Cloud where that customization can't occur, and if they are enterprise, most of them aren't using TOWER_FORGE_PREFIX . We need these prospects to be able to copy and paste into the AWS console with few changes.

To address the TOWER_FORGE_PREFIX scenario, we should add a note on the page that says "If you use TOWER_FORGE_PREFIX you can customize the policy with a find and replace".

@stefanoboriero
Copy link
Contributor

Can someone else work on this and ping me for a review so I can ensure it meets pre-sales needs?

I'll pick this up and ping you for review

@robnewman
Copy link
Member

@stefanoboriero @justinegeffen Can we get this re-reviewed and merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Dev/PM/SME Needs a review by a Dev/PM/SME

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants