Skip to content

Keep look-alike addresses out of pasted link titles #682

Open

Description

@HMarzban

Problem

Paste title writes a page's title into a document that others read. A title that looks like another site's address would hide where the link goes. Review rounds found four ways a title could get past the first check, which only compared a URL-shaped title with the link's host:

  1. A decoded file name. A link to evil.example/x/paypal.com%2Flogin.zip decodes to the file name paypal.com/login.zip, which reads as a paypal.com address.
  2. A too-wide file-name exemption. archive.zip and README.md read as domains, because .zip and .md are also top-level domains. An exemption for the link's own file name was needed, but in its first form it also let paypal.com.zip through.
  3. An email address. linkify types [email protected] as an email, not a URL, so the host check never ran.
  4. A full URL in a file name. https%3A%2F%2Fpaypal.com%2Fa.zip decodes to https://paypal.com/a.zip.

What was built

All in extensions/extension-hyperlink/src/paste-title/cleanTitle.ts:

  • A title that is one address on another host keeps the URL.
  • A link's own file name may pass when its extension is also a domain ending: FILE_EXTENSION_TLDS (.zip, .mov, .md, .py, .rs, .sh, .ai, .ps, .pl, .so). PLAIN_FILE_NAME_RE requires one word, one dot and the extension, with no /, \, ?, #, @ or :.
  • An email-address title counts as its domain. It keeps the URL unless that domain is the link's own host (ignoring www.).

The rules are documented in extensions/extension-hyperlink/docs/paste-title.md (item 4 of the cleaning list) and extensions/extension-hyperlink/AGENTS.md (the "Cleaner order" bullet).

Accepted, by maintainer ruling (2026-11-04)

  • evil.example/paypal.zip can read paypal.zip. It names the link's own file, not a known site, and the hovercard shows the real host.
  • A file name with two dots, such as v1.2.zip, keeps its URL.
  • A file link with no extension shows its last path part.

Do not widen the exemption to every own file name: a page at evil.example/paypal.com titled paypal.com would then pass.

Commits

  • 67fb338d1 fix(extension-hyperlink): keep a link's own file name as its title
  • 47e78fb5f fix(extension-hyperlink): refuse a file name that hides an address
  • d3cae0a7e fix(extension-hyperlink): refuse an email title on another domain

How to test

cd extensions/extension-hyperlink && bun test src/paste-title. The table tests in src/paste-title/__tests__/cleanTitle.test.ts cover every case above. Each rule was proved by sabotage: removing it makes its rows fail.

Done when

  • Each rule has table tests, proved by sabotage.
  • Pushed.
  • Released in the next @docs.plus/extension-hyperlink version. Follow .agents/skills/release-extensions/SKILL.md. The changes sit under [Unreleased] in extensions/extension-hyperlink/CHANGELOG.md, with the hovercard render option from RFC: Desktop hyperlink hovercard #242.

Part of #681.

Activity

  1. added this to the v2.3.0 milestone on Nov 4, 2026
  2. added
    Editor
    Security
    on Nov 4, 2026
  3. HMarzban commented on Nov 4, 2026

    @HMarzban
    CollaboratorAuthor

    Status, 2026-11-04. The earlier "not pushed yet" note is out of date. The work is on main in 4e1aca058, and deploy run 41854096960 shipped it.

    Left:

    • [maintainer] Publish @docs.plus/extension-hyperlink 2.3.0, following .agents/skills/release-extensions/SKILL.md.
  4. modified the milestones: v2.3.0, v2.4.0 on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EditorExtensionSecurity

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions