FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Declare permissions by jsoref · Pull Request #15493 · github/codeql · GitHub

/ codeql Public

Declare permissions - #15493

Merged
angelapwen merged 2 commits into
github:mainfrom
jsoref:declare-permissions
Feb 15, 2024
Merged

Declare permissions#15493
angelapwen merged 2 commits into
github:mainfrom
jsoref:declare-permissions

Conversation

jsoref commented Jan 31, 2024

Copy link
Copy Markdown
Contributor

Repositories can be configured with Default access (restricted) https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

Best practice says that workflows should declare the minimal permissions they require. Without declaring permissions, paranoid forks fail miserably.

closes #15462

jsoref commented Jan 31, 2024

Copy link
Copy Markdown
Contributor Author

To make the Check change note workflow happy, please add label:no-change-note-required

angelapwen previously approved these changes Jan 31, 2024

angelapwen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I looked at your fork of the repo, which has identical permissions and works 👍 thank you for the contribution!

angelapwen added the no-change-note-required This PR does not need a change note label Jan 31, 2024
jsoref force-pushed the declare-permissions branch from b997f22 to c5a047d Compare January 31, 2024 14:09
github-actions Bot removed the C# label Jan 31, 2024

angelapwen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Blocking merge until the other comments are addressed 😄

jsoref force-pushed the declare-permissions branch from 9da590e to 301cfcc Compare February 1, 2024 15:39
jsoref requested a review from angelapwen February 4, 2024 16:21

aeisenberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for contributing this. I like that this narrows the permissions of all of our tokens.

I think .github/workflows/csv-coverage-update.yml is broken. I have a few other suggestions that will allow you to narrow the permissions. security-events is only required if we are reading or writing SARIF to or from code scanning.

I do have a concern that these jobs haven't been run. Are you able to trigger them in your fork to make sure all permissions are correct?

What we do in other repos and can do here (but best to wait for a followup PR) is to add a chunk that ensures the workflow file is run whenever the workflow file itself is modified.

eg-

  pull_request:
    paths:
      - '.github/workflows/csv-coverage-timeseries.yml'

(and similar for all other workflow files)

Comment thread .github/workflows/ql-for-ql-tests.yml Outdated
Comment thread .github/workflows/query-list.yml Outdated
Comment thread .github/workflows/ruby-qltest.yml Outdated
Comment thread .github/workflows/swift.yml Outdated

jsoref commented Feb 7, 2024

Copy link
Copy Markdown
Contributor Author

@aeisenberg: the design of these workflows is really painful.

jsoref force-pushed the declare-permissions branch from 301cfcc to 0f2888b Compare February 12, 2024 22:30
Comment on lines -22 to +27
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@main

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@aeisenberg says:

All of it really should be using @main since we want to test on the latest in case we break something.

jsoref requested a review from aeisenberg February 12, 2024 22:34

aeisenberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Partial review. I'm finding it hard to verify that this PR is correct.

Comment thread .github/workflows/csharp-qltest.yml Outdated
Comment thread .github/workflows/csharp-qltest.yml Outdated
aeisenberg previously approved these changes Feb 13, 2024

aeisenberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is looking good to me, but since this change affects lots of files, I'd like someone else to approve as well.

angelapwen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Some questions in comments. Also, I still see a bunch of security-events: read permissions here: are those necessary? I see that they were able to be dropped from a few workflows because of the changes you'd made in the Action 😄

Comment thread .github/workflows/csharp-qltest.yml Outdated
Repositories can be configured with Default access (restricted)
https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

Best practice says that workflows should declare the minimal permissions they require.
Without declaring permissions, paranoid forks fail miserably.

Copy link
Copy Markdown
Contributor

Thank you for your patience and of course contributions @jsoref!! Merging now 💕

angelapwen merged commit 0643184 into github:main Feb 15, 2024
jsoref deleted the declare-permissions branch February 15, 2024 10:59
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

Labels

no-change-note-required This PR does not need a change note QL-for-QL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflows are missing permissions requests

3 participants


Back | FazBrowse Home | New Git URL