You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(security): mask_secrets masks every GitHub token prefix, ghu_, ghs_ and ghr_ included #1398
scope/securitySecurity linters (trivy, bandit, gitleaks, kubeconform) and Vaultsource/agentFiled by an agenttype/securityType security: a vulnerability or a leak
mask_secrets (src/devops_cli/security/sanitizer.py:151) masks GitHub tokens with the prefixes ghp_, gho_ and github_pat_, and credentials inside URLs. It does not mask the other prefixes GitHub documents: ghu_ (user-to-server), ghs_ (server-to-server, such as a GitHub App installation token) and ghr_ (refresh). Found during #1124's review on 2026-10-08: a ghs_ token in a pre-receive hook's message would be printed unmasked in the release command's error output.
Acceptance criteria
mask_secrets masks every GitHub token prefix GitHub documents (ghp_, gho_, ghu_, ghs_, ghr_, github_pat_), each with its documented minimum length, in one pattern.
A parametrized test masks a sample of each prefix inside surrounding text and leaves a near-miss (a shorter body, or the prefix inside a longer word) unmasked.
Each test call phase stays under 1 s and uv run devops ci passes; changelog.d/<n>.md records the change under ### Security.
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
Priority: P1-High. A real token (e.g. a ghs_ GitHub App installation token) can be printed unmasked in error output, which is a direct credential-exposure risk.
Value: High. Prevents live GitHub tokens from leaking into logs, error messages, or LLM-bound text, protecting users' credentials.
Effort: Low. The fix is adding three prefixes to an existing regex pattern plus a parametrized test; the acceptance criteria are fully specified.
Placed in v0.2.30 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: P1 secret and sandbox-boundary fixes, the review tools lock, kube-linter finding identity and a faster gate. Position 1 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
mask_secrets now masks every GitHub token prefix in one pattern: ghp_, gho_, ghu_, ghs_, ghr_ and github_pat_. That includes the new ghs_APPID_JWT installation tokens, which run to about 520 characters, contain dots, and include Actions' GITHUB_TOKEN. #1124's review found that a ghs_ token in a pre-receive hook's message would have reached the release command's error output unmasked.
Acceptance Criteria of docs/agent/tasks/task-1398-mask-every-github-token-prefix.md:
mask_secrets masks every prefix GitHub documents (ghp_, gho_, ghu_, ghs_, ghr_, github_pat_) in one pattern, each with the minimum length above. test_every_github_token_prefix_is_masked_whole masks a sample of each prefix, plus a ghs_APPID_JWT installation token, inside remote: ... rejected. It compares the whole line, which proves no part of a token is printed.
A parametrized test masks each sample inside surrounding text (test_every_github_token_prefix_is_masked_whole). test_a_near_miss_github_token_is_left_alone leaves seven near-misses unchanged: a short body for ghu_, ghs_ and github_pat_, a prefix after a letter (xghr_...), and three snake_case names with _ghu_, _ghr_ and _ghs_ whose tails pass each minimum. The samples are built in code, so the test source holds no literal token. The ghs_APPID_JWT sample is built once, in tests/github_token_samples.py, which both test files import.
sanitize_diff_output masks a whole ghs_APPID_JWT token (test_sanitize_diff_output_masks_a_whole_installation_token), and test_sanitize_diff_output_secrets still passes.
Each new test's call phase stays under 1 s, and uv run devops ci passes. changelog.d/1398.md records the change under ### Security, and CHANGELOG.md and docs/ROADMAP.md are untouched.
scope/securitySecurity linters (trivy, bandit, gitleaks, kubeconform) and Vaultsource/agentFiled by an agenttype/securityType security: a vulnerability or a leak
Activity
dan-petty-bot commentedon Oct 8, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
A real token (e.g. a ghs_ GitHub App installation token) can be printed unmasked in error output, which is a direct credential-exposure risk.Prevents live GitHub tokens from leaking into logs, error messages, or LLM-bound text, protecting users' credentials.The fix is adding three prefixes to an existing regex pattern plus a parametrized test; the acceptance criteria are fully specified.dan-petty commentedon Oct 8, 2026
Placed in v0.2.30 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: P1 secret and sandbox-boundary fixes, the review tools lock, kube-linter finding identity and a faster gate. Position 1 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
fix(security): mask_secrets masks every GitHub token prefix, ghu_, gh…
dan-petty-bot commentedon Oct 9, 2026
What changed
#1464, merged into
release/v0.2.30as a3bb370.8 file(s) changed.
How it was verified
Check runs at 6c79be1:
Acceptance Criteria of
docs/agent/tasks/task-1398-mask-every-github-token-prefix.md:mask_secretsmasks every prefix GitHub documents (ghp_,gho_,ghu_,ghs_,ghr_,github_pat_) in one pattern, each with the minimum length above.test_every_github_token_prefix_is_masked_wholemasks a sample of each prefix, plus aghs_APPID_JWTinstallation token, insideremote: ... rejected. It compares the whole line, which proves no part of a token is printed.test_every_github_token_prefix_is_masked_whole).test_a_near_miss_github_token_is_left_aloneleaves seven near-misses unchanged: a short body forghu_,ghs_andgithub_pat_, a prefix after a letter (xghr_...), and three snake_case names with_ghu_,_ghr_and_ghs_whose tails pass each minimum. The samples are built in code, so the test source holds no literal token. Theghs_APPID_JWTsample is built once, intests/github_token_samples.py, which both test files import.sanitize_diff_outputmasks a wholeghs_APPID_JWTtoken (test_sanitize_diff_output_masks_a_whole_installation_token), andtest_sanitize_diff_output_secretsstill passes.uv run devops cipasses.changelog.d/1398.mdrecords the change under### Security, andCHANGELOG.mdanddocs/ROADMAP.mdare untouched.feat(release): v0.2.30 (#1473)