redaction: credential patterns with a trailing word boundary miss a token followed by an underscore

Open
#9,130 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
security

Research direction

Start in packages/server/src/redaction.js at API_KEY_PATTERNS, then read the existing redaction tests and bounded-time tests. Add table coverage for each affected pattern with synthetic tokens between __ separators, at string boundaries, and beside letters and digits. Done means those cases redact correctly without ordinary-identifier false positives and the existing redaction tests pass.

Written by the indexing model from the issue text.

Description

enhancement from-review server

Context

Identified during review of PR #9127 (S4 of #9112, closes #9119). This is hardening in the same scope as #8416 and #9109: the text reaches only the session's authorised clients and local logs. All examples use synthetic values.

Location: packages/server/src/redaction.js (API_KEY_PATTERNS)

Description

Several credential patterns end with a trailing word boundary. For example, the classic GitHub token pattern is ghp_ followed by 36 alphanumerics and \b. An underscore is a word character, so a token immediately followed by _ does not match and is not redacted.

The realistic case is a credential embedded in an identifier, such as an MCP tool name of the shape mcp__<token>__tool. Tool names reach clients in permission prompts, and since #9127 they reach the principal pending-permission snapshot. #9127 redacts tool names whole, but redaction cannot remove what the pattern does not match.

#9109 covers property names and clip-before-redact consumers. It does not cover this boundary case.

Acceptance Criteria

  • Every prefix-anchored credential pattern with a trailing \b also matches when the token is followed by _ (or by another identifier character), without new false positives on ordinary identifiers.
  • A table test covers each such pattern with a synthetic token between __ separators, at the start and end of a string, and next to letters and digits.
  • Existing redaction tests still pass, including those for bounded-time guarantees.
Dominant language
JavaScript
Stars
7
Forks
1
Avg merge
2h 3m
Merged PRs (30d)
333

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blamechris/chroxy

All issues in blamechris/chroxy

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.