Skip to content

eval scrub: add minimum-length guard on ::add-mask:: values #186

Description

@waynesun09

Problem

In scrub-eval-results.sh, the mask value filter (Pass 1) rejects "", "***", and "[REDACTED]" but accepts any other value regardless of length. If an eval log contains ::add-mask::a (a single character), the letter a is added to the secrets set and str.replace("a", "***") is applied to every file — catastrophically corrupting all text output.

Similarly, common short strings like ::add-mask::true or ::add-mask::1 would cause widespread over-redaction.

GitHub Actions has the same foot-gun (it masks single-character values), but this script has the opportunity to be smarter since it runs after the fact on artifact files.

Suggested Fix

Add a minimum length threshold:

MIN_MASK_LEN = 4

for match in ADD_MASK_RE.finditer(text):
    value = match.group(1).strip()
    if value in ("***", "[REDACTED]", "") or len(value) < MIN_MASK_LEN:
        continue
    secrets.add(value)

A threshold of 4 avoids masking trivially short strings while catching all real secrets (GitHub tokens are 20+ characters, passwords typically 8+).

Context

Found during review of #184. The scrub script was introduced in that PR and all prior review findings were addressed, but this gap was not caught by the automated reviewers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions