Skip to content
Closed
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
17 changes: 17 additions & 0 deletions .github/workflows/ghcr-image-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,20 @@ jobs:
DIGEST: ${{ steps.push.outputs.digest }}
TAGS: ${{ steps.meta.outputs.tags }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes "{}@${DIGEST}"

test-permissions:
runs-on: [ubuntu-latest]
permissions:
contents: read
id-token: write
steps:
- name: Get GitHub token
id: get-token
uses: grafana/shared-workflows/actions/create-github-app-token@ae92934a14a48b94494dbc06d74a81d47fe08a40 # v0.2.2
with:
github_app: grafana-otel-bot
permission_set: default
- name: Show token permissions
run: |
echo "${{ steps.get-token.outputs.token }}" | gh auth login --with-token
Comment on lines +121 to +122
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

The GitHub App token is being exposed in the workflow logs through the echo command. This creates a security vulnerability as tokens should never be printed to logs where they can be viewed by anyone with access to the workflow runs.

Consider using an environment variable instead:

- name: Show token permissions
  env:
    GH_TOKEN: ${{ steps.get-token.outputs.token }}
  run: |
    gh auth status

The gh CLI automatically uses the GH_TOKEN environment variable for authentication without needing to explicitly log in.

Suggested change
run: |
echo "${{ steps.get-token.outputs.token }}" | gh auth login --with-token
env:
GH_TOKEN: ${{ steps.get-token.outputs.token }}
run: |

Copilot uses AI. Check for mistakes.
gh auth status
Loading