Skip to content

fix(desktop): drop a mailto link's fragment with frostui's rule - #201

Merged
frostyard-machines merged 2 commits into
mainfrom
fix/mailto-fragment
Nov 11, 2026
Merged

frostyard-machines merged 2 commits into
mainfrom
fix/mailto-fragment

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Summary

Fixes #200.

The bug: system.WebURL kept a mailto link's fragment. So mailto:[email protected]?subject=x#&attach=/etc/passwd reached the mail client with #&attach=/etc/passwd still on it, and a client that parses the query without splitting off the fragment reads that as an attach field.

This PR:

  • Moves to frostui v0.4.0, which only changes the opener: SanitizeMailto, frostui's ADR-0010. packaging/flatpak/go-sources.json is regenerated (make flatpak-sources), and AGENTS.md updated.
  • Replaces the local filter: WebURL keeps the app's own scheme rule (http and https with a host, and mailto) and its messages, and passes a mailto link to frostui.SanitizeMailto. That keeps to, cc, bcc, subject and body in any ASCII case, and drops everything else: other fields, encoded names, fields without =, the fragment and a lone ?. Plan 0009 (Phase 7) asked for this once frostui had the rule.
  • Runs every link through the check in the window: App.openExternal now calls WebURL. Live preview, source mode, the reading view and page previews all follow web links through it, so a window test can see what each path opens. cmd/frostnotes then opens the result with frostui.Opener{}, which checks it again.
  • Docs: docs/design/app.md says the mailto rule is frostui's, and plan 0009's Phase 7 records the change.

Risk tier

Risk tier: 3. internal/desktop/system/open.go matches the L1 glob for the links and files the app opens. The change is safe:

  • The scheme and vault-file rules are unchanged.
  • A mailto link now keeps a subset of what it kept before: the same five fields, no fragment, and no fields without =.
  • The window applies the check before cfg.OpenURL, and frostui's Opener applies it again, so it now runs twice where it ran once.

go.mod, go.sum and packaging/flatpak/go-sources.json change only frostui's version.

Verification

  • make check green (host)
  • Race detector on ./internal/desktop/window/ and ./internal/desktop/system/; make desktop-build
  • make flatpak-sources run
  • Revert test, with command go test -count=1 -run 'TestWebURLs|TestAMailtoLinkOpensWithoutWhatItHides|TestAPagePreviewsLinkFollowsTheOpenRules' ./internal/desktop/system/ ./internal/desktop/window/:
    • main's open.go (812bc59): TestWebURLs fails on the four new cases. The two window tests open mailto:[email protected]?subject=x#&attach=/etc/passwd.
    • The fix's open.go with main's openExternal: the window tests receive the raw link, attach=/etc/shadow and the fragment included.
  • 1 .memory/corrections.jsonl line added

The tests:

  • TestWebURLs: every case it had, plus mailto filter keeps the fragment, so #&attach= gets through #200's link, a fragment alone, a field without =, and a lone ?.
  • TestAMailtoLinkOpensWithoutWhatItHides clicks a link with attach=/etc/shadow in its query and #&attach=/etc/passwd after it, first in live preview and then in the reading view. Both open mailto:[email protected]?subject=x.
  • TestAPagePreviewsLinkFollowsTheOpenRules now checks that same opened URL, rather than only that something opened.

system.WebURL kept a mailto link's fragment, so
mailto:[email protected]?subject=x#&attach=/etc/passwd reached the mail
client with the attach field after the "#", which a client that does not
split off the fragment reads as a field.

frostui v0.4.0 has the rule (SanitizeMailto, its ADR-0010), and WebURL
now calls it in place of its own filter: it keeps to, cc, bcc, subject
and body and drops the rest, the fragment included. The window checks
every link it opens with WebURL, so the editor's, the reading view's and
a page preview's links are tested on what they open; frostui's Opener
checks it again.

Fixes #200.
@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a path in .github/risk-paths.json labels Nov 11, 2026
@frostyard-machines
frostyard-machines merged commit 6458058 into main Nov 11, 2026
10 checks passed
@frostyard-machines
frostyard-machines deleted the fix/mailto-fragment branch November 11, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L1 Read every line risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mailto filter keeps the fragment, so #&attach= gets through

2 participants