Skip to content

fix(security): keep generated notes from making browser-managed requests#297

Merged
chhoumann merged 2 commits into
masterfrom
fix/note-render-hardening
Jul 11, 2026
Merged

fix(security): keep generated notes from making browser-managed requests#297
chhoumann merged 2 commits into
masterfrom
fix/note-render-hardening

Conversation

@chhoumann

Copy link
Copy Markdown
Owner

Feed-controlled show-notes HTML could embed active media elements (img, audio, video, source, iframe, object, embed, link) whose browser-managed requests fire when a generated note renders - reaching feed-selected local/private targets without ever passing PodNotes' network gate (#290 covers the plugin's own fetches; a rendered note fetches through Obsidian's renderer). Markdown image syntax in feed text formed the same live embeds after HTML→Markdown conversion.

Changes:

  • feedHtmlToMarkdown strips active media elements before htmlToMarkdown (image alt text is preserved as plain text) and neutralizes ![ Markdown embeds afterwards with balanced escaping.
  • The portable resource tags ({{artwork}}, {{episodeartwork}}, {{feedartwork}}, {{stream}}) emit only public http(s) URLs without embedded credentials, via the fix(security): consolidate all outbound requests behind one hardened gate #290 gate's isFetchableUrl plus an explicit userinfo rejection (the gate deliberately accepts userinfo for fetching; a note must never carry it). Anything else renders as "".

Deliberate UX change: show-note images render as their alt text instead of live embeds. A note render is an ambient fetch the reader never chose; links are preserved and still require a click.

Ported from the salvaged pre-#288 hardening pass (salvage/note-render-hardening @ 0bf89a4) onto the current gate API - the salvage's own network-layer changes were superseded by #290 and are not included.

Gates: 1,129 tests (5 new hardening cases incl. credential-bearing artwork), lint/format/typecheck/build green.

Feed-controlled show-notes HTML could embed active media elements (img,
audio, video, source, iframe, object, embed, link) whose requests fire
when a generated note renders - reaching feed-selected local/private
targets without ever passing PodNotes' network gate. Markdown image
syntax in feed text formed the same live embeds after conversion.

feedHtmlToMarkdown now strips active elements before htmlToMarkdown
(keeping image alt text), neutralizes Markdown embeds afterwards with
balanced escaping, and the portable resource tags ({{artwork}},
{{episodeartwork}}, {{feedartwork}}, {{stream}}) emit only public
http(s) URLs without embedded credentials - anything else renders as an
empty string.

Deliberate UX change: show-note images render as their alt text instead
of live embeds; a note render is an ambient fetch the reader never
chose, unlike clicking a link (links are preserved).

Ported from the salvaged pre-#288 hardening pass (salvage branch
0bf89a4) onto the current gate API.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 11, 2026

Copy link
Copy Markdown

Deploying podnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: a3aad19
Status: ✅  Deploy successful!
Preview URL: https://0ffe3160.podnotes.pages.dev
Branch Preview URL: https://fix-note-render-hardening.podnotes.pages.dev

View logs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 054d7c9ad6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/TemplateEngine.ts
Review follow-up: sanitizePortableResourceUrl blocks literal private and
credentialed targets but a public hostname that DNS-resolves to a private
address still passes - the same ceiling #290 documents, unfixable without
DNS resolution the render layer can't do. Document it rather than imply
complete protection.
@chhoumann chhoumann merged commit 6f0091d into master Jul 11, 2026
6 checks passed
@chhoumann chhoumann deleted the fix/note-render-hardening branch July 11, 2026 13:30
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