mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
ci(release): keep the publish job's write token out of the checkout (#7502)
The publish job's checkout persisted its contents:write token in .git/config, where every later step, including the package install and build, could read it. Check out without persisting credentials and give the token only to "Create release tag", the one step that pushes. It authenticates its own git calls through step-scoped GIT_CONFIG_* env and masks the encoded value. The gh steps keep their own GH_TOKEN. The workflow test now covers the checkout flag, which steps may receive the token and under what name, the auth header the tag push actually carries, and that nothing is written to .git/config. — Rames Jusso Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cda84222aa
commit
12d954a1fe
@@ -125,6 +125,9 @@ jobs:
|
||||
# release PR event exposes main as github.ref, which may advance
|
||||
# before this job starts; use the event's exact merge commit instead.
|
||||
ref: ${{ env.EXPECTED_RELEASE_SHA }}
|
||||
# Keep the write token out of .git/config. Only "Create release tag"
|
||||
# pushes, and it authenticates its own git calls.
|
||||
persist-credentials: false
|
||||
|
||||
- name: Verify immutable release checkout
|
||||
run: |
|
||||
@@ -172,7 +175,15 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
: "${GITHUB_TOKEN:?}"
|
||||
BASIC_AUTH="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 -w0)"
|
||||
echo "::add-mask::$BASIC_AUTH"
|
||||
export GIT_CONFIG_COUNT=1
|
||||
export GIT_CONFIG_KEY_0="http.https://github.com/.extraheader"
|
||||
export GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $BASIC_AUTH"
|
||||
|
||||
TAG="v$VERSION"
|
||||
EXPECTED_TAG_SHA="$(git rev-parse HEAD)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user