Share links: "Copy link" on an existing key link copies a URL without its key #1140

Closed
opened 2026-11-06 23:55:36 +00:00 by Cordy · 2 comments
Owner

Found in the #1105 research (2026-11-07), at 78c814d7.

The key part after # of a key (fragment-mode) link is returned once when the link is made and never stored (internal/api/shares.go:662-671). Both Copy buttons on existing links copy the URL without it (web/static/index.html:23525, :26521), so the recipient sees "This link is missing its key." Copying a link again later is a normal action (Nextcloud, Google Drive and Seafile all allow it), and #1105's "edit a link and keep its URL" only helps if the owner can copy that URL again.

To research and decide: store the link key sealed to the owner (age, like other per-user secrets) or to the instance key file (v0.6.401), what an admin may see, what happens for links made before the change (Copy explains that the key was shown only once and offers a new link), and multi-instance (#742). Until then the Copy button on an existing key link should not produce a broken URL.

Found in the #1105 research (2026-11-07), at 78c814d7. The key part after `#` of a key (fragment-mode) link is returned once when the link is made and never stored (`internal/api/shares.go:662-671`). Both Copy buttons on existing links copy the URL without it (`web/static/index.html:23525`, `:26521`), so the recipient sees "This link is missing its key." Copying a link again later is a normal action (Nextcloud, Google Drive and Seafile all allow it), and #1105's "edit a link and keep its URL" only helps if the owner can copy that URL again. To research and decide: store the link key sealed to the owner (age, like other per-user secrets) or to the instance key file (v0.6.401), what an admin may see, what happens for links made before the change (Copy explains that the key was shown only once and offers a new link), and multi-instance (#742). Until then the Copy button on an existing key link should not produce a broken URL.
Author
Owner

Research and decisions (2026-11-07; scratch/b7e/backlog/research-1140.md). Built together with #1105.

  • Encryption on: each link's key is kept, sealed with age to the same keys that already open the shared file (owner or space key plus recovery), so nobody gains access to content. Encryption off: sealed with a new link-key entry in instance-keys.json (never used on encrypted instances, where a stolen disk would then open every link key).
  • Admin switch "Keep link keys so people can copy their links again", default on; off means the creation result says "copy it now".
  • POST /api/v1/shares/{token}/copy (creator, or the new owner after a hand-over; admins keep Revoke only) returns the full URL; audited as share-link-copy (optional tier, link's first 8 characters). The share list never carries keys; it gains keyKept.
  • Links made before the change: Copy opens "This link has no saved key" with Paste the full link (checked exactly against the stored key, then kept) or Make a new link with the same settings (old link keeps working).
  • Sealing fails at creation: the link is made anyway with "copy it now" and a log warning. Key kept inside the link record. Split crypto deployments and re-sealing after owner transfer after launch.
  • Note: the handbook never claimed zero-knowledge (sharing.md:1301); the stray "zero-knowledge" code comment in internal/share/fragment.go gets fixed in the same change.
**Research and decisions** (2026-11-07; `scratch/b7e/backlog/research-1140.md`). Built together with #1105. - Encryption on: each link's key is kept, sealed with age to the same keys that already open the shared file (owner or space key plus recovery), so nobody gains access to content. Encryption off: sealed with a new `link-key` entry in `instance-keys.json` (never used on encrypted instances, where a stolen disk would then open every link key). - Admin switch "Keep link keys so people can copy their links again", default on; off means the creation result says "copy it now". - `POST /api/v1/shares/{token}/copy` (creator, or the new owner after a hand-over; admins keep Revoke only) returns the full URL; audited as `share-link-copy` (optional tier, link's first 8 characters). The share list never carries keys; it gains `keyKept`. - Links made before the change: Copy opens "This link has no saved key" with Paste the full link (checked exactly against the stored key, then kept) or Make a new link with the same settings (old link keeps working). - Sealing fails at creation: the link is made anyway with "copy it now" and a log warning. Key kept inside the link record. Split crypto deployments and re-sealing after owner transfer after launch. - Note: the handbook never claimed zero-knowledge (`sharing.md:1301`); the stray "zero-knowledge" code comment in `internal/share/fragment.go` gets fixed in the same change.
Author
Owner

Shipped in v0.6.403 (PR #1142), live on both dogfoods.

  • Key links keep their key sealed (to the instance key file's link-key when encryption is off, to the encryption custody when it is on); split deployments keep nothing (reason remote).
  • Copy link again for the creator (POST /shares/{token}/copy, no-store). Without a saved key: the panel offers Paste the full link (checked against the link's recipient) or Make a new link from the old one's settings.
  • A lost or replaced key file answers "no saved key" (earlier); pasting the full link keeps it again.
  • The sealed key never appears in lists, the admin list, CSV, audit or logs (tested).

Live check (Safari and Firefox Copy, the http fallback) is on #1005.

Shipped in **v0.6.403** (PR #1142), live on both dogfoods. - Key links keep their key sealed (to the instance key file's `link-key` when encryption is off, to the encryption custody when it is on); split deployments keep nothing (reason `remote`). - Copy link again for the creator (`POST /shares/{token}/copy`, no-store). Without a saved key: the panel offers Paste the full link (checked against the link's recipient) or Make a new link from the old one's settings. - A lost or replaced key file answers "no saved key" (`earlier`); pasting the full link keeps it again. - The sealed key never appears in lists, the admin list, CSV, audit or logs (tested). Live check (Safari and Firefox Copy, the http fallback) is on #1005.
Cordy closed this issue 2026-11-07 19:30:18 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1140
No description provided.