Skip to content

fix(devkit bench): the PR comment renders the summary's tables - #1145

Merged
zaneni6 merged 1 commit into
mainfrom
fix/bench-comment-markdown
Nov 25, 2026
Merged

zaneni6 merged 1 commit into
mainfrom
fix/bench-comment-markdown

Conversation

@zaneni6

@zaneni6 zaneni6 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Why

The "Dev-kit bench" PR comment wrapped summary.md in a ```text fence, so its tables showed as raw | pipes (see #1131). The fence was there for safety: the artifact is written by the pull request's code (a fork's too), and devkit-bench-comment.yml posts with a write token. Rendering it as Markdown therefore needs everything that could act to be taken out first.

What

The summary is rendered as Markdown inside <details>, after sanitize(). That function lives in the workflow's inline script, because the workflow still checks nothing out. It:

  • escapes backslashes first, then [ ], so no link or image survives. A backslash in the input cannot cancel an added one; that was a real bypass found in review.
  • escapes < > &, so no HTML: the text cannot close the <details>, forge or hide the marker, or add an element.
  • breaks every //, www. and github.com, every @ mention, and #12, GH-12 and …/issues|pull|discussions/12 references with a zero-width space. The result has no URL of any scheme, no mention and no cross-reference, path forms included; those were found in review too.
  • drops control and bidi characters, and cuts the text at a line boundary past 60000 characters.

Headings, tables, lists, inline code and emoji render as before.

Testing

  • BenchComment in test_devkit_bench.py extracts sanitize() from the workflow and tests it against the bypass inputs.
  • I ran the workflow's full inline script on feat: Inkling-2-Mini on the NPU (text, decode, image input) #1131's real summary and rendered the body with GitHub's Markdown API (gfm, repo context). Result: 4 tables, 1 link (our run link), 0 images.
  • I ran an adversarial set through the same path: \[x\](//host), [x](//host), ![i](…), http:host, <a>, entities, /issues/4, github.com/o/r/pull/1, @user, @org/team, a@b.com, #7, GH-8, </details>, the marker. Result: 0 links, images, mentions, issue links or </details>.
  • The CI unit suite passes (537 tests), as do actionlint, zizmor (no new findings), devkit_check (including its bench-comment rules) and check_internal_refs.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Security scan found no critical or high findings on lines changed by this pull request

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

The bench comment wrapped summary.md in a ```text fence, so its Markdown
tables showed as raw pipes. The fence was the safety measure: a pull
request's code writes that artifact, and the comment is posted with a write
token. The comment now renders it as Markdown, inside <details>, after
sanitize() takes out everything that acts:

- backslashes are escaped first, then [ ], so no link or image survives (a
  backslash in the input cannot cancel an added one);
- < > & are escaped: no HTML, so the text cannot close the <details>, hide
  or forge the marker, or add an element;
- every //, www. and github.com, @ mentions, and #12, GH-12 and
  .../issues|pull|discussions/12 references are broken with a zero-width
  space: no URL of any scheme, no mention, no cross-reference;
- control and bidi characters are dropped; the text is cut at a line past
  60000 characters.

sanitize() stays inline (the workflow checks nothing out).
test_devkit_bench.py BenchComment extracts and tests it. An adversarial
review found the backslash and path-reference bypasses, which are fixed and
tested. Rendered through GitHub's Markdown API, #1131's summary gives 4
tables and only the run link. Its bypass inputs give no link, image,
mention, issue link or </details>.

Co-Authored-By: Claude <noreply@anthropic.com>
@zaneni6
zaneni6 force-pushed the fix/bench-comment-markdown branch from d7d1fa2 to 28d5125 Compare November 25, 2026 17:43
@zaneni6
zaneni6 merged commit 955c5c9 into main Nov 25, 2026
25 checks passed
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