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

Scope GITHUB_TOKEN permissions #4084

Merged
merged 1 commit into from
Apr 8, 2025
Merged

Conversation

landonxjames
Copy link
Contributor

@landonxjames landonxjames commented Apr 3, 2025

Description

This PR does a few things related to scoping our tokens:

  • Add a - uses: GitHubSecurityLab/actions-permissions/monitor@v1 to most of our actions so we can get ongoing summaries of the permissions each action is using. Some actions, like Windows tests and the TLS tests, are excluded because they are not supported or the proxy it uses breaks the test.
  • Add explicit permissions scoping to various jobs that need it.
  • Although not part of the PR I have changed our Workflow Permissions (in Settings > Actions > General > Workflow Permissions) from defaulting to Read/Write to Read Only.

Testing

Note: I did not test the prod release workflow for obvious reasons. It might need permissions added next time it is invoked. I will cut a release as a follow up to this PR to see if anything needs updating

Checklist


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

github-actions bot commented Apr 4, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 4, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 4, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 4, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 6, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 6, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 6, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 6, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@landonxjames landonxjames force-pushed the landonxjames/update-ci-3 branch from 6bc6126 to 826d538 Compare April 7, 2025 03:23
Copy link

github-actions bot commented Apr 7, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@landonxjames landonxjames marked this pull request as ready for review April 7, 2025 17:39
@landonxjames landonxjames requested review from a team as code owners April 7, 2025 17:39
actions: read
contents: read
id-token: write
pull-requests: read
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to educate myself, what's the reason for pull-requests to be set to read when it was previously none? Does that mean the workflow needs to read metadata for a pull request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is because the dry-run release calls release.yml which in turn invokes ci.yml which needs the pull-request permission. The GH permissions of the parent job are inherited by the child job and even if that child job skips the step that actually uses that permission it still needs it from the parent.

Interestingly I believe it was previously set to write rather than none since our previous default token permissions were set to:

Read and write permissions
Workflows have read and write permissions in the repository for all scopes.

As a side note, I think I will probably have to increase the pull-request permissions to write since the prod release will need that to cut the backport PR and prod/dry-run release both share the underlying release.yml action definition. Going to attempt a prod release once this is merged to finalize those permissions.

Copy link
Contributor

@ysaito1001 ysaito1001 left a comment

Choose a reason for hiding this comment

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

Must've been painful to go through all of these. Thanks for the update!

@landonxjames landonxjames enabled auto-merge April 8, 2025 17:39
@landonxjames landonxjames disabled auto-merge April 8, 2025 17:39
@aws-sdk-rust-ci aws-sdk-rust-ci merged commit a29bc69 into main Apr 8, 2025
41 of 44 checks passed
@aws-sdk-rust-ci aws-sdk-rust-ci deleted the landonxjames/update-ci-3 branch April 8, 2025 17:40
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.

3 participants