authoravatarclover caruso<git@paperclover.net>2026-10-16 02:47:22-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-21 02:52:29-07:00
logfaf5d02abe3fc04b016593b922ac52e3ae8bd9f1
treedd3e6b579106bec598b55072991b89e6988cbfce
parent83bb016ae253ba9ec424a98efd19351f9531e6b4
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Retire the legacy Copyparty Public folder

Remove the automatic clover/Public mount and its broad account grants in favor of managed shares and folder permissions. Preserve coverage for API wildcard isolation and inherited grants using a fixture mount. Assisted-by: gpt-6.1-sol

3 files changed, 33 insertions(+), 32 deletions(-)

service/copyparty/copyparty.conf-9
......@@ -44,15 +44,6 @@
4444 flags:
4545 chmod_f: 664
4646 chmod_d: 775
47[/clover/Public]
48 /w/clover/Public
49 accs:
50 r.: *
51 rwm: @acct
52 rwmd: snow
53 flags:
54 chmod_f: 664
55 chmod_d: 775
5647[/logs]
5748 /w/logs
5849 accs:
tools/copyparty-test.py+32-23
......@@ -1,5 +1,6 @@
11#!/usr/bin/env python3
22import copy
3from functools import partial
34import importlib.util
45import json
56import os
......@@ -88,7 +89,7 @@ class Shares(unittest.TestCase):
8889 self.assertNotIn('password', state)
8990 self.assertNotIn(created['password'], (self.cfg / 'manager.json').read_text())
9091 self.assertNotIn(created['password'], (self.cfg / 'copyparty.conf').read_text())
91 self.assertIn('w: @acct,-api-' + identifier, (self.cfg / 'copyparty.conf').read_text())
92 self.assertIn('g: *,-api-' + identifier, (self.cfg / 'copyparty.conf').read_text())
9293 self.call('account.delete', id=identifier)
9394 self.assertNotIn(key, self.variable['Items'])
9495
......@@ -123,12 +124,12 @@ class Shares(unittest.TestCase):
123124 self.assertNotIn('rw: @snow-user-' + self.subject, config)
124125
125126 def test_exact_base_mount_is_rendered_once(self):
126 (self.root / 'Public').mkdir()
127 self.call('grant.save', id=None, subject='user:' + self.subject, path=str(self.root / 'Public'), permissions='d')
127 self.call('grant.save', id=None, subject='user:' + self.subject, path=str(self.root), permissions='d')
128128 config = (self.cfg / 'copyparty.conf').read_text()
129 self.assertEqual(config.count('[/clover/Public]'), 1)
130 self.assertIn('r.: *', config)
131 self.assertIn('d: @snow-user-' + self.subject, config)
129 self.assertEqual(config.count('[/clover]'), 1)
130 clover = config.split('[/clover]')[1].split('[/media]')[0]
131 self.assertIn('A: snow', clover)
132 self.assertIn('d: @snow-user-' + self.subject, clover)
132133
133134 def test_untrusted_boundary_and_symlink_escape_reject_before_nomad(self):
134135 folder = self.root / 'work'
......@@ -264,23 +265,31 @@ class Shares(unittest.TestCase):
264265 self.assertEqual((self.root / 'Share').stat().st_mode & 0o777, 0o775)
265266 self.assertEqual((self.root / 'Share/Clover - Restricted').stat().st_mode & 0o777, 0o775)
266267
267 def test_api_scope_excludes_wildcards_but_explicit_child_grant_works(self):
268 account = self.call('account.create', name='Scoped')['account']
269 (self.root / 'Public').mkdir()
270 self.call('grant.save', id=None, subject=account['subject'], path=str(self.root), permissions='r')
271 config = (self.cfg / 'copyparty.conf').read_text()
272 public = config.split('[/clover/Public]')[1].split('[/logs]')[0]
273 self.assertIn('r: *\n', public)
274 self.assertIn('w: @acct,-' + account['username'], public)
275 self.assertIn('r: ' + account['username'], public)
276 logs = config.split('[/logs]')[1]
277 self.assertIn('g: *,-' + account['username'], logs)
278 manager = shares.Manager(self.users)
279 manager.data = json.loads((self.cfg / 'manager.json').read_text())
280 manager.items = self.variable['Items']
281 manager.owner_permissions(account['username'], self.root / 'Public', 'r')
282 with self.assertRaises(shares.Error):
283 manager.owner_permissions(account['username'], self.root / 'Public', 'w')
268 def test_api_scope_excludes_wildcards_until_ancestor_grant(self):
269 source = Path(self.temporary.name) / 'base.conf'
270 source.write_text(Path(shares.__file__).with_name('copyparty.conf').read_text() +
271 '\n[/clover/scoped]\n /w/clover/scoped\n accs:\n r: *\n w: @acct\n')
272 (self.root / 'scoped').mkdir()
273 with patch.object(shares, 'configuration', partial(shares.configuration, source=source)):
274 account = self.call('account.create', name='Scoped')['account']
275 config = (self.cfg / 'copyparty.conf').read_text()
276 scoped = config.split('[/clover/scoped]')[1]
277 self.assertIn('r: *,-' + account['username'], scoped)
278 self.assertIn('w: @acct,-' + account['username'], scoped)
279 self.call('grant.save', id=None, subject=account['subject'], path=str(self.root), permissions='r')
280 config = (self.cfg / 'copyparty.conf').read_text()
281 scoped = config.split('[/clover/scoped]')[1]
282 self.assertIn('r: *\n', scoped)
283 self.assertIn('w: @acct,-' + account['username'], scoped)
284 self.assertIn('r: ' + account['username'], scoped)
285 logs = config.split('[/logs]')[1].split('[/clover/scoped]')[0]
286 self.assertIn('g: *,-' + account['username'], logs)
287 manager = shares.Manager(self.users)
288 manager.data = json.loads((self.cfg / 'manager.json').read_text())
289 manager.items = self.variable['Items']
290 manager.owner_permissions(account['username'], self.root / 'scoped', 'r')
291 with self.assertRaises(shares.Error):
292 manager.owner_permissions(account['username'], self.root / 'scoped', 'w')
284293
285294 def test_admin_can_retarget_other_owner_with_destination_permissions(self):
286295 destination = self.root / 'other'
tools/copyparty.md+1
......@@ -4,6 +4,7 @@ Snowglobe's admin Shares page manages native public links and separate API
44accounts. A person's page assigns folder permissions. Existing Copyparty
55permissions remain additive; changing a folder is an explicit retarget or move
66action. New shared folders default to `Share/Name - Description` under Clover.
7The legacy `clover/Public` mount is retired; use managed links and grants.
78
89Copyparty owns its native `cfg/copyparty/shares.db` and selected-file records.
910`cfg/manager.json` stores API account labels, UUID-based folder grants, and link