Skip to content

Fix double entity decoding in fetched page titles - #79

Merged
DennisAlund merged 1 commit into
mainfrom
claude/adoring-dirac-ciq6zi
Oct 19, 2026
Merged

DennisAlund merged 1 commit into
mainfrom
claude/adoring-dirac-ciq6zi

Conversation

@DennisAlund

Copy link
Copy Markdown
Member

Weekly defect review. One fix; dependency findings are in the comment below.

What was wrong: extractTitle (src/title-fetch.ts) decoded &amp; first, then &lt;/&gt;/&quot;. A title containing the literal text &amp;lt; became <. Code points above U+FFFF went through String.fromCharCode and produced broken surrogates.

Impact: Wrong auto-generated link titles (low severity; output is escaped on render).

Fix: Decode every entity in a single pass and use String.fromCodePoint. No API or contract change.

Tests: Two new cases in src/__tests__/unit/title-fetch.test.ts failed before the fix and pass after. Full yarn test: 1598 passed. No src/pages, src/admin or client paths touched, so e2e not required.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vuitu9gf4wHQCs8NPs5NXN


Generated by Claude Code

extractTitle decoded &amp; first and then &lt;/&gt;/&quot;, so a page title
containing the literal text "&amp;lt;" became "<". Code points above the
BMP went through String.fromCharCode and produced broken surrogates.
Decode every entity once and use fromCodePoint.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vuitu9gf4wHQCs8NPs5NXN

Copy link
Copy Markdown
Member Author

Dependency drift (flagged, not changed; needs a decision)

yarn audit reports 2 high advisories in runtime dependencies:

  • @modelcontextprotocol/sdk 1.30.0, patched in >=1.31.0 (latest 1.32.1).
  • @modelcontextprotocol/client 2.0.0, patched in >=2.2.0 (latest 2.3.1). @modelcontextprotocol/server is also at 2.0.0 (latest 2.3.1).

Both sit on the MCP surface, so I left them for a developer to upgrade and run the MCP tests against.

Transitive advisories in dev tooling only (via wrangler/miniflare/vitest): sharp (>=0.35.5), undici (>=7.29.1), source-map-js (>=1.2.2). They clear with a wrangler/vitest-pool bump.

Safe patch/minor candidates: hono 4.13.10 to 4.13.13, zod 4.6.5 to 4.6.7, @cloudflare/workers-oauth-provider 1.2.1 to 1.2.3, wrangler 4.143.0 to 4.151.1. Majors (vitest 5, typescript 7, agents 0.28) not recommended unprompted.

Reviewed with no defects found: src/redirect.ts, src/access.ts, and the SSRF guard in src/title-fetch.ts.


Generated by Claude Code

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
shrtnr 4622467 Oct 16 2026, 07:20 PM

@DennisAlund
DennisAlund merged commit cc24510 into main Oct 19, 2026
10 checks passed
@DennisAlund
DennisAlund deleted the claude/adoring-dirac-ciq6zi branch October 19, 2026 23:27
DennisAlund added a commit that referenced this pull request Oct 19, 2026
extractTitle only decoded the hex reference &#x27;, so titles such as
"Foo &#x2014; Bar" kept the raw entity. It also skipped &AMP;, &LT;,
&GT; and &QUOT;, which HTML defines alongside the lowercase forms.
Mixed-case names stay literal, matching HTML. Carries over the broader
decoder from the closed PR #76 on top of the merged fix in #79.
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.

2 participants