mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
fix(sanitizer): redact GitHub user-to-server (ghu_) tokens (#1502)
redactGitHubTokens covers ghp_, gho_, ghs_, ghr_, and github_pat_ tokens but misses ghu_ (GitHub App user-to-server tokens), one of the documented GitHub token prefixes. A ghu_ token appearing in issue or PR content passed through sanitization unredacted. Add the ghu_ pattern, mirroring the existing 40-character token patterns, with unit tests including the git-credential URL form.
This commit is contained in:
@@ -83,6 +83,12 @@ export function redactGitHubTokens(content: string): string {
|
||||
"[REDACTED_GITHUB_TOKEN]",
|
||||
);
|
||||
|
||||
// GitHub user-to-server tokens: ghu_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (40 chars)
|
||||
content = content.replace(
|
||||
/\bghu_[A-Za-z0-9]{36}\b/g,
|
||||
"[REDACTED_GITHUB_TOKEN]",
|
||||
);
|
||||
|
||||
// GitHub installation tokens: ghs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (40 chars)
|
||||
content = content.replace(
|
||||
/\bghs_[A-Za-z0-9]{36}\b/g,
|
||||
|
||||
Reference in New Issue
Block a user