Skip to content

Conversation

@anomiex
Copy link
Contributor

@anomiex anomiex commented Nov 24, 2025

Closes MONOREP-256

Proposed changes:

I'm not sure quite how much I trust
GitHubSecurityLab/actions-permissions/monitor. It identified most of these, but it didn't cover all code paths.

Overall it's probably useful as one tool in the toolbox, but can't be relied on to catch everything.

What it did find:

  • dorny/paths-filter needs pull-requests: read.
  • repo-gardening seems to need issues: write and pull-requests: write.

What it didn't:

  • actions/checkout supposedly needs contents: read, but it wasn't flagged. Maybe it only needs it for private repos?
  • Our ./.github/actions/turnstile should need actions: read, but it wasn't flagged. Maybe it only needs it for private repos?
  • Linting / Phan stubs / Warn about stubs will need pull-requests: write, which wasn't flagged because it was never triggered.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Follow-up to #46004

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • CI happy?
  • Try making a PR that triggers the Linting / Phan stubs message.
  • No idea how to test the gardening project parts. Maybe @jeherve knows? Oh, that part uses a different token (triage_projects_token), so the permissions in the workflow don't matter for it.

I'm not sure quite how much I trust
`GitHubSecurityLab/actions-permissions/monitor`. It identified most of
these, but it didn't cover all code paths.

What it did find:
* `dorny/paths-filter` needs `pull-requests: read`.
* repo-gardening seems to need `issues: write` and `pull-requests: write`.

What it didn't:
* `actions/checkout` supposedly needs `contents: read`, but it wasn't
  flagged. Maybe it only needs it for private repos?
* Our `./.github/actions/turnstile` should need `actions: read`, but it
  wasn't flagged. Maybe it only needs it for private repos?
* Linting / Phan stubs / Warn about stubs will need
  `pull-requests: write`, which wasn't flagged because it was never
  triggered.
* As for repo-gardening's project stuff, AFAICT all the project stuff is
  org-level rather than repo-level and so doesn't have permissions. 🤷
@anomiex anomiex requested review from a team and jeherve November 24, 2025 19:31
@anomiex anomiex self-assigned this Nov 24, 2025
@github-actions github-actions bot added the Actions GitHub actions used to automate some of the work around releases and repository management label Nov 24, 2025
@github-actions
Copy link
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@anomiex anomiex changed the title cactions: Set permissions in linting and gardening workflows actions: Set permissions in linting and gardening workflows Nov 24, 2025
Copy link
Contributor

@tbradsha tbradsha left a comment

Choose a reason for hiding this comment

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

Seems safe enough.

Comment on lines +36 to +37
# dorny/paths-filter
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.

It seems steps can't have permissions, and they just inherit from the job (or the workflow). Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

group: gardening-${{ github.event_name }}-${{ github.event.action }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.ref || github.run_id }}
cancel-in-progress: true

permissions:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth updating projects/github-actions/repo-gardening/README.md with this info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not this specifically. But either documenting that the action as a whole needs these permissions, or documenting which automations within the action need which permissions, would probably be useful if someone wants to do it.

@anomiex anomiex merged commit 46d4fc0 into trunk Nov 25, 2025
66 of 67 checks passed
@anomiex anomiex deleted the update/set-permissions-in-linting-gardening-workflows branch November 25, 2025 16:08
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Actions GitHub actions used to automate some of the work around releases and repository management [Pri] Normal [Type] Janitorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants