Skip to content

πŸ—οΈπŸ”§οΌšsee a description as a reader would - #1822

Merged
openinf-commit-queue[bot] merged 1 commit into
livefrom
fix/see-a-description-as-a-reader-does
Aug 15, 2026
Merged

πŸ—οΈπŸ”§οΌšsee a description as a reader would#1822
openinf-commit-queue[bot] merged 1 commit into
livefrom
fix/see-a-description-as-a-reader-does

Conversation

@DerekNonGeneric

Copy link
Copy Markdown
Member

The second CodeQL alert, js/incomplete-multi-character-sanitization β€” which was open and unnoticed while we were discussing whether alerts should block merging. It rather makes the case.

The bypass

input:   <!<!-- x -->-- sneaky -->
output:  <!-- sneaky -->

A single replacement removes the inner comment, and what surrounded it closes up into another one. The result is non-empty, so the check said the pull request had a description β€” while a reader would see nothing at all. Exactly the check's purpose, defeated.

My first attempt at a fix reproduced the same string, because building the output by concatenation re-forms the comment just as a replacement does. It now scans repeatedly until nothing changes, capped at eight passes so an awkward description cannot turn that into many. Each pass is linear and removes at least one comment.

Verified end to end: that body is now rejected.

This is a heuristic for whether anything was written, not a sanitizer, so the alert's severity overstates the risk here. The pattern is still not worth having in the codebase.

Verification

  • nps test β€” 16/16 tasks, 72/72 tests
  • Seven tests on visibleText, including the adversarial input, an unterminated comment, and the pull request template on its own β€” which must come out empty, since that is the case the check exists for
  • A linear-time test, since the last fix was about exactly that

CodeQL had a second alert open on my code that I had not seen: stripping
HTML comments with a single replacement leaves what surrounded one able
to form another. `<!<!-- x -->-- sneaky -->` came out as
`<!-- sneaky -->`, which a reader still cannot see -- so a pull request
with no description at all satisfied the check for having one.

Comments are now removed by scanning, repeatedly until nothing changes,
capped so that a description written to be awkward cannot turn that into
many passes. Each pass is linear and removes at least one comment.

This is a heuristic for whether anything was written, not a sanitizer,
but the pattern is worth not having in the codebase at all.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

βœ… Deploy Preview for gh-pages-openinf ready!

Name Link
πŸ”¨ Latest commit 5066e39
πŸ” Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a7ffd8c32aa9a00089458fe
😎 Deploy Preview https://deploy-preview-1822--gh-pages-openinf.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@DerekNonGeneric DerekNonGeneric added the commit-queue Land this pull request when its checks pass label Aug 15, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit 7c38451 into live Aug 15, 2026
15 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the commit-queue Land this pull request when its checks pass label Aug 15, 2026
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