Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Check release environment
env:
PRODUCTION_REPO_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }}
Comment on lines +18 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL SECRET_EXPOSURE Keep the production token away from PR-controlled code

Because this pull_request job executes the checked-out bin/check-release-environment, a same-repository PR named release-please* or next can replace that script and exfiltrate the newly injected PAT. Keep the check on trusted base code before exposing secrets.

Prompt to fix with AI

Copy this prompt into your AI coding assistant to fix this issue.

In .github/workflows/release-doctor.yml at lines 18-19, prevent PRODUCTION_REPO_TOKEN from being available to code supplied by a pull request. Run the release-environment validation from a trusted base/default-branch revision, or redesign the trigger so the secret is only injected after untrusted PR code cannot execute, while preserving validation for legitimate release-please PRs.

run: |
bash ./bin/check-release-environment
4 changes: 2 additions & 2 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

errors=()

if [ -z "${RELEASE_PLEASE_TOKEN}" ]; then
errors+=("The RELEASE_PLEASE_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.")
if [ -z "${PRODUCTION_REPO_TOKEN}" ]; then
errors+=("The PRODUCTION_REPO_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.")
fi

lenErrors=${#errors[@]}
Expand Down
Loading