Description
I'm using the actions/create-github-app-token
action and trying to leverage the permission-<permission name>
inputs as defined here to request a token with a reduced set of permissions compared to what the App installation has been granted.
Expected Behavior:
Based on the action's documentation and the standard behavior of the GitHub API (POST /app/installations/{installation_id}/access_tokens), providing specific permission-* inputs should result in an installation access token that has permissions limited to the intersection of the requested permissions and the permissions granted to the App installation.
Actual Behavior:
Even when specifying a subset of permissions using permission-* inputs, the generated token appears to retain all the permissions originally granted to the App installation. It does not seem to be restricted to the subset requested in the workflow.
Steps to Reproduce:
- Configure a GitHub App with the following permissions granted to its installation:
- contents: write
- pull-requests: write
- Use the
actions/create-github-app-token
action in a workflow, requesting only read permissions for pull-requests and contents:
name: Test App Token Permissions
on: [push]
jobs:
test-token:
runs-on: ubuntu-latest
steps:
- name: Generate restricted token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: read
permission-pull-requests: read
- name: Create Pull Request
# This step should ideally fail if permissions were restricted correctly
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
- Observe that operations requiring permissions not explicitly requested in the workflow step (i.e.
pull-requests: write
) still succeed when using the generated token. In my specific case, I was able to create Pull Requests using the token generated with only checks: read and contents: read requested.
Is this the intended behavior, or is there potentially an issue with how the permission-* inputs are processed and passed to the GitHub API? According to the documentation, I would expect the token's permissions to be strictly limited to those requested via the inputs.