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

security: add permissions block to workflows #1575

Merged
merged 6 commits into from
Mar 12, 2024

Conversation

reakaleek
Copy link
Member

Details

⚠️ This PR was created by an automated tool. Please review the changes carefully. ⚠️

We want to set the default permissions for workflows to read-only for contents.
This is a security measure to prevent accidental changes to the repository.

This change adds a top-level permissions block to all workflows in the .github/workflows directory.

permissions:
  contents: read

In some cases workflows might need more permissions than just contents: read.
Please checkout this branch and add the necessary permissions to the workflows.

If your workflow uses a Personal Access Token (PAT), we can still add the permissions block,
but it will not have any effect.

Merging this PR as is might cause workflows that need more permissions to fail.

If there are any questions, please reach out to the @elastic/observablt-ci

@reakaleek reakaleek requested a review from a team as a code owner February 17, 2024 18:52
@reakaleek reakaleek requested a review from a team February 17, 2024 18:52
axw
axw previously approved these changes Feb 19, 2024
kruskall
kruskall previously approved these changes Feb 19, 2024
@reakaleek reakaleek enabled auto-merge (squash) March 11, 2024 12:56
@reakaleek reakaleek dismissed stale reviews from kruskall and axw via c6dcb71 March 11, 2024 13:05
@reakaleek reakaleek requested review from v1v, kruskall and axw March 11, 2024 13:07
v1v
v1v previously approved these changes Mar 11, 2024
@@ -12,6 +12,10 @@ on:
- '*.asciidoc'
- 'docs/**'

permissions:
contents: read
actions: read
Copy link
Member

Choose a reason for hiding this comment

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

what's the reason for actions:read? I don't recall we needed it

Copy link
Member Author

@reakaleek reakaleek Mar 11, 2024

Choose a reason for hiding this comment

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

I re-ran the gh-oblt script on this repo, and for some reason, this was added.
I don't know why it was missing since the workflow doesn't have a top-level permissions block.

I need to dig into this.

Copy link
Member Author

Choose a reason for hiding this comment

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

But yes, looking at the snapshoty-simple action, I also don't see a reason for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
actions: read

v1v
v1v previously approved these changes Mar 11, 2024
@reakaleek reakaleek requested a review from v1v March 11, 2024 15:35
@dmathieu dmathieu disabled auto-merge March 12, 2024 09:03
@dmathieu dmathieu enabled auto-merge (squash) March 12, 2024 09:04
@dmathieu dmathieu merged commit 699e8df into main Mar 12, 2024
13 checks passed
@dmathieu dmathieu deleted the gh-oblt/add-permission-block-to-workflows branch March 12, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants