Skip to content

fix(reports): keep HTML entities literal in report text - #1851

Merged
mldangelo-oai merged 10 commits into
openai:mainfrom
WenJing95:fix/report-html-entities
Oct 23, 2026
Merged

mldangelo-oai merged 10 commits into
openai:mainfrom
WenJing95:fix/report-html-entities

Conversation

@WenJing95

@WenJing95 WenJing95 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Markdown rendering can decode HTML entities in report metadata and filenames, changing encoded payloads and paths. Preserve their literal spelling while keeping ordinary query parameters, email addresses, and authored inline code intact. Keep the Python and native TypeScript threat-model projections byte-identical.

Changes

  • Escape ampersands that begin entity-shaped references in plain metadata; leave ordinary ampersands unchanged.
  • Preserve existing entity handling inside prose URL candidates, including HTTP/FTP/www, protocol-relative, and bare-domain links. Locate whole spans before inline-code handling so backticks do not split URL context.
  • Render entity-bearing literal path labels as inline code, with correct fences and padding for filenames containing backticks. Keep existing JSON quoting for ambiguous scope labels and existing formatting for ordinary paths.
  • Mirror the behavior in the native threat-model renderer. Add report and parity regressions for entities, query parameters, email addresses, Unicode domains, punctuation-adjacent links, and literal paths. The saved-byte fixture combines Unicode scope labels with entity-bearing paths and metadata.

Testing

  • Focused Python report, threat-model, and finalization modules: 284 passed, 2 skipped, 208 subtests passed.
  • MCP threat-model rendering and document tests: 68 passed; MCP typecheck and changed-file Prettier checks passed.
  • Required portable checks ran in order: Ruff lint; Ruff format (174 files); SDK build:ci; plugin source compatibility; compatibility tests (9 passed).
  • Built the production Node CLI. Synthetic MCP save → CLI threat-model export → Python description produced identical bytes and preserved canonical data, including Unicode and entity-bearing scope paths.
  • Synthetic finalization, sealed regeneration, and JSON export passed with canonical records unchanged.
  • Live GitHub Markdown, markdown-it, and remark comparisons preserved existing prose link destinations and text, including unknown entity-like query parameters. Ordinary entity prose remains literal. Ten live GitHub path-rendering cases preserved exact labels, including URL-like filenames, dotted directories, leading/trailing backticks, and existing JSON quoting.
  • git diff --check: passed.

Local packaged-worker validation was unavailable because source-matched native payloads were absent. No older payloads were reused; hosted package/native CI remains required.

Risk and rollout

This changes derived Markdown display without changing public CLI or canonical data. Entity-bearing path labels now use inline code. URL recognition in prose is conservative: ambiguous prose tokens that resemble URLs retain their existing entity interpretation, and renderers still differ in which links they recognize. The fix adds no parser dependency or TLD/Unicode validation table.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Oct 21, 2026

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for catching this report-fidelity issue. I reproduced the entity decoding and the query-link regression caused by escaping every ampersand, then completed the repair on this branch. Ordinary ampersands and existing prose links keep their behavior; entity-bearing paths render literally in code spans. The native threat-model renderer now matches Python, so MCP saves and CLI exports agree.

The revised change passed the focused Python and MCP suites, portable source checks, synthetic finalization/export and MCP-save smoke tests, and rendering comparisons against live GitHub Markdown, markdown-it, and remark. Independent review is complete. Required hosted CI is being checked separately before merge.

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The revised change preserves literal entity spellings and path labels while retaining existing prose link behavior. Python and native TypeScript projections agree. Focused tests, CLI/MCP smoke checks, independent review, and required hosted CI have passed on this revision. Approving the completed repair.

@mldangelo-oai
mldangelo-oai merged commit f521722 into openai:main Oct 23, 2026
53 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 24, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants