Public links that follow their file (stable link identity across moves and owner transfer) #835

Closed
opened 2026-10-03 15:55:11 +00:00 by Cordy · 6 comments
Owner

Parked convenience feature (Nikola, 2026-10-03). Needs very deep research before any design.

Today

  • A public link is bound to a path (share.Share.Path). If the file moves, the link no longer resolves.
  • A departed owner's links therefore stay frozen until an admin revokes them.
  • The owner transfer (#597, internal/api/owners.go) re-points person and group grants to the new location. Links come back as linksBroken. The audit log shows the transfer, e.g. sharer2 to sharer1.
  • That was the accepted trade-off when the transfer was built: links had a technical problem to transfer, so they stay frozen until revoked manually.

Idea

Give each shared item a stable identity, a UUID or file id, that the public link points at instead of the path. Moving the file, or transferring it to another owner, then keeps the external link working:

  • the link token resolves the item id;
  • the item id resolves the current location.

Research checklist (deep, before designing)

  • How others bind links.
    • Google Drive, OneDrive/SharePoint, Box and Dropbox appear to bind links to an item or file id, so links survive moves.
    • Nextcloud and ownCloud bind shares to a fileid in the file cache, so moves inside the same storage keep the share.
    • Behaviour on cross-storage moves, copies, restore-from-trash and version restore is to verify.
  • What happens on owner change or account deletion at each competitor. Do links survive, get frozen, or get deleted? Are they re-signed?
  • Security concerns.
    • Should a link keep working after the file moves into a more restricted place, such as a Space with links off (#722), a legal hold, or another person's home? Re-evaluate policy at resolve time, not at creation.
    • Information leakage when an id outlives the path.
    • Id guessing or enumeration.
    • Encryption re-scoping: the file is re-encrypted to the destination scope on a move, so the link's fragment key (#19/#274) and its ciphertext delivery must stay valid or be re-issued.
    • Audit trail continuity.
  • Cairn-specific challenges.
    • Cairn has no file-id index today. Storage is posix/S3 with an encryption layer, and paths are the identity.
    • Options to compare:
      • an id sidecar or xattr;
      • an id registry in state (statestore);
      • rewriting the link record on every move at the move chokepoint, the way grants are re-pointed today. This is the cheapest option and may be enough.
    • Cost on S3 (no rename), WebDAV moves, and external edits that bypass Cairn.
  • Interaction with the #833 admin Shares list (Outside policy, Frozen badges), peering, OCM, and the departed-owner flow.

A grant from a departed owner is frozen at the serve chokepoint today, but the admin Shares list only shows the "Frozen" badge on links. Badging frozen grants there is a separate small fix. Track it with the #833 follow-ups, not here.

Parked convenience feature (Nikola, 2026-10-03). Needs very deep research before any design. ## Today - A public link is bound to a **path** (`share.Share.Path`). If the file moves, the link no longer resolves. - A **departed owner's** links therefore stay **frozen** until an admin revokes them. - The owner transfer (#597, `internal/api/owners.go`) re-points person and group **grants** to the new location. Links come back as `linksBroken`. The audit log shows the transfer, e.g. sharer2 to sharer1. - That was the accepted trade-off when the transfer was built: links had a technical problem to transfer, so they stay frozen until revoked manually. ## Idea Give each shared item a stable identity, a UUID or file id, that the public link points at instead of the path. Moving the file, or transferring it to another owner, then keeps the external link working: - the link token resolves the item id; - the item id resolves the current location. ## Research checklist (deep, before designing) - **How others bind links.** - Google Drive, OneDrive/SharePoint, Box and Dropbox appear to bind links to an item or file id, so links survive moves. - Nextcloud and ownCloud bind shares to a `fileid` in the file cache, so moves inside the same storage keep the share. - Behaviour on cross-storage moves, copies, restore-from-trash and version restore is to verify. - **What happens on owner change or account deletion at each competitor.** Do links survive, get frozen, or get deleted? Are they re-signed? - **Security concerns.** - Should a link keep working after the file moves into a more restricted place, such as a Space with links off (#722), a legal hold, or another person's home? Re-evaluate policy at resolve time, not at creation. - Information leakage when an id outlives the path. - Id guessing or enumeration. - Encryption re-scoping: the file is re-encrypted to the destination scope on a move, so the link's fragment key (#19/#274) and its ciphertext delivery must stay valid or be re-issued. - Audit trail continuity. - **Cairn-specific challenges.** - Cairn has no file-id index today. Storage is posix/S3 with an encryption layer, and paths are the identity. - Options to compare: - an id sidecar or xattr; - an id registry in state (statestore); - rewriting the link record on every move at the move chokepoint, the way grants are re-pointed today. This is the cheapest option and may be enough. - Cost on S3 (no rename), WebDAV moves, and external edits that bypass Cairn. - **Interaction with the #833 admin Shares list** (Outside policy, Frozen badges), peering, OCM, and the departed-owner flow. ## Related small gap (#833 admin Shares list) A **grant** from a departed owner is frozen at the serve chokepoint today, but the admin Shares list only shows the "Frozen" badge on links. Badging frozen grants there is a separate small fix. Track it with the #833 follow-ups, not here.
Author
Owner

Update on the "Related small gap" section: done. PR #837 (v0.6.317, live on both dogfoods) makes the admin Shares list badge person and group shares of a departed owner as Frozen, owner departed, as it already did for links, and the CSV/PDF status follows. Server behaviour was already correct: those grants stopped serving at the /shared adapter (#597). What remains in this issue is only the parked "links follow their file" research.

Update on the "Related small gap" section: **done**. PR #837 (v0.6.317, live on both dogfoods) makes the admin Shares list badge person and group shares of a departed owner as **Frozen, owner departed**, as it already did for links, and the CSV/PDF status follows. Server behaviour was already correct: those grants stopped serving at the /shared adapter (#597). What remains in this issue is only the parked "links follow their file" research.
Author
Owner

Related decision from #857 (Nikola, 2026-10-08): when the creator of a public link is disabled (the account still exists), only links into their Personal folder pause. Links into Spaces keep serving and get a "creator disabled" flag in the admin Shares list for review. Internal shares keep working.

What this does not decide: for deleted (departed) creators, all links still freeze today, Spaces included. Whether Space links should survive the creator's departure (and belong to the Space, as asked in Nextcloud server#57444 and groupfolders#4248) belongs here and in #654. Research on #857: #857

**Related decision from #857 (Nikola, 2026-10-08):** when the creator of a public link is **disabled** (the account still exists), only links into their **Personal folder** pause. Links into **Spaces** keep serving and get a "creator disabled" flag in the admin Shares list for review. Internal shares keep working. What this does **not** decide: for **deleted (departed)** creators, all links still freeze today, Spaces included. Whether Space links should survive the creator's departure (and belong to the Space, as asked in Nextcloud server#57444 and groupfolders#4248) belongs here and in #654. Research on #857: http://192.168.10.245/Cordy/Cairn/issues/857
Author
Owner

Research (2026-10-30). The full write-up with sources and VERIFIED, INFERRED and UNVERIFIED markers is in scratch/b7e/backlog/research-835.md.

Already done for Spaces

  • Since v0.6.367 (#1034) and v0.6.370 (#1035), Space links follow moves inside the space on every surface. They pause in Deleted files, resume on restore, and end on delete forever. A move out of the space asks "Move and end" in the web app and is refused on WebDAV.
  • Space links belong to the space, so they survive their creator departing, being disabled or having their home transferred. That answers the open question in comment 2 and in #654.

What is left: Personal links and person/group shares

  • They are still tied to the path. A rename or move inside the home breaks them silently, a full owner transfer breaks links (linksBroken), and a shares-only transfer leaves them frozen. Nothing pauses or ends them when the file is deleted.
  • Likely security gap (from reading the code; a failing test comes first): nothing cleans them up on rename or delete, so a new file at the old path gets served. Example: rename Offer.pdf, then upload another client's Offer.pdf, and the first client's link serves it. This is the same flaw as filebrowser CVE-2026-82237.

Market

  • Nextcloud and ownCloud 10 keep public links working through an owner transfer; ownCloud treated breaking them as a bug.
  • No product keeps an item's identity across a storage boundary: oCIS refuses the move, Nextcloud team folders lose shares, and SharePoint moves are copy plus delete.
  • Pitfalls:
    • Nextcloud #58371: a transfer widened a link to the new owner's whole home.
    • Google 2021: never put a file id in a public URL.

Recommended design

  • Do for Personal links and shares what #1035 did for Spaces: they follow moves inside the home.
  • A move out of the home ends them, with a confirm in the web app and a refusal everywhere else.
  • Personal Deleted files pause, resume and end them.
  • An owner transfer moves them with the files but arrives paused, unless the admin ticks "keep them working".
  • A small file id in the existing per-folder metadata, stored on each link and checked when serving: a different file at the path gives 404. No global id index.
  • 7 mockup frames.

Open questions, with my recommendations

  1. Personal links follow renames and moves inside the home: yes.
  2. Person and group shares too, in the same change: yes.
  3. Moving out of the home ends them (converting them to Space links would bypass the space's owner-only rule): end them.
  4. Owner transfer: they arrive paused, with an admin checkbox to keep them working.
  5. A shares-only transfer includes linked items: yes.
  6. Personal Deleted files pause, resume and end them: yes.
  7. The file-id check for Personal and Space links, starting with the failing test: yes.
  8. Space links of departed creators: already survive, so close that question.
  9. A re-created account with the same username unfreezing old links: a separate issue using the #981 account start.
  10. A full file-id index now: no.
  11. Audit each link that follows a move: no; audit only pauses, ends and refused serves.
  12. Side issue: tags are lost on WebDAV moves, and favorites do not follow renames: one small separate issue.
**Research (2026-10-30).** The full write-up with sources and VERIFIED, INFERRED and UNVERIFIED markers is in `scratch/b7e/backlog/research-835.md`. **Already done for Spaces** - Since v0.6.367 (#1034) and v0.6.370 (#1035), Space links follow moves inside the space on every surface. They pause in Deleted files, resume on restore, and end on delete forever. A move out of the space asks "Move and end" in the web app and is refused on WebDAV. - Space links belong to the space, so they survive their creator departing, being disabled or having their home transferred. That answers the open question in comment 2 and in #654. **What is left: Personal links and person/group shares** - They are still tied to the path. A rename or move inside the home breaks them silently, a full owner transfer breaks links (`linksBroken`), and a shares-only transfer leaves them frozen. Nothing pauses or ends them when the file is deleted. - **Likely security gap (from reading the code; a failing test comes first):** nothing cleans them up on rename or delete, so a new file at the old path gets served. Example: rename `Offer.pdf`, then upload another client's `Offer.pdf`, and the first client's link serves it. This is the same flaw as filebrowser CVE-2026-82237. **Market** - Nextcloud and ownCloud 10 keep public links working through an owner transfer; ownCloud treated breaking them as a bug. - No product keeps an item's identity across a storage boundary: oCIS refuses the move, Nextcloud team folders lose shares, and SharePoint moves are copy plus delete. - Pitfalls: - Nextcloud #58371: a transfer widened a link to the new owner's whole home. - Google 2021: never put a file id in a public URL. **Recommended design** - Do for Personal links and shares what #1035 did for Spaces: they follow moves inside the home. - A move out of the home ends them, with a confirm in the web app and a refusal everywhere else. - Personal Deleted files pause, resume and end them. - An owner transfer moves them with the files but arrives paused, unless the admin ticks "keep them working". - A small file id in the existing per-folder metadata, stored on each link and checked when serving: a different file at the path gives 404. No global id index. - 7 mockup frames. **Open questions, with my recommendations** 1. Personal links follow renames and moves inside the home: yes. 2. Person and group shares too, in the same change: yes. 3. Moving out of the home ends them (converting them to Space links would bypass the space's owner-only rule): end them. 4. Owner transfer: they arrive paused, with an admin checkbox to keep them working. 5. A shares-only transfer includes linked items: yes. 6. Personal Deleted files pause, resume and end them: yes. 7. The file-id check for Personal and Space links, starting with the failing test: yes. 8. Space links of departed creators: already survive, so close that question. 9. A re-created account with the same username unfreezing old links: a separate issue using the #981 account start. 10. A full file-id index now: no. 11. Audit each link that follows a move: no; audit only pauses, ends and refused serves. 12. Side issue: tags are lost on WebDAV moves, and favorites do not follow renames: one small separate issue.
Author
Owner

Decision (Nikola, 2026-10-30): all 12 recommendations from the research comment are approved. The suspected path-reuse gap gets a failing test first. Next step: a whole-page mockup.

**Decision (Nikola, 2026-10-30):** all 12 recommendations from the research comment are approved. The suspected path-reuse gap gets a failing test first. Next step: a whole-page mockup.
Author
Owner

Mockup approved (Nikola, 2026-10-30): 835-links-follow-mockup.html, with all its strings and open-point recommendations.

  • Item ids are stamped on existing links and shares at upgrade.
  • Restore asks first, but only when the entry has shares or links.
  • The owner gets one bell when a link hits a replaced item.
  • Admins cannot turn on handed-over links.
  • New refusal code personal-share-move-out.

#1045 (purge verbs admin tier) ships in the same release.

**Mockup approved (Nikola, 2026-10-30):** `835-links-follow-mockup.html`, with all its strings and open-point recommendations. - Item ids are stamped on existing links and shares at upgrade. - Restore asks first, but only when the entry has shares or links. - The owner gets one bell when a link hits a replaced item. - Admins cannot turn on handed-over links. - New refusal code `personal-share-move-out`. #1045 (purge verbs admin tier) ships in the same release.
Cordy closed this issue 2026-10-31 07:10:31 +00:00
Author
Owner

Shipped in v0.6.376 (PR #1052), live on both dogfoods.

  • Personal links and shares follow renames and moves inside Personal on every surface (REST, WebDAV, TUS, editor), pause while their item is in Deleted files, resume on restore, end on purge or on a confirmed move out (409 personal-share-move-out lists what ends).
  • Every link and share carries the item id of its file or folder; a different item that later takes the path is refused (404, shown as Item replaced with a bell). Existing records are stamped once at the first start.
  • Owner transfer carries links: paused for the new owner (Turn on) or kept working; estate counts; share-links-handed bell.
  • Shares view and admin Shares show the states; exports carry them (?status=, CSV handedFrom).
  • Docs: CHANGELOG v0.6.376, sharing.md, file-browser.md, users-access.md, admin-policy.md, deployment.md, ARCHITECTURE.md.

Live check: both pods on v0.6.376, ready, no restarts. enc dogfood: stamp done (records=0). OpenBao dogfood: stamp unfinished as documented for per-user key custody (failed=4 records=5 missing=1), tracked in #1058.

Follow-ups filed: #1054 (re-created account, same username), #1055 (tags and favourites following moves), #1056 (global item id index), #1057 (OCM shares), #1058 (per-user custody stamp), #1059 (change feed vs item guard).

Shipped in **v0.6.376** (PR #1052), live on both dogfoods. - Personal links and shares follow renames and moves inside Personal on every surface (REST, WebDAV, TUS, editor), pause while their item is in Deleted files, resume on restore, end on purge or on a confirmed move out (409 `personal-share-move-out` lists what ends). - Every link and share carries the item id of its file or folder; a different item that later takes the path is refused (404, shown as **Item replaced** with a bell). Existing records are stamped once at the first start. - Owner transfer carries links: paused for the new owner (Turn on) or kept working; estate counts; `share-links-handed` bell. - Shares view and admin Shares show the states; exports carry them (`?status=`, CSV `handedFrom`). - Docs: CHANGELOG v0.6.376, sharing.md, file-browser.md, users-access.md, admin-policy.md, deployment.md, ARCHITECTURE.md. Live check: both pods on v0.6.376, ready, no restarts. enc dogfood: stamp done (`records=0`). OpenBao dogfood: stamp unfinished as documented for per-user key custody (`failed=4 records=5 missing=1`), tracked in #1058. Follow-ups filed: #1054 (re-created account, same username), #1055 (tags and favourites following moves), #1056 (global item id index), #1057 (OCM shares), #1058 (per-user custody stamp), #1059 (change feed vs item guard).
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#835
No description provided.