Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/integrations-add-to-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,27 @@ on:
types:
- opened

permissions: {}

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.2
# GITHUB_TOKEN has no permission on an organization project, so the token
# comes from the installation of a GitHub App on the project's
# organization. The issue or pull request is public, so the token needs no
# permission on this repository to read it.
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.ADD_TO_PROJECT_APP_CLIENT_ID }}
private-key: ${{ secrets.ADD_TO_PROJECT_APP_PRIVATE_KEY }}
owner: FiligranHQ
permission-organization-projects: write

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Explicitly specify the required permissions

One thing caught my attention while reading the actions/create-github-app-token

By default, the token inherits all of the installation's permissions.
We recommend to explicitly list the permissions that are required for a use case.

Since I don't have access to the GitHub App configuration, I cannot verify which permissions are currently granted to its installation.

Wouldn't it be worth explicitly restricting the token's permissions, even though the source repositories are public? This would help prevent the token from inheriting unnecessary write permissions for issues and pull requests, reducing the potential impact in case the token is compromised.

My suggestion would be to follow the GitHub recommendation and explicitly add the following permissions:

permission-issues: read
permission-pull-requests: read

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I believe the access is already restricted as permission-organization-projects: write makes the token request only that permission. Adding issues/pull-requests: read would widen it.


- uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
with:
project-url: ${{ vars.PROJECT_URL }}
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
project-url: ${{ vars.XTM_INTEGRATIONS_PROJECT_URL }}
github-token: ${{ steps.app-token.outputs.token }}
Loading