Skip to content

Make external relic links clickable - #95

Merged
jwaldrip merged 3 commits into
mainfrom
codex/relic-clickable-external-links
Sep 24, 2026
Merged

jwaldrip merged 3 commits into
mainfrom
codex/relic-clickable-external-links

Conversation

@jwaldrip

@jwaldrip jwaldrip commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

External anchors in HTML and JSX relics could not open because rendered content runs in a script-only sandbox.

Change

  • Mediate trusted reader clicks through the parent window.
  • Accept only canonical absolute HTTP, HTTPS, and mailto destinations.
  • Open a new tab without an opener or referrer.
  • Keep the existing CSP and sandbox="allow-scripts" boundary unchanged.
  • Reject scripted clicks, relative and fragment links, and executable, data, blob, or local-file schemes.
  • Install click capture before inline HTML scripts or React effects can run.

Proof

  • bun run verify: 1,459 tests passed, 0 failed; lint and all package typechecks passed.
  • Chrome rendered an HTML relic, kept a scripted click contained, and opened the trusted external link in a new tab.
  • The destination reported window.opener === null, an empty document.referrer, and no Referer request header.
  • The source relic remained rendered after the external tab opened.
  • A mutation that admitted javascript: made both the frame and parent regression checks fail. Restoring the allowlist returned 85 focused tests to green.

@jwaldrip
jwaldrip marked this pull request as ready for review September 24, 2026 15:18
@jwaldrip
jwaldrip merged commit c399f67 into main Sep 24, 2026
1 check passed
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