Connected devices limited to one folder and/or read only (+ duplicate device names) #897

Closed
opened 2026-10-13 22:31:28 +00:00 by Cordy · 9 comments
Owner

Follow-up to #895 (decision by Nikola, 2026-10-14). Nikola: "a beautiful, elegant and easy feature to really distinguish ourselves from the competition."

What

When connecting a device (#895 "Connect a device"), the person can limit what that device can reach:

  • Access: All my files / Only this folder [pick a folder]. The device sees that folder as the root of its WebDAV drive.
  • Permission: Can change files / Read only.

The connected-devices list (#895 Frame A) shows the limit on each row, for example "Only /Backups · read only".

Every WebDAV client works unchanged (Finder, Explorer, rclone, Cyberduck, KeePass apps), because the limit is enforced on the server.

Also in scope: duplicate device names (Nikola, 2026-10-14, decision "1 + 3", research in comment 9083):

  • a pre-filled default that is already taken becomes "{name} 2", "{name} 3", and so on;
  • a typed name that is already used gets a non-blocking amber hint with a "Use "{name} 2"" link, in the connect dialog and the Rename prompt;
  • the approval flow numbers its server-side name by the same rule;
  • no uniqueness rule in the API.

Why (research, #895 comment 9002)

  • Long-standing demand. Nextcloud server #2866, "Allow to restrict app password data access", has been open since 2017 (NC 10). Related: #6030, #6376, #17339, #35262, and the forum threads "App-Specific Passwords: Folder/File Permissions" and "Limiting access of external apps to a folder". Representative comments: "desperately needed", "It is a pity such a great feature is not given proper priority", and "scope an app password to a folder which basically becomes the new root folder".
  • The most-wanted form is folder-limited:
    • password managers (KeePass, Keepassium, Keepass2Android) that should see one database file only;
    • backup tools that should write into one folder only;
    • website and automatic backups;
    • research and HPC projects.
  • Today's workarounds fail. Public share links over public.php/webdav trip the brute-force protection ("using Basic Auth with different apps triggers the bruteforce protection very quickly"). One extra user per app is "not possible in large corporate installations".
  • Nobody ships it. Nextcloud only has a single "filesystem access" toggle (PR #719). oCIS, OpenCloud, Seafile and Synology have nothing comparable. Fastmail and SOGo/mailcow scope only by protocol.

Notes for the spec

  • Enforce it in the storage scope layer (the same place shares and spaces are scoped), not in WebDAV only. That way every path (WebDAV, TUS, the API if ever reachable with the credential) respects it.
  • Read only means no write, delete, move, lock or upload. Check how locks (#865) and WOPI behave.
  • Open questions:
    • What happens when the folder is moved or renamed: follow it by ID, or by path?
    • What happens when the folder is deleted: the device sees an empty root and gets a bell item?
    • Space folders as the root: yes, within the person's own rights.
  • Audit: app-password-created notes the scope.
  • Docs:
    • account.md: the "Connected devices" section;
    • users-access.md;
    • security-standards.md (least privilege, AC-6, ISO 27002 5.15/8.3).

Mockup

Expand the #895 mockup (~/Downloads/design-direction-decision-needed/895-app-passwords-mockup.html) as a follow-up before building:

  • Frame B gets the Access and Permission step, plus the numbered default name and the duplicate-name hint.
  • Frame A gets the per-row label and the Rename prompt with the hint.
  • Frame C says "This device sees only /Backups, read only".

Depends on #895 (Connected devices) being merged.

Follow-up to #895 (decision by Nikola, 2026-10-14). Nikola: "a beautiful, elegant and easy feature to really distinguish ourselves from the competition." ## What When connecting a device (#895 "Connect a device"), the person can limit what that device can reach: - **Access:** All my files / **Only this folder** [pick a folder]. The device sees that folder as the root of its WebDAV drive. - **Permission:** Can change files / **Read only**. The connected-devices list (#895 Frame A) shows the limit on each row, for example "Only /Backups · read only". Every WebDAV client works unchanged (Finder, Explorer, rclone, Cyberduck, KeePass apps), because the limit is enforced on the server. **Also in scope: duplicate device names** (Nikola, 2026-10-14, decision "1 + 3", research in comment 9083): - a pre-filled default that is already taken becomes "{name} 2", "{name} 3", and so on; - a typed name that is already used gets a non-blocking amber hint with a "Use "{name} 2"" link, in the connect dialog and the Rename prompt; - the approval flow numbers its server-side name by the same rule; - no uniqueness rule in the API. ## Why (research, #895 comment 9002) - **Long-standing demand.** Nextcloud server #2866, "Allow to restrict app password data access", has been open since 2017 (NC 10). Related: #6030, #6376, #17339, #35262, and the forum threads "App-Specific Passwords: Folder/File Permissions" and "Limiting access of external apps to a folder". Representative comments: "desperately needed", "It is a pity such a great feature is not given proper priority", and "scope an app password to a folder which basically becomes the new root folder". - **The most-wanted form is folder-limited:** - password managers (KeePass, Keepassium, Keepass2Android) that should see one database file only; - backup tools that should write into one folder only; - website and automatic backups; - research and HPC projects. - **Today's workarounds fail.** Public share links over `public.php/webdav` trip the brute-force protection ("using Basic Auth with different apps triggers the bruteforce protection very quickly"). One extra user per app is "not possible in large corporate installations". - **Nobody ships it.** Nextcloud only has a single "filesystem access" toggle (PR #719). oCIS, OpenCloud, Seafile and Synology have nothing comparable. Fastmail and SOGo/mailcow scope only by protocol. ## Notes for the spec - Enforce it in the storage scope layer (the same place shares and spaces are scoped), not in WebDAV only. That way every path (WebDAV, TUS, the API if ever reachable with the credential) respects it. - Read only means no write, delete, move, lock or upload. Check how locks (#865) and WOPI behave. - **Open questions:** - What happens when the folder is moved or renamed: follow it by ID, or by path? - What happens when the folder is deleted: the device sees an empty root and gets a bell item? - Space folders as the root: yes, within the person's own rights. - Audit: `app-password-created` notes the scope. - Docs: - account.md: the "Connected devices" section; - users-access.md; - security-standards.md (least privilege, AC-6, ISO 27002 5.15/8.3). ## Mockup **Expand the #895 mockup** (`~/Downloads/design-direction-decision-needed/895-app-passwords-mockup.html`) as a follow-up before building: - **Frame B** gets the Access and Permission step, plus the numbered default name and the duplicate-name hint. - **Frame A** gets the per-row label and the Rename prompt with the hint. - **Frame C** says "This device sees only /Backups, read only". Depends on #895 (Connected devices) being merged.
Author
Owner

Folded in: duplicate device names (research + decision)

Trigger: the v0.6.340 live check produced two devices both called "rclone". The default name for the rclone tile is "rclone", and Cairn neither numbers nor warns. The approval flow has the same issue: two iPhones both become "Cairn for iPhone (iPhone)".

Decision (Nikola, 2026-10-14): 1 + 3 together. (1) Number the pre-filled default when that name is taken. (3) Warn, without blocking, when a typed name is already used. Part of this issue's scope.

Market

Product Unique names? On a duplicate
Nextcloud No Accepted silently ("just a label"). Guides warn that every entry is called "Nextcloud Client", "and with 5 devices you won't know which one to revoke".
Cloudron No 2026-02 forum bug "No warning for duplicate app password": the user expected a warning. Staff: "just a label", tell them apart by date.
WordPress Was unique, then removed WP 5.6 refused duplicates with 409. Changeset 59084 (2024) removed the rule: apps "may not know if they've been authorized before, or they may intentionally allow connecting multiple times", and developers ended up appending date and time to names.
GitHub tokens Reportedly yes (not confirmed in their docs) Hard error; tokens are typed by hand and no device flow names them.
Apple Bonjour / Finder Auto-number "MacBook (2)", "IMG_0321 2.JPG". A familiar pattern, but users are confused when it changes a name they chose.

Takeaways

  1. Never block. WordPress tried and reverted it because app-driven flows broke. Cairn has the same kind of flow (Frame D approval).
  2. Silence is the norm, and users report it as a bug. A visible, non-blocking hint is the gap nobody fills.
  3. Number only the pre-filled default, never what the person typed.

Users, operators, standards

  • Users: the list exists to disconnect one device without touching the others. Two identical rows make it easy to disconnect the wrong one.
  • Operators: audit lines name devices. The device id keeps them unambiguous, but readable names help incident handling.
  • Standards: no ISO, BSI or legal rule asks for unique labels. ISO 27002 5.16/5.17 and NIST SP 800-63B ask that authenticators can be revoked individually, which Cairn already does by id.
  • WCAG 2.2:
    • 3.3.1 and 3.3.3: the hint must be text, name the conflict and suggest the fix.
    • 4.1.3: announce it through role="status".
    • No aria-invalid, and Continue stays enabled.
  • Design systems: SAP Fiori, Anvil and a GitLab discussion on duplicate rule names agree: a warning is the non-blocking tier, and a duplicate is "odd but not incorrect".

Behaviour for the spec

  • (1) Numbered default: while the Name field still holds the untouched tile default, pre-fill the lowest free "{name} 2", "{name} 3"… (Finder style). Switching tiles re-computes it. A typed name is never changed.
  • (3) Warning:
    • A muted amber hint under Name, live and debounced: "You already have a device called "rclone". Two devices with the same name are hard to tell apart." It has a "Use "rclone 2"" link that fills the field.
    • Continue stays enabled.
    • The same hint appears in the Rename prompt.
  • Approval flow, call: the server numbers approvalDeviceName by the same rule (no person is there to warn).
  • Comparison: trimmed, case-insensitive, Unicode NFC. The device being renamed does not count against itself.
  • Not: no uniqueness rule and no 409 in the API (the WordPress lesson).
  • Tests:
    • Pure helpers devUniqueName(base, existing) and devNameTaken(name, existing, selfId): case folding, trimming, gaps ("base", "base 3" gives "base 2"), and a typed name is never rewritten.
    • Go tests for the numbering of approvalDeviceName.

The mockup expansion (next) adds this to Frame B and the Rename prompt.

Sources: Cloudron forum 15043 · WordPress changeset 59084 · Nextcloud app-password guide · xaweho Nextcloud app passwords · Apple Bonjour FAQ · GitLab #251124 · SAP Fiori inline validation · Anvil errors and warnings · CMS design system validation · GitHub token docs

Full file: cairn-work/scratch/b7e/897-duplicate-names-research.md.

## Folded in: duplicate device names (research + decision) Trigger: the v0.6.340 live check produced two devices both called "rclone". The default name for the rclone tile is "rclone", and Cairn neither numbers nor warns. The approval flow has the same issue: two iPhones both become "Cairn for iPhone (iPhone)". **Decision (Nikola, 2026-10-14): 1 + 3 together.** (1) Number the pre-filled default when that name is taken. (3) Warn, without blocking, when a typed name is already used. Part of this issue's scope. ### Market | Product | Unique names? | On a duplicate | |---|---|---| | Nextcloud | No | Accepted silently ("just a label"). Guides warn that every entry is called "Nextcloud Client", "and with 5 devices you won't know which one to revoke". | | Cloudron | No | 2026-02 forum bug "No warning for duplicate app password": the user expected a warning. Staff: "just a label", tell them apart by date. | | WordPress | **Was unique, then removed** | WP 5.6 refused duplicates with 409. Changeset 59084 (2024) removed the rule: apps "may not know if they've been authorized before, or they may intentionally allow connecting multiple times", and developers ended up appending date and time to names. | | GitHub tokens | Reportedly yes (not confirmed in their docs) | Hard error; tokens are typed by hand and no device flow names them. | | Apple Bonjour / Finder | Auto-number | "MacBook (2)", "IMG_0321 2.JPG". A familiar pattern, but users are confused when it changes a name they chose. | **Takeaways** 1. **Never block.** WordPress tried and reverted it because app-driven flows broke. Cairn has the same kind of flow (Frame D approval). 2. **Silence is the norm, and users report it as a bug.** A visible, non-blocking hint is the gap nobody fills. 3. **Number only the pre-filled default,** never what the person typed. ### Users, operators, standards - **Users:** the list exists to disconnect one device without touching the others. Two identical rows make it easy to disconnect the wrong one. - **Operators:** audit lines name devices. The device id keeps them unambiguous, but readable names help incident handling. - **Standards:** no ISO, BSI or legal rule asks for unique labels. ISO 27002 5.16/5.17 and NIST SP 800-63B ask that authenticators can be revoked individually, which Cairn already does by id. - **WCAG 2.2:** - 3.3.1 and 3.3.3: the hint must be text, name the conflict and suggest the fix. - 4.1.3: announce it through `role="status"`. - No `aria-invalid`, and Continue stays enabled. - **Design systems:** SAP Fiori, Anvil and a GitLab discussion on duplicate rule names agree: a warning is the non-blocking tier, and a duplicate is "odd but not incorrect". ### Behaviour for the spec - **(1) Numbered default:** while the Name field still holds the untouched tile default, pre-fill the lowest free "{name} 2", "{name} 3"… (Finder style). Switching tiles re-computes it. A typed name is never changed. - **(3) Warning:** - A muted amber hint under Name, live and debounced: "You already have a device called "rclone". Two devices with the same name are hard to tell apart." It has a "Use "rclone 2"" link that fills the field. - Continue stays enabled. - The same hint appears in the Rename prompt. - **Approval flow, call:** the server numbers `approvalDeviceName` by the same rule (no person is there to warn). - **Comparison:** trimmed, case-insensitive, Unicode NFC. The device being renamed does not count against itself. - **Not:** no uniqueness rule and no 409 in the API (the WordPress lesson). - **Tests:** - Pure helpers `devUniqueName(base, existing)` and `devNameTaken(name, existing, selfId)`: case folding, trimming, gaps ("base", "base 3" gives "base 2"), and a typed name is never rewritten. - Go tests for the numbering of `approvalDeviceName`. The mockup expansion (next) adds this to Frame B and the Rename prompt. Sources: [Cloudron forum 15043](https://forum.cloudron.io/topic/15043/bug-report-no-warning-for-duplicate-app-password) · [WordPress changeset 59084](https://core.trac.wordpress.org/changeset/59084) · [Nextcloud app-password guide](https://www.simplified.guide/nextcloud/app-password-create) · [xaweho Nextcloud app passwords](https://xaweho.de/en/wissen/nextcloud/app-passwoerter) · [Apple Bonjour FAQ](https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/NetServices/Articles/faq.html) · [GitLab #251124](https://gitlab.com/gitlab-org/gitlab/-/issues/251124) · [SAP Fiori inline validation](https://experience.sap.com/fiori-design-ios/?p=13162) · [Anvil errors and warnings](https://anvil.servicetitan.com/docs/web/patterns/errors-and-warnings) · [CMS design system validation](https://design.cms.gov/v/9.0.0/patterns/Forms/validation) · [GitHub token docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) Full file: `cairn-work/scratch/b7e/897-duplicate-names-research.md`.
Cordy changed title from Connected devices limited to one folder and/or read only to Connected devices limited to one folder and/or read only (+ duplicate device names) 2026-10-14 11:33:58 +00:00
Author
Owner

Mockup ready for review

~/Downloads/design-direction-decision-needed/897-scoped-devices-mockup.html extends the approved #895 mockup. That file stays unchanged, as the record of what v0.6.340 built.

Frames

  • Flows: a password manager limited to one folder; a backup tool on a NAS; a read-only photo frame; a second rclone device (duplicate name).
  • B, Connect a device: "What can it reach?" (All my files / Only this folder + Choose…) and "What can it do?" (Read and change files / Read only). The numbered default name ("rclone 2"). The duplicate hint with "Use "rclone 2"". In a read-only space, the device can only be read only.
  • B2: the existing folder picker with My files, Spaces and Shared with me.
  • C, Ready: an info box "This device sees only /Backups/NAS". The address stays /dav/, because the limit belongs to the password, not the URL.
  • A, Connected devices: a label only on limited rows ("Only /Passwords", "Only /Photos · read only"). The summary counts limited devices. The Rename prompt shows the duplicate hint.
  • E, Bell and failure cases:
    • A deleted, moved or no-longer-accessible folder means the device is refused, not shown an empty drive. An empty root would make sync tools delete local copies.
    • A read-only device gets 403 when it tries to write.
  • D, Approval page: unchanged, except for the server-numbered name.

Open questions for Nikola (with recommendations)

  • Q1, defaults: All my files + Read and change, as today.
  • Q2, folder moved or renamed: bind to the path, as share links do (ARCHITECTURE §6). A move is caught by Q3.
  • Q3, folder deleted or access lost: refuse the device, send one bell item; restoring the folder brings it back. No automatic disconnect.
  • Q4, change the limit later: yes, via "Change access". Widening the limit asks "Confirm it's you".
  • Q5, which folders: own files, spaces and folders shared with the person, within their own rights.
  • Q6, approval page: no limits there in v1.
  • Q7: one folder per device.
  • Q8, idea only: an "Add files only" permission for ransomware-safe backup targets, as its own issue if wanted.
## Mockup ready for review `~/Downloads/design-direction-decision-needed/897-scoped-devices-mockup.html` extends the approved #895 mockup. That file stays unchanged, as the record of what v0.6.340 built. **Frames** - **Flows:** a password manager limited to one folder; a backup tool on a NAS; a read-only photo frame; a second rclone device (duplicate name). - **B, Connect a device:** "What can it reach?" (All my files / Only this folder + Choose…) and "What can it do?" (Read and change files / Read only). The numbered default name ("rclone 2"). The duplicate hint with "Use "rclone 2"". In a read-only space, the device can only be read only. - **B2:** the existing folder picker with My files, Spaces and Shared with me. - **C, Ready:** an info box "This device sees only /Backups/NAS". The address stays `/dav/`, because the limit belongs to the password, not the URL. - **A, Connected devices:** a label only on limited rows ("Only /Passwords", "Only /Photos · read only"). The summary counts limited devices. The Rename prompt shows the duplicate hint. - **E, Bell and failure cases:** - A deleted, moved or no-longer-accessible folder means the device is **refused, not shown an empty drive**. An empty root would make sync tools delete local copies. - A read-only device gets 403 when it tries to write. - **D, Approval page:** unchanged, except for the server-numbered name. **Open questions for Nikola (with recommendations)** - **Q1, defaults:** All my files + Read and change, as today. - **Q2, folder moved or renamed:** bind to the path, as share links do (ARCHITECTURE §6). A move is caught by Q3. - **Q3, folder deleted or access lost:** refuse the device, send one bell item; restoring the folder brings it back. No automatic disconnect. - **Q4, change the limit later:** yes, via "Change access". Widening the limit asks "Confirm it's you". - **Q5, which folders:** own files, spaces and folders shared with the person, within their own rights. - **Q6, approval page:** no limits there in v1. - **Q7:** one folder per device. - **Q8, idea only:** an "Add files only" permission for ransomware-safe backup targets, as its own issue if wanted.
Author
Owner

Decisions (Nikola, 2026-10-14)

Nikola took the recommendation on Q1 to Q7 (mockup comment 9085):

  • Q1, defaults: All my files + Read and change files, as today.
  • Q2, folder moved or renamed: the device is bound to the path, like share links (ARCHITECTURE §6). A move is handled as in Q3.
  • Q3, folder deleted, moved away or access lost: the device is refused, never shown an empty drive. One bell item is sent. Restoring the folder (or moving it back) makes the device work again. There is no automatic disconnect.
  • Q4, change the limit later: yes, with a Change access action on the row. Narrowing works at once. Widening (another folder, all files, read only → change) asks "Confirm it's you". Audited as app-password-scope-changed.
  • Q5, which folders can be chosen: own files, spaces the person belongs to, and folders shared with them, always within the person's own rights. In a read-only space, the device can only be read only.
  • Q6, approval page (Cairn apps): no limits there in v1. A device approved there can be limited afterwards with Change access.
  • Q7: one folder per device. A second folder means a second device.
  • Q8, "Add files only" (ransomware-safe backup target): not part of #897. It becomes a new issue, to be elaborated after #897.

The mockup 897-scoped-devices-mockup.html (with these answers) is the approved design for the spec.

## Decisions (Nikola, 2026-10-14) Nikola took the recommendation on Q1 to Q7 (mockup comment 9085): - **Q1, defaults:** All my files + Read and change files, as today. - **Q2, folder moved or renamed:** the device is bound to the path, like share links (ARCHITECTURE §6). A move is handled as in Q3. - **Q3, folder deleted, moved away or access lost:** the device is refused, never shown an empty drive. One bell item is sent. Restoring the folder (or moving it back) makes the device work again. There is no automatic disconnect. - **Q4, change the limit later:** yes, with a **Change access** action on the row. Narrowing works at once. Widening (another folder, all files, read only → change) asks "Confirm it's you". Audited as `app-password-scope-changed`. - **Q5, which folders can be chosen:** own files, spaces the person belongs to, and folders shared with them, always within the person's own rights. In a read-only space, the device can only be read only. - **Q6, approval page (Cairn apps):** no limits there in v1. A device approved there can be limited afterwards with Change access. - **Q7:** one folder per device. A second folder means a second device. - **Q8, "Add files only" (ransomware-safe backup target):** not part of #897. It becomes a **new issue**, to be elaborated after #897. The mockup `897-scoped-devices-mockup.html` (with these answers) is the approved design for the spec.
Author
Owner

Research for the two open spec questions (2026-10-14)

Nikola asked for deep research on both before deciding. Full files: cairn-work/scratch/b7e/897-research-q1-api-reach.md and 897-research-q2-folder-binding.md (market tables, incidents, standards, pitfalls, test lists and source URLs).

Q1: what can a limited device reach besides WebDAV?

Finding: today a device password reaches the whole REST API (trash, versions, share and grant creation, office tokens, search, changes), not just WebDAV.

Market

  • Nextcloud, oCIS and OpenCloud have no folder or read-only scoping. Nextcloud #2866 has been open for 9 years. OpenCloud's docs say app tokens "access all your data".
  • Products that do bind a credential to a folder use either a separate small API (Seafile library tokens, Dropbox App folder apps that get "not allowed to access this API function") or one central deny-by-default check (AWS prefix policies, Backblaze B2 keys with namePrefix, Storj caveats, Cloudflare's implicit deny).

Incidents with per-route checks:

  • Gitea's public-only tokens were enforced route by route. The result was a chain of bypasses: CVE-2025-68941, CVE-2026-24791 (CVSS 8.1; SSH keys, OAuth apps, private repos), then further incomplete fixes. The advisory calls it "systemic, not a single endpoint bug".
  • GitLab read-only tokens that could write.
  • Nextcloud CVE-2017-0892 (an app password without filesystem access reached files anyway).
  • Nextcloud reshare escalations (a share endpoint minting access the sharer did not have).
  • Prefix-match bugs (/uploads matching /uploads_backup).

Users: every documented use is a plain WebDAV client (password managers, backups, music players, scripts). Nobody asked for sharing, search, trash or office through a limited credential.

Standards: OWASP API5 (deny by default, one auditable authorization module), the OWASP authorization cheat sheet, RFC 9700 §2.3 (least privilege, checked on every request), NIST AC-6/AC-6(1), BSI ORP.4 and nDSG Art. 7 privacy by default. All point to one central allowlist plus enforcement at the resource.

Recommendation

  • A limited device gets WebDAV + TUS only, through a central allowlist. Every other route, including future ones, gets 403 device-limited without any handler code.
  • The folder and read-only limit is enforced once, in the scope layer.
  • A limited device can never create share links or grants, mint office tokens, manage devices or spaces, or get a session.
  • Later, only if a client needs it: add a small read-only file API relative to the root, one route at a time.
  • Cairn's official apps stay full access. The limit stays on the device record, so the RFC 8628 flow can later request it as a scope and show it on the consent screen (the Dropbox App folder / Google drive.file pattern).
  • Tests:
    • a sweep over the full route table with a limited credential, so new routes fail closed;
    • a golden snapshot of the allowlist;
    • a WebDAV method-by-path matrix (sibling prefix, .., encodings, a MOVE/COPY Destination outside the root).

Q2: a folder that reappears at the bound path

Precedents: every mature sync tool checks the identity of the root before trusting it.

  • Syncthing's .stfolder marker: no marker, no sync; it is never recreated on its own.
  • Resilio's .sync/ID.
  • rclone bisync --check-access with RCLONE_TEST files.
  • Unison's mountpoint.

The data losses happen when someone re-enables a root without checking it. A Syncthing user recreated the marker by hand and an empty folder wiped thousands of files, twice. Other cases: OneDrive reinstalls overwriting SharePoint with empty folders, and clients deleting newer files after a server backup restore (Nextcloud's fix is data-fingerprint).

Gaps in "path + latch on the next request or the daily check":

  • A folder deleted and recreated outside Cairn (SMB/NFS on a shared POSIX dataset, another tool on the bucket) is never noticed.
  • On S3 a move or delete is copy-then-delete key by key, so a device can sync a half-empty root before any latch fires.
  • Binding space folders by literal path would pause every device in a space on a rename. Bind by space id + relative path, which the spec already does.

Ruled out: general file ids (Nextcloud loses shares when ids change, oCIS gave up a readable layout, and it contradicts Cairn's path-keyed design). Comparing inodes or creation times (inodes are reused, and restore resets them).

Recommendation

  1. Latch on Cairn's own events: a delete or rename that touches the bound folder or a parent marks the binding unavailable before the operation runs. Nothing is checked per request, and it closes the window for changes made through Cairn, including the S3 half-empty window.
  2. One hidden identity marker per bound folder, .cairn-folder-<id>.
    • Checked with one stat or S3 HEAD, no decryption, cached for a few seconds, always fresh on the PROPFIND of the device's root, where every sync pass starts.
    • It travels with the folder through trash and moves.
    • It is stripped on copy, created last and deleted first on S3, never trusted inside .trash, hidden from the device itself, and never created automatically during a check.
  3. Two outcomes
    • Unavailable (folder gone, access lost): refuse; resume automatically when the same marker is back (restore from trash, move back, space reactivated).
    • A different folder at the path: refuse and latch until the person accepts it, with a warning that the sync app may delete files on the device that aren't in this folder.
  4. Device: always 403, never 404, never MKCOL, DELETE or MOVE on its own root.
  5. Person: one bell item per state change, and the device row shows the state with one action: "Restore folder", "Use the new location", or "Use this folder". Deleting or moving a folder that devices use first says "1 device uses this folder and will pause".

Smaller alternative: step 1 only (the event latch). It is free per request and strictly better than polling, but it misses changes made outside Cairn and never resumes on its own; the marker could follow later.

Standards: Saltzer & Schroeder fail-safe defaults, NIST SP 800-53r5 SA-8(23)/(24), ISO 27002 8.13 and 5.33, and BSI CON.3 (sync is not backup) all favour refusing over passing on an empty folder.

Decisions pending with Nikola.

## Research for the two open spec questions (2026-10-14) Nikola asked for deep research on both before deciding. Full files: `cairn-work/scratch/b7e/897-research-q1-api-reach.md` and `897-research-q2-folder-binding.md` (market tables, incidents, standards, pitfalls, test lists and source URLs). ### Q1: what can a limited device reach besides WebDAV? Finding: today a device password reaches the whole REST API (trash, versions, share and grant creation, office tokens, search, changes), not just WebDAV. **Market** - Nextcloud, oCIS and OpenCloud have no folder or read-only scoping. Nextcloud #2866 has been open for 9 years. OpenCloud's docs say app tokens "access all your data". - Products that do bind a credential to a folder use either a separate small API (Seafile library tokens, Dropbox App folder apps that get "not allowed to access this API function") or one central deny-by-default check (AWS prefix policies, Backblaze B2 keys with `namePrefix`, Storj caveats, Cloudflare's implicit deny). **Incidents** with per-route checks: - Gitea's public-only tokens were enforced route by route. The result was a chain of bypasses: CVE-2025-68941, CVE-2026-24791 (CVSS 8.1; SSH keys, OAuth apps, private repos), then further incomplete fixes. The advisory calls it "systemic, not a single endpoint bug". - GitLab read-only tokens that could write. - Nextcloud CVE-2017-0892 (an app password without filesystem access reached files anyway). - Nextcloud reshare escalations (a share endpoint minting access the sharer did not have). - Prefix-match bugs (`/uploads` matching `/uploads_backup`). **Users:** every documented use is a plain WebDAV client (password managers, backups, music players, scripts). Nobody asked for sharing, search, trash or office through a limited credential. **Standards:** OWASP API5 (deny by default, one auditable authorization module), the OWASP authorization cheat sheet, RFC 9700 §2.3 (least privilege, checked on every request), NIST AC-6/AC-6(1), BSI ORP.4 and nDSG Art. 7 privacy by default. All point to one central allowlist plus enforcement at the resource. **Recommendation** - A limited device gets WebDAV + TUS only, through a central allowlist. Every other route, including future ones, gets 403 `device-limited` without any handler code. - The folder and read-only limit is enforced once, in the scope layer. - A limited device can never create share links or grants, mint office tokens, manage devices or spaces, or get a session. - Later, only if a client needs it: add a small read-only file API relative to the root, one route at a time. - Cairn's official apps stay full access. The limit stays on the device record, so the RFC 8628 flow can later request it as a scope and show it on the consent screen (the Dropbox App folder / Google `drive.file` pattern). - Tests: - a sweep over the full route table with a limited credential, so new routes fail closed; - a golden snapshot of the allowlist; - a WebDAV method-by-path matrix (sibling prefix, `..`, encodings, a MOVE/COPY `Destination` outside the root). ### Q2: a folder that reappears at the bound path **Precedents:** every mature sync tool checks the identity of the root before trusting it. - Syncthing's `.stfolder` marker: no marker, no sync; it is never recreated on its own. - Resilio's `.sync/ID`. - rclone bisync `--check-access` with `RCLONE_TEST` files. - Unison's `mountpoint`. The data losses happen when someone re-enables a root without checking it. A Syncthing user recreated the marker by hand and an empty folder wiped thousands of files, twice. Other cases: OneDrive reinstalls overwriting SharePoint with empty folders, and clients deleting newer files after a server backup restore (Nextcloud's fix is `data-fingerprint`). **Gaps in "path + latch on the next request or the daily check":** - A folder deleted and recreated outside Cairn (SMB/NFS on a shared POSIX dataset, another tool on the bucket) is never noticed. - On S3 a move or delete is copy-then-delete key by key, so a device can sync a half-empty root before any latch fires. - Binding space folders by literal path would pause every device in a space on a rename. Bind by space id + relative path, which the spec already does. **Ruled out:** general file ids (Nextcloud loses shares when ids change, oCIS gave up a readable layout, and it contradicts Cairn's path-keyed design). Comparing inodes or creation times (inodes are reused, and restore resets them). **Recommendation** 1. **Latch on Cairn's own events:** a delete or rename that touches the bound folder or a parent marks the binding unavailable before the operation runs. Nothing is checked per request, and it closes the window for changes made through Cairn, including the S3 half-empty window. 2. **One hidden identity marker per bound folder,** `.cairn-folder-<id>`. - Checked with one stat or S3 HEAD, no decryption, cached for a few seconds, always fresh on the PROPFIND of the device's root, where every sync pass starts. - It travels with the folder through trash and moves. - It is stripped on copy, created last and deleted first on S3, never trusted inside `.trash`, hidden from the device itself, and never created automatically during a check. 3. **Two outcomes** - **Unavailable** (folder gone, access lost): refuse; resume **automatically** when the same marker is back (restore from trash, move back, space reactivated). - **A different folder at the path:** refuse and latch until the person accepts it, with a warning that the sync app may delete files on the device that aren't in this folder. 4. **Device:** always 403, never 404, never MKCOL, DELETE or MOVE on its own root. 5. **Person:** one bell item per state change, and the device row shows the state with one action: "Restore folder", "Use the new location", or "Use this folder". Deleting or moving a folder that devices use first says "1 device uses this folder and will pause". **Smaller alternative:** step 1 only (the event latch). It is free per request and strictly better than polling, but it misses changes made outside Cairn and never resumes on its own; the marker could follow later. Standards: Saltzer & Schroeder fail-safe defaults, NIST SP 800-53r5 SA-8(23)/(24), ISO 27002 8.13 and 5.33, and BSI CON.3 (sync is not backup) all favour refusing over passing on an empty folder. Decisions pending with Nikola.
Author
Owner

Decisions (Nikola, 2026-10-14), after the research in comment 9092

  1. API reach: a limited device (one folder or read only) gets WebDAV + TUS only, through a central allowlist. Every other route, including future ones, answers 403 device-limited. Cairn's official apps stay full access; the limit can be requested by an app later through the device flow. Nikola: "yes as it was also confirmed by the research."
  2. A folder that reappears at the bound path: the full design.
    • The binding is marked unavailable on Cairn's own delete and rename events, before the operation runs.
    • A hidden identity marker .cairn-folder-<id> sits in each bound folder:
      • it travels through trash and moves;
      • it is stripped on copy and never created automatically during a check;
      • it is checked on the root PROPFIND of every sync pass.
    • Same folder back: the device resumes automatically.
    • A different folder at the path: the device is refused until the person accepts it, with a warning.
    • Row states and actions: "Restore folder", "Use the new location", "Use this folder". A warning before deleting or moving a folder that devices use.
    • The new screens get mocked up before building.
  3. Frame A2 (Change access): approved as drawn.
## Decisions (Nikola, 2026-10-14), after the research in comment 9092 1. **API reach:** a limited device (one folder or read only) gets **WebDAV + TUS only**, through a central allowlist. Every other route, including future ones, answers 403 `device-limited`. Cairn's official apps stay full access; the limit can be requested by an app later through the device flow. Nikola: "yes as it was also confirmed by the research." 2. **A folder that reappears at the bound path: the full design.** - The binding is marked unavailable on Cairn's own delete and rename events, **before** the operation runs. - A hidden identity marker `.cairn-folder-<id>` sits in each bound folder: - it travels through trash and moves; - it is stripped on copy and never created automatically during a check; - it is checked on the root PROPFIND of every sync pass. - **Same folder back:** the device resumes automatically. - **A different folder at the path:** the device is refused until the person accepts it, with a warning. - Row states and actions: "Restore folder", "Use the new location", "Use this folder". A warning before deleting or moving a folder that devices use. - The new screens get mocked up before building. 3. **Frame A2 (Change access):** approved as drawn.
Author
Owner

Mockup approval (Nikola, 2026-10-14): "all is good"

Approved as drawn in 897-scoped-devices-mockup.html:

  • A3: paused rows, with one action per state.
  • A4: "Use this folder?", drawn on the whole page.
  • E2: bell items per state, drawn on the whole page. They replace Frame E's single "can no longer reach" item.
  • G: the delete dialog line and the move status line.

Also approved: the calls I made after the second builder check:

  • Space rename: while a space's folder is being renamed in the background, its devices are told to "try again shortly" (503 with Retry-After). There is no bell item and no audit entry, and the device resumes by itself.
  • Folder moved somewhere the person cannot reach: this counts as No access. The text is ""{folder}" was moved somewhere you cannot reach." and no path is shown.
  • Deleted space: No access, with the text "The space {name} was deleted."
  • TUS uploads: tied to the device that started them.

The spec is complete (docs/superpowers/specs/2026-10-14-scoped-devices-897-design.md); next is the plan.

## Mockup approval (Nikola, 2026-10-14): "all is good" Approved as drawn in `897-scoped-devices-mockup.html`: - **A3**: paused rows, with one action per state. - **A4**: "Use this folder?", drawn on the whole page. - **E2**: bell items per state, drawn on the whole page. They replace Frame E's single "can no longer reach" item. - **G**: the delete dialog line and the move status line. Also approved: the calls I made after the second builder check: - **Space rename:** while a space's folder is being renamed in the background, its devices are told to "try again shortly" (503 with Retry-After). There is no bell item and no audit entry, and the device resumes by itself. - **Folder moved somewhere the person cannot reach:** this counts as No access. The text is ""{folder}" was moved somewhere you cannot reach." and no path is shown. - **Deleted space:** No access, with the text "The space {name} was deleted." - **TUS uploads:** tied to the device that started them. The spec is complete (`docs/superpowers/specs/2026-10-14-scoped-devices-897-design.md`); next is the plan.
Author
Owner

Shipped in v0.6.341 (PR #901)

Both dogfoods are on v0.6.341 (homelab-config 1304cf6, pods healthy).

What's in

  • Limits: a device can be limited to one folder and/or to read only, through Connect a device or Change access. Widening asks for confirmation; narrowing does not.
  • Central allowlist: limited devices reach only WebDAV and uploads.
  • Folder identity: a hidden marker plus a latch that pauses devices before their folder is deleted or moved, with the paused states and their fixes.
  • Files warning: Files warns before deleting or moving a folder that devices use.
  • Duplicate names: prefilled names are numbered, typed duplicates get a hint, and approval names are numbered too.
  • Read only for everyone: LOCK, POST lock, PROPPATCH and starting an upload now refuse read-only targets.
  • Bell items and audit for paused devices and limit changes.
  • Docs across the handbook (account, users-access, admin-policy, data-protection-operators, security-standards, spaces, spaces-rename, deployment, SYNC, index), plus ARCHITECTURE and CHANGELOG.

How it was built. 9 tasks, subagent-driven, each with its own review and fix rounds. Then a whole-branch review, one fix wave and a re-review, and a docs review against the code.

Applied the #895 lessons

  • Mockup drift: a per-frame must-match table in the spec. A live check on a local instance after every UI task found drift before approval: dark-theme tints, the violet chip's contrast, and shared folders that could not be chosen.
  • Silent failures: every refusal has a code and a log line.
  • Edge cases: an auth-mode × account-type matrix in the tests.

Live-checked locally

  • Connect a device with a folder, with a shared folder, and read only.
  • Escape attempts.
  • REST refused for limited devices.
  • Delete, then restore: the device resumed by itself.
  • Move, then Use the new location.
  • A replaced folder, then the Use this folder dialog.
  • Change access.
  • Bell items.
  • The Files delete dialog and move line.
  • Widening on a session older than 10 minutes: 401, then 200 after confirming.

Still open: Nikola's live check on the dogfood. The Keycloak widening round trip needs his sign-in.

Calls I made along the way (all in the PR / ledger):

  • The A4 "by {who}" fact is left out, because the folder listing has no last-modifier field.
  • A failed space convergence keeps that space's devices at 503 until a successful retry.
  • Moving (503) answers carry device-folder-moving.

Follow-ups opened

  • #900: Add files only (from earlier).
  • #902: the version restore path bug.
  • #903: WebDAV quota reports backend-wide usage.
  • #904: admin "data was restored" epoch.
## Shipped in v0.6.341 (PR #901) Both dogfoods are on v0.6.341 (homelab-config 1304cf6, pods healthy). **What's in** - **Limits:** a device can be limited to one folder and/or to read only, through Connect a device or Change access. Widening asks for confirmation; narrowing does not. - **Central allowlist:** limited devices reach only WebDAV and uploads. - **Folder identity:** a hidden marker plus a latch that pauses devices before their folder is deleted or moved, with the paused states and their fixes. - **Files warning:** Files warns before deleting or moving a folder that devices use. - **Duplicate names:** prefilled names are numbered, typed duplicates get a hint, and approval names are numbered too. - **Read only for everyone:** LOCK, POST lock, PROPPATCH and starting an upload now refuse read-only targets. - **Bell items and audit** for paused devices and limit changes. - **Docs** across the handbook (account, users-access, admin-policy, data-protection-operators, security-standards, spaces, spaces-rename, deployment, SYNC, index), plus ARCHITECTURE and CHANGELOG. **How it was built.** 9 tasks, subagent-driven, each with its own review and fix rounds. Then a whole-branch review, one fix wave and a re-review, and a docs review against the code. **Applied the #895 lessons** - **Mockup drift:** a per-frame must-match table in the spec. A live check on a local instance after every UI task found drift before approval: dark-theme tints, the violet chip's contrast, and shared folders that could not be chosen. - **Silent failures:** every refusal has a code and a log line. - **Edge cases:** an auth-mode × account-type matrix in the tests. **Live-checked locally** - Connect a device with a folder, with a shared folder, and read only. - Escape attempts. - REST refused for limited devices. - Delete, then restore: the device resumed by itself. - Move, then Use the new location. - A replaced folder, then the Use this folder dialog. - Change access. - Bell items. - The Files delete dialog and move line. - Widening on a session older than 10 minutes: 401, then 200 after confirming. **Still open: Nikola's live check on the dogfood.** The Keycloak widening round trip needs his sign-in. **Calls I made along the way** (all in the PR / ledger): - The A4 "by {who}" fact is left out, because the folder listing has no last-modifier field. - A failed space convergence keeps that space's devices at 503 until a successful retry. - Moving (503) answers carry `device-folder-moving`. **Follow-ups opened** - #900: Add files only (from earlier). - #902: the version restore path bug. - #903: WebDAV quota reports backend-wide usage. - #904: admin "data was restored" epoch.
Author
Owner

v0.6.342 (PR #905): fixes from Nikola's live check

  • Trash folders as targets: folder pickers (move, copy, report, device) no longer offer a space's hidden .trash folder. The server also refuses trash folders as device targets (422 access-not-allowed) and as report folders (422 share-report-dir-trash / admin-report-dir-trash); a stored one is refused when the report runs.
  • Path box overlap: the path box next to Only this folder no longer overlaps the line under it, and the radio stays level when a long path wraps.
  • Related finding: admins can write into a space's .trash through a hand-made REST call. Opened as #906.

About the confirm prompt right after an identity-provider sign-in: this is the #895 design. A normal identity-provider sign-in does not count as "confirm it's you", because the provider may sign the person in silently. Only a Sign in again does, and it holds for 10 minutes. Whether a normal sign-in with a fresh auth_time should count is open with Nikola.

Both dogfoods are on v0.6.342.

## v0.6.342 (PR #905): fixes from Nikola's live check - **Trash folders as targets:** folder pickers (move, copy, report, device) no longer offer a space's hidden `.trash` folder. The server also refuses trash folders as device targets (422 `access-not-allowed`) and as report folders (422 `share-report-dir-trash` / `admin-report-dir-trash`); a stored one is refused when the report runs. - **Path box overlap:** the path box next to Only this folder no longer overlaps the line under it, and the radio stays level when a long path wraps. - **Related finding:** admins can write into a space's `.trash` through a hand-made REST call. Opened as #906. **About the confirm prompt right after an identity-provider sign-in:** this is the #895 design. A normal identity-provider sign-in does not count as "confirm it's you", because the provider may sign the person in silently. Only a Sign in again does, and it holds for 10 minutes. Whether a normal sign-in with a fresh `auth_time` should count is open with Nikola. Both dogfoods are on v0.6.342.
Author
Owner

Closing. Everything was shipped in v0.6.341 and v0.6.342. Nikola's dogfood check found the trash-in-pickers and layout issues, which v0.6.342 fixed. The confirm-after-sign-in question became #907, shipped in v0.6.343. Nothing from this issue is left open.

Closing. Everything was shipped in v0.6.341 and v0.6.342. Nikola's dogfood check found the trash-in-pickers and layout issues, which v0.6.342 fixed. The confirm-after-sign-in question became #907, shipped in v0.6.343. Nothing from this issue is left open.
Cordy closed this issue 2026-10-15 21:48:40 +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#897
No description provided.