Skip to content

[sec-check] fix: sanitize release HTML at fetch time — scripts/fetch-feeds.js (mapApiRelease, parseAtomEntry) - #1266

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
sec/fix-fetch-feeds-sanitize
Open

kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
sec/fix-fetch-feeds-sanitize

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Security Fix

Files/functions claimed: scripts/fetch-feeds.jsmapApiRelease, parseAtomEntry (plus new cleanHtml/safeLink helpers). Cluster: docs-site feed pipeline (static/feeds/*.jsonuseStoredFeedFeedItems.tsx).

Overlap check: no open PR touches fetch-feeds.js; documentation#1263 covers fetch-registry-data.js tests only; website#806 is the same pattern in the separate website repo.

What changes

mapApiRelease (GitHub Releases API, release.body = Markdown with inline HTML allowed) and parseAtomEntry (Atom entry.content = HTML) now sanitize content with sanitize-html using the allowlist already shared by fetch-firehose.js and src/utils/sanitizeHtml.ts, and entry/release link hrefs are restricted to http(s) schemes.

Why

src/components/FeedItems.tsx renders item.content with dangerouslySetInnerHTML. The SSR branch of sanitizeHtml() returns input raw, trusting fetch-time sanitization — fetch-feeds.js never sanitized, so release-note inline HTML from projectbluefin/bluefin / bluefin-lts releases was baked verbatim into the static docs site (stored XSS on docs.projectbluefin.io for anyone with release-write on those repos).

Verification

  • Malicious-input probe: <img src=x onerror=...> stripped, javascript: hrefs dropped in both content and link.
  • node --test scripts/fetch-feeds.test.js — 3/3 pass.

Fixes #1265


Filed by sec-check agent (ACMM L4/L5 — hold-gated mode). Hold-gated: human review required.

— hive: agent=sec-check backend=copilot model=kimi-k3

mapApiRelease and parseAtomEntry stored release body (Markdown with inline
HTML) and Atom content verbatim into static/feeds/*.json. FeedItems renders
item.content via dangerouslySetInnerHTML, and the SSR branch of
sanitizeHtml() returns input raw on the documented assumption that fetch
scripts already sanitized it — fetch-firehose.js does, fetch-feeds.js did
not. A release body containing inline HTML (e.g. <img onerror>) on
projectbluefin/bluefin or bluefin-lts would be baked raw into the static
docs site.

Mirror fetch-firehose.js: sanitize content with sanitize-html using the
shared allowlist synced with src/utils/sanitizeHtml.ts, and restrict entry
link hrefs to http(s) schemes.

Fixes #1265

Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Work is intentionally paused.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sec-check] fetch-feeds.js stores unsanitized release HTML/markdown — SSR emits it raw (stored XSS path)

0 participants