Skip to content

fix(security): a credential keyword at the end of a line no longer masks the first word of the next line #2450

Closed

Description

@dan-petty

Problem Description

redact_text (src/devops_cli/security/sanitizer.py) masks a value that follows a credential keyword with the pattern \b(?:token|bearer|secret|password|api_key)\s+([A-Za-z0-9_\-.]{10,})\b. The separator \s+ also matches a line break. So when a line ends with one of the keywords, the first word of the next line becomes its value, and _looks_like_a_credential takes any word with a dot, an underscore or a digit as a credential and masks it.

A terminal transcript hits this when a command line ends with a config key whose name ends in the keyword, and the output line starts with that key. On 2026-10-28, devops roadmap intake --title ... --body-file ... --confirm refused a bug report with such a transcript: "The candidate's body holds what looks like a secret, so intake sent it to no model and filed nothing." The body held no secret. The same rule rewrites the text of logs, published descriptions and every other caller of redact_text.

Reproduction Steps

  1. Pass redact_text two lines: the first ends with the keyword (for example a devops config set command line for a key whose name ends in that keyword), and the second starts with a dotted word of 10 or more characters, followed by prose.
  2. The second line's first word becomes <masked-token>.

Expected vs Actual Behavior

Expected: a keyword and its value sit on one line, so a line break ends the match, and the two lines come back unchanged. A one-line pair such as the keyword, one space and an opaque 24-character value is still masked.

Actual: the first word of the second line is masked, and intake refuses the body.

Environment Diagnostics

devops-cli 0.8.3 at main 890e228.

Proposed Solution

Use [ \t]+ in place of \s+ between the keyword and its value, in the data and the code pattern sets. Add a test for the two-line case beside the existing one-line cases, which keep their results.

Existing Tool Considered

The fix is one character class in an existing pattern of Python's re. Nothing is built.

Activity

  1. added
    source/agent
    type/security
    status/new
    value/medium
    effort/low
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/security. A bug in the security sanitizer that over-masks non-credential text.
    • Priority: P2-Medium. It blocks legitimate bug reports and corrupts logs, but does not expose secrets.
    • Value: Medium. It unblocks intake and prevents corruption of logs and published text, but does not fix a leak.
    • Effort: Low. The fix is one character class change in an existing regex plus one test case.
    • Related: fix(security): secret sanitizer regex word boundary hardening and artifact name guard #116, which asks for a different change. Both fix regex patterns in the same sanitizer module, but #116 adds word boundaries to key patterns while this changes the keyword-to-value separator to exclude line breaks.
  3. added
    priority/p2-medium
    on Oct 28, 2026
  4. added 2 commits that reference this issue on Oct 28, 2026
    b754a73
    ece25ca
  5. removed
    status/new
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumsource/agenttype/securityvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions