Connected devices: "Add files only" permission (ransomware-safe backup target) #900

Closed
opened 2026-10-14 20:36:55 +00:00 by Cordy · 4 comments
Owner

Idea from the #897 mockup (Q8). Nikola, 2026-10-14: "sounds interesting, make a new issue and elaborate on it further after 897". Work on it after #897 ships.

The idea

#897 adds two permissions for a connected device: Read and change files and Read only. This would be a third one: Add files only.

  • The device can create new files and folders.
  • It cannot overwrite, delete, move or rename anything that already exists.

Why

  • A backup tool on a NAS or server (for example rclone) needs write access to its backup folder.
  • If that machine is compromised (ransomware, a stolen password), the attacker can use the same password to delete or encrypt the backups. Then the backups fail exactly when they are needed.
  • With "Add files only", a stolen device password can add junk but cannot destroy what is already there.
  • Combined with #897's "Only this folder", this gives a backup target the attacker cannot wipe, set up by the user in one dialog.
  • In the products looked at for #895 and #897 (Nextcloud, ownCloud, OpenCloud, Seafile, Synology), nothing comparable exists per device password. Object stores have related ideas: S3 Object Lock and append-only repositories (restic and borg append-only mode).

Questions to research first (deep research before decisions, as usual)

  • Do backup tools work against it?
    • rclone copy and sync write temp files and then rename them, may overwrite, and set modification times.
    • restic and borg over WebDAV or rclone.
    • Duplicati, Hyper Backup, Kopia.
    • Which of them work with create-only semantics, with which flags (e.g. rclone --inplace, --immutable, --no-update-modtime)? Which need delete, for example for pruning?
  • WebDAV semantics:
    • PUT to a new path is allowed; PUT to an existing path is refused.
    • MKCOL is allowed.
    • DELETE, MOVE, COPY-overwrite and PROPPATCH are refused.
    • LOCK on new resources?
    • TUS uploads: same rule.
  • Interaction with versioning (#541), trash, retention and legal holds: is "Add files only" just a simpler front-end to existing immutability?
  • Pruning old backups: done from the browser or by a separate, normal device? How do we tell the user?
  • Market, user and operator demand, and standards: ransomware guidance from BSI, NCSC and CISA (immutable, offline backups); ISO 27002 8.13 (information backup).

Depends on

#897 (folder-limited and read-only devices), because this is a third value of the same permission setting.

Idea from the #897 mockup (Q8). Nikola, 2026-10-14: "sounds interesting, make a new issue and elaborate on it further after 897". **Work on it after #897 ships.** ## The idea #897 adds two permissions for a connected device: **Read and change files** and **Read only**. This would be a third one: **Add files only**. - The device can create new files and folders. - It cannot overwrite, delete, move or rename anything that already exists. ## Why - A backup tool on a NAS or server (for example rclone) needs write access to its backup folder. - If that machine is compromised (ransomware, a stolen password), the attacker can use the same password to delete or encrypt the backups. Then the backups fail exactly when they are needed. - With "Add files only", a stolen device password can add junk but cannot destroy what is already there. - Combined with #897's "Only this folder", this gives a backup target the attacker cannot wipe, set up by the user in one dialog. - In the products looked at for #895 and #897 (Nextcloud, ownCloud, OpenCloud, Seafile, Synology), nothing comparable exists per device password. Object stores have related ideas: S3 Object Lock and append-only repositories (restic and borg append-only mode). ## Questions to research first (deep research before decisions, as usual) - **Do backup tools work against it?** - rclone `copy` and `sync` write temp files and then rename them, may overwrite, and set modification times. - restic and borg over WebDAV or rclone. - Duplicati, Hyper Backup, Kopia. - Which of them work with create-only semantics, with which flags (e.g. rclone `--inplace`, `--immutable`, `--no-update-modtime`)? Which need delete, for example for pruning? - **WebDAV semantics:** - PUT to a new path is allowed; PUT to an existing path is refused. - MKCOL is allowed. - DELETE, MOVE, COPY-overwrite and PROPPATCH are refused. - LOCK on new resources? - TUS uploads: same rule. - **Interaction with versioning (#541), trash, retention and legal holds:** is "Add files only" just a simpler front-end to existing immutability? - **Pruning old backups:** done from the browser or by a separate, normal device? How do we tell the user? - **Market, user and operator demand, and standards:** ransomware guidance from BSI, NCSC and CISA (immutable, offline backups); ISO 27002 8.13 (information backup). ## Depends on #897 (folder-limited and read-only devices), because this is a third value of the same permission setting.
Author
Owner

Research (2026-10-15)

Full file: cairn-work/scratch/b7e/batch907/900-research.md.

Recommendation: build "Add files only" now, with a short settle window. "Never destroy" (overwrites and deletes kept as versions and trash) comes later, because three gaps block it today.

Precedent for "Add files only":

  • restic: its append-only definition is "can only be written to and read from, while delete and overwrite operations are denied". rest-server always refuses overwrites.
  • Borg 2: a no-delete permission.
  • Synology WriteOnce: an Auto Lock Timer before files lock.
  • Nextcloud: create-only exists for file-drop shares, but its app passwords can't be limited at all. Cairn would be first with a create-only device password.

Gaps blocking "Never destroy" (found by reading the code; failing tests needed first):

  1. Count-based pruning: versions are pruned by count at write time (default 10, versions.go:283), so 11 overwrites remove every clean version. NCSC Principle 3 asks for time-based retention.
  2. MOVE/COPY onto an existing file destroys it: no version and no trash, for every client (dav.go:493-507, versions.go:467/502). A probable data-loss bug: its own issue.
  3. Version saving fails open: the write goes through even when the version save fails (versions.go:235).

Tool compatibility with "Add files only":

  • Work with the settle window: restic via rclone (it deletes its lock files), Kopia with --atomic-writes, Duplicati with --keep-versions=0 --no-auto-compact.
  • Work as is: rclone copy --immutable.
  • Fail: rclone sync/bisync, Office editing, KeePass sync.
  • Untested: Hyper Backup, Finder (.DS_Store), Arq.

Settle window: the device may replace, delete or rename files it created itself for N minutes (default 60, counted from creation, not reset by later writes). An attacker can then only touch the newest files.

Other findings:

  • Race: PUT checks existence, then writes. This needs a no-overwrite write path, or an in-process lock as fallback; Garage support for conditional writes is unconfirmed.
  • Refusal code: 403 device-limited, not 409, which makes clients retry.
  • Permission order: full ⊇ add ⊇ read, so read only → add only is widening.
  • Messaging: an add-only folder is immutable, not offline in the BSI sense; the docs must say so.
  • Pruning: from a separate full device, or in the browser.

Decisions (my recommendation in brackets):

  • D1 Design ["Add files only" now, "Never destroy" later].
  • D2 Settle window [creator only, 60 min default, admin maximum 24 h].
  • D3 Data model [replace ReadOnly with Mode: "", "read", "add"].
  • D4 Refusal code [403 device-limited].
  • D5 PROPPATCH on existing files [allow; it stores nothing].
  • D6 Combine with the folder limit [yes].
  • D7 Version and trash gaps [a separate hardening issue, filed now].
  • D8 Alert on repeated refusals [a bell item, at most once per device per hour].

Mockups needed: the third radio option with its hint and badge, the confirm step for read only → add only, the alert text, and the admin field for the window.

Size:

  • "Add files only": M, about 1-1.5 weeks.
  • Hardening issue: S-M.
  • "Never destroy": L, later.
## Research (2026-10-15) Full file: `cairn-work/scratch/b7e/batch907/900-research.md`. **Recommendation:** build "Add files only" now, with a short settle window. "Never destroy" (overwrites and deletes kept as versions and trash) comes later, because three gaps block it today. **Precedent for "Add files only":** - **restic:** its append-only definition is "can only be written to and read from, while delete and overwrite operations are denied". rest-server always refuses overwrites. - **Borg 2:** a `no-delete` permission. - **Synology WriteOnce:** an Auto Lock Timer before files lock. - **Nextcloud:** create-only exists for file-drop shares, but its app passwords can't be limited at all. Cairn would be first with a create-only device password. **Gaps blocking "Never destroy"** (found by reading the code; failing tests needed first): 1. **Count-based pruning:** versions are pruned by count at write time (default 10, `versions.go:283`), so 11 overwrites remove every clean version. NCSC Principle 3 asks for time-based retention. 2. **MOVE/COPY onto an existing file destroys it:** no version and no trash, for every client (`dav.go:493-507`, `versions.go:467/502`). A probable data-loss bug: its own issue. 3. **Version saving fails open:** the write goes through even when the version save fails (`versions.go:235`). **Tool compatibility with "Add files only":** - **Work with the settle window:** restic via rclone (it deletes its lock files), Kopia with `--atomic-writes`, Duplicati with `--keep-versions=0 --no-auto-compact`. - **Work as is:** rclone `copy --immutable`. - **Fail:** rclone sync/bisync, Office editing, KeePass sync. - **Untested:** Hyper Backup, Finder (`.DS_Store`), Arq. **Settle window:** the device may replace, delete or rename files it created itself for N minutes (default 60, counted from creation, not reset by later writes). An attacker can then only touch the newest files. **Other findings:** - **Race:** PUT checks existence, then writes. This needs a no-overwrite write path, or an in-process lock as fallback; Garage support for conditional writes is unconfirmed. - **Refusal code:** 403 `device-limited`, not 409, which makes clients retry. - **Permission order:** full ⊇ add ⊇ read, so read only → add only is widening. - **Messaging:** an add-only folder is immutable, not offline in the BSI sense; the docs must say so. - **Pruning:** from a separate full device, or in the browser. **Decisions** (my recommendation in brackets): - D1 Design ["Add files only" now, "Never destroy" later]. - D2 Settle window [creator only, 60 min default, admin maximum 24 h]. - D3 Data model [replace `ReadOnly` with `Mode`: "", "read", "add"]. - D4 Refusal code [403 `device-limited`]. - D5 PROPPATCH on existing files [allow; it stores nothing]. - D6 Combine with the folder limit [yes]. - D7 Version and trash gaps [a separate hardening issue, filed now]. - D8 Alert on repeated refusals [a bell item, at most once per device per hour]. **Mockups needed:** the third radio option with its hint and badge, the confirm step for read only → add only, the alert text, and the admin field for the window. **Size:** - "Add files only": M, about 1-1.5 weeks. - Hardening issue: S-M. - "Never destroy": L, later.
Author
Owner

Decisions (Nikola, 2026-10-15): all recommendations accepted (comment 9164): "Add files only" now, "Never destroy" later; settle window creator-only, 60 min default, admin max 24 h; Mode replaces ReadOnly; 403 device-limited; PROPPATCH allowed; combines with the folder limit; version/trash gaps in #908; bell alert at most once per device per hour. Mockup next, then build (batch B).

**Decisions (Nikola, 2026-10-15): all recommendations accepted** (comment 9164): "Add files only" now, "Never destroy" later; settle window creator-only, 60 min default, admin max 24 h; `Mode` replaces `ReadOnly`; 403 `device-limited`; PROPPATCH allowed; combines with the folder limit; version/trash gaps in #908; bell alert at most once per device per hour. Mockup next, then build (batch B).
Author
Owner

Mockup answers (Nikola, 2026-10-15)

  • Q1: the settle window cannot be switched off; the smallest value is 1 minute. Accepted as recommended.
  • Q2: Add files only is offered only for the rclone and Other WebDAV app tiles (the alternative). Nikola asked me to challenge this; my challenge is in the chat, and the decision stands unless he changes it.
  • Q3: the alert fires after 10 refusals within an hour; the threshold is fixed. Accepted as recommended.
## Mockup answers (Nikola, 2026-10-15) - **Q1:** the settle window cannot be switched off; the smallest value is 1 minute. Accepted as recommended. - **Q2:** Add files only is offered **only for the rclone and Other WebDAV app tiles** (the alternative). Nikola asked me to challenge this; my challenge is in the chat, and the decision stands unless he changes it. - **Q3:** the alert fires after 10 refusals within an hour; the threshold is fixed. Accepted as recommended.
Author
Owner

Mockup approved (Nikola, 2026-10-15)

Nikola approved 900-add-files-only-mockup.html, including the decided tile rule: Add files only is offered only for rclone and Other WebDAV app, in both Connect a device and Change access. #900 builds in batch B, from this mockup.

## Mockup approved (Nikola, 2026-10-15) Nikola approved `900-add-files-only-mockup.html`, including the decided tile rule: Add files only is offered only for rclone and Other WebDAV app, in both Connect a device and Change access. #900 builds in batch B, from this mockup.
Cordy referenced this issue from a commit 2026-10-27 14:53:17 +00:00
Cordy referenced this issue from a commit 2026-10-27 14:53:17 +00:00
Cordy closed this issue 2026-10-27 15:36: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#900
No description provided.