Use git -c credential.helper for git push — token never embedded in URL, written to .git/config, or derived into an unmasked value#32
Conversation
…itten to .git/config Co-authored-by: pmalarme <686568+pmalarme@users.noreply.github.com>
http.extraHeader for git push — token never embedded in URL or written to .git/config
…o copilot/sub-pr-18-again
|
@copilot by doing that you can decode the token and it won't be masked? |
…ectly, stays masked by GitHub Actions Co-authored-by: pmalarme <686568+pmalarme@users.noreply.github.com>
Correct — that was a real problem. GitHub Actions only masks the literal value of Fixed in commit git -c "credential.helper=!f() { printf 'username=x-access-token\npassword=%s\n' \"${GH_TOKEN}\"; }; f" \
push "https://${REMOTE_HOST}/${GH_REPOSITORY}.git" "$TAG"Since |
http.extraHeader for git push — token never embedded in URL or written to .git/configgit -c credential.helper for git push — token never embedded in URL, written to .git/config, or derived into an unmasked value
There was a problem hiding this comment.
Security Review — PR #32
Overall posture: ✅ Positive change — no blocking issues found.
This PR correctly addresses the credential exposure risk where embedding a GitHub token directly in a push URL could leak it through git error messages and verbose output. The http.extraHeader approach is the recommended pattern.
What looks good
- Token is no longer embedded in any URL or stored in
.git/config ENCODED_TOKENis a shell-local variable (not exported), so it is not inherited by child processesunset ENCODED_TOKEN(andunset ENCODED_TOKEN PUSH_CMDinpython-release.yml) is called promptly after usebase64encoding is the correct encoding for HTTP Basic Auth — not a security concern- The
PUSH_CMDarray pattern inpython-release.ymlcorrectly avoids splitting on spaces in the header value
Findings
| # | Category | Severity | File | Issue |
|---|---|---|---|---|
| 1 | CI/CD Security (§14) | Informational | monorepo-release.yml:78 |
-c http.extraHeader=… arg is visible in the process list during git push; ACTIONS_STEP_DEBUG warning comment is now slightly inaccurate |
| 2 | CI/CD Security (§14) | Informational | python-release.yml:55 |
Same as above for the PUSH_CMD array; nearby WARNING comment refers to "push URL" which no longer contains the token |
Both findings are informational only — the risk is the same as the old URL-based approach and is negligible in GitHub Actions' isolated VM environment. The inline comments include suggested WARNING comment updates to keep documentation accurate.
No other issues found across all 15 security posture categories.
There was a problem hiding this comment.
Pull request overview
This PR enhances security in GitHub Actions release workflows by replacing token-embedded URLs with git credential helpers, preventing token exposure in logs and configuration files.
Changes:
- Modified python-release.yml to use inline credential helper instead of token-embedded URLs
- Modified monorepo-release.yml to use the same secure credential helper pattern
- Updated comments to explain the security benefits and correct variable usage
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/python-release.yml | Replaced token-embedded git push URL with inline credential helper using GH_TOKEN directly |
| .github/workflows/monorepo-release.yml | Replaced token-embedded git push URL with inline credential helper using GH_TOKEN directly |
ef7d199
into
feature/add-documentation-and-copilot-instructions
Summary
Embedding a token in a
git pushURL risks credential exposure in git error messages and verbose output. Usinggit remote set-urlis equally problematic since it persists the token in.git/config. An earlier iteration usedgit -c http.extraHeaderwith a base64-encoded token, but base64-derived values are not automatically masked by GitHub Actions — only the raw secret value is. This switches both release workflows to pass credentials via an inlinegit -c credential.helpershell function that uses${GH_TOKEN}directly, avoiding all three issues.monorepo-release.ymlandpython-release.yml:git push "https://x-access-token:${TOKEN}@..."with:${GH_TOKEN}is used directly (the raw secret value), so GitHub Actions will mask it if it ever appears in logs..git/config, never embedded in a URL, and no derived/unmasked value is created.Testing
uv run poe checkChecklist
Additional context
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.