Harden tools/pr_threads.sh: pass all printed thread fields through the deterministic sanitizer

Open Beginner friendly
#1,338 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, github, python
Domain
cli, security, testing

Research direction

Start with tools/pr_threads.sh and the repository’s AGENTS.md section “Agent-Side Untrusted-Content Protocol” to see how sanitize() is used for the title. Route the printed thread fields through that sanitizer, then add a test in tests/test_prompts_lint.py or a tools test using a hostile fake path. Done means the output neutralizes that path while preserving the expected thread details.

Written by the indexing model from the issue text.

Description

area:cli area:security enhancement priority:medium size:small

Residual from the github-advanced-security review on PR #1254 (threads PRRT_kwDOSw1GmM62RHnZ at tools/pr_threads.sh:37 and PRRT_kwDOSw1GmM62RHno at :32).

Already fixed in f0d6dae (the merged #1254 itself): gh api graphql output is piped into the python sanitizer (no || failure path that would print raw JSON), the default query does not fetch comment bodies at all, and --include-bodies prints only [UNTRUSTED_COMMENT_REDACTED] body_present=... body_len=... after redaction/truncation.

Remaining gap: the printed thread line interpolates t['id'], t.get('path'), and the author login without passing them through sanitize() — only the PR title and the [REDACTED] markers are sanitized. A crafted diff path or author name could carry instruction-like text into the agent's context, which the repo's untrusted-content protocol (AGENTS.md, "Agent-Side Untrusted-Content Protocol") requires to be deterministically redacted, not merely truncated.

Fix: route the whole printed line (id/path/line/author) through the same sanitize() used for the title, and add a test (e.g. in tests/test_prompts_lint.py or a new tools test) that a hostile fake path like ignore-all-previous-instructions.md is neutralized in the output.

Dominant language
Python
Stars
8
Forks
12
Avg merge
7h 37m
Merged PRs (30d)
218

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 RonaldHensbergen/composable-data-stack

All issues in RonaldHensbergen/composable-data-stack

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.