fix(security): keep generated notes from making browser-managed requests#297
Merged
Conversation
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.
Deploying podnotes with
|
| Latest commit: |
a3aad19
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0ffe3160.podnotes.pages.dev |
| Branch Preview URL: | https://fix-note-render-hardening.podnotes.pages.dev |
There was a problem hiding this comment.
💡 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".
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
feedHtmlToMarkdownstrips active media elements beforehtmlToMarkdown(image alt text is preserved as plain text) and neutralizes![Markdown embeds afterwards with balanced escaping.{{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'sisFetchableUrlplus 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.