Skip to content

Harden public reporting and leak gates#11

Merged
t3chn merged 1 commit into
mainfrom
harden-public-reporting-and-leak-gates
May 25, 2026
Merged

Harden public reporting and leak gates#11
t3chn merged 1 commit into
mainfrom
harden-public-reporting-and-leak-gates

Conversation

@t3chn
Copy link
Copy Markdown
Contributor

@t3chn t3chn commented May 25, 2026

Summary:

  • adds lightweight redaction helpers for public-facing compare reports
  • redacts unsafe diagnostic strings in generated Markdown and CSV reports
  • strengthens public leak-check with git-tracked path denylist scanning and non-git fallback behavior

Issue:

  • None

Test plan:

  • make validate
  • make test
  • make smoke
  • make compare-smoke
  • make leak-check
  • python3 -m ruff check .
  • git diff --check

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dfbb7ae52b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +82 to +84
for term in DENIED_PATH_TERMS:
if term in normalized:
return f"denied path term {term}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Narrow denylist term matching to path components

The new path gate uses substring checks (if term in normalized) for generic terms like key and token, so benign filenames such as src/monkeypatch.py or docs/tokenization.md will be flagged as leaks even when file contents are safe. Because make leak-check runs this script over tracked files, this can block normal repo changes with false positives. Match on path components/word boundaries (or stricter patterns) instead of raw substring inclusion.

Useful? React with 👍 / 👎.

Comment on lines +54 to +55
safe_key = str(key) if is_public_safe_text(str(key)) else REDACTED_KEY
redacted[safe_key] = redact_obj(value)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve all mapping entries when redacting unsafe keys

In redact_obj, every unsafe mapping key is replaced with the same literal ([REDACTED_KEY]), so multiple unsafe keys in one object collide and later values overwrite earlier ones. This silently drops data (e.g., both api_key and token keys reduce to one entry), which can make redacted diagnostics incomplete or misleading. The redaction should avoid key-collision data loss.

Useful? React with 👍 / 👎.

)
except (FileNotFoundError, subprocess.CalledProcessError):
return None
return [item.decode("utf-8") for item in result.stdout.split(b"\0") if item]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle non-UTF8 tracked paths when reading git output

git ls-files -z emits raw path bytes, but this code decodes each entry with strict UTF-8 and does not catch UnicodeDecodeError. In repositories that contain tracked filenames not valid UTF-8 (allowed by Git), leak-check crashes before scanning any files, so the public gate becomes unavailable. Decode with surrogateescape (or similar) to keep scanning robust.

Useful? React with 👍 / 👎.

@t3chn t3chn merged commit d733fbd into main May 25, 2026
1 check passed
@t3chn t3chn deleted the harden-public-reporting-and-leak-gates branch May 25, 2026 05:44
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.

1 participant