Fix secret prefix preservation vulnerability (CWE-200)#15233
Merged
Conversation
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
pelikhan
approved these changes
Feb 12, 2026
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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***REDACTED***stringredactBuiltInPatterns(regex-based) andredactSecrets(exact-match) functionsactions/setup/js/redact_secrets.test.cjsExample
Before (vulnerable):
After (secure):
Security Impact
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.