Skip to content

Fix secret prefix preservation vulnerability (CWE-200)#15233

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-prefix-preservation-leakage
Feb 12, 2026
Merged

Fix secret prefix preservation vulnerability (CWE-200)#15233
pelikhan merged 2 commits intomainfrom
copilot/fix-prefix-preservation-leakage

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

Secret redaction was preserving the first 3 characters of tokens, leaking service identification (ghp_ → GitHub PAT, sk- → OpenAI, AKI → AWS) and exact lengths, reducing brute force attack space.

Changes

actions/setup/js/redact_secrets.cjs

  • Replace variable-length prefix-preserving redaction with fixed-length ***REDACTED*** string
  • Apply to both redactBuiltInPatterns (regex-based) and redactSecrets (exact-match) functions

actions/setup/js/redact_secrets.test.cjs

  • Update all test expectations to match new redaction format

Example

Before (vulnerable):

"Token: ghp_1234567890ABCDEFGHIJKLMNOPQRSTUVWxyz"
// Redacted to:
"Token: ghp*************************************"  // ⚠️ Type revealed

After (secure):

"Token: ghp_1234567890ABCDEFGHIJKLMNOPQRSTUVWxyz"
// Redacted to:
"Token: ***REDACTED***"  // ✅ No information disclosed

Security Impact

  • Token type identification: eliminated
  • Length disclosure: eliminated
  • Attack surface: no longer reduced by leaked metadata

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix prefix preservation leakage in secret redaction Fix secret prefix preservation vulnerability (CWE-200) Feb 12, 2026
Copilot AI requested a review from pelikhan February 12, 2026 20:15
@pelikhan pelikhan marked this pull request as ready for review February 12, 2026 20:16
Copilot AI review requested due to automatic review settings February 12, 2026 20:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a security vulnerability (CWE-200: Information Exposure) in the secret redaction system. Previously, redacted secrets preserved the first 3 characters of tokens, which leaked service identification (e.g., ghp_ for GitHub PATs, sk- for OpenAI keys) and exact token lengths, reducing the attack surface for brute force attempts. The fix replaces variable-length prefix-preserving redaction with a fixed-length ***REDACTED*** string.

Changes:

  • Updated secret redaction functions to use fixed-length ***REDACTED*** replacement string
  • Removed prefix preservation logic that exposed the first 3 characters of secrets
  • Updated all test expectations to match the new secure redaction format

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
actions/setup/js/redact_secrets.cjs Implemented fixed-length redaction in both redactBuiltInPatterns and redactSecrets functions, eliminating information disclosure
actions/setup/js/redact_secrets.test.cjs Updated all test expectations from prefix-preserving format (e.g., ghp*****...) to fixed-length ***REDACTED*** format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 7e38018 into main Feb 12, 2026
159 checks passed
@pelikhan pelikhan deleted the copilot/fix-prefix-preservation-leakage branch February 12, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants