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 @@...@@ -44,15 +44,6 @@
44 flags:44 flags:
45 chmod_f: 66445 chmod_f: 664
46 chmod_d: 77546 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
56[/logs]47[/logs]
57 /w/logs48 /w/logs
58 accs:49 accs:
tools/copyparty-test.py+32-23
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1#!/usr/bin/env python31#!/usr/bin/env python3
2import copy2import copy
3from functools import partial
3import importlib.util4import importlib.util
4import json5import json
5import os6import os
...@@ -88,7 +89,7 @@ class Shares(unittest.TestCase):...@@ -88,7 +89,7 @@ class Shares(unittest.TestCase):
88 self.assertNotIn('password', state)89 self.assertNotIn('password', state)
89 self.assertNotIn(created['password'], (self.cfg / 'manager.json').read_text())90 self.assertNotIn(created['password'], (self.cfg / 'manager.json').read_text())
90 self.assertNotIn(created['password'], (self.cfg / 'copyparty.conf').read_text())91 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())
92 self.call('account.delete', id=identifier)93 self.call('account.delete', id=identifier)
93 self.assertNotIn(key, self.variable['Items'])94 self.assertNotIn(key, self.variable['Items'])
9495
...@@ -123,12 +124,12 @@ class Shares(unittest.TestCase):...@@ -123,12 +124,12 @@ class Shares(unittest.TestCase):
123 self.assertNotIn('rw: @snow-user-' + self.subject, config)124 self.assertNotIn('rw: @snow-user-' + self.subject, config)
124125
125 def test_exact_base_mount_is_rendered_once(self):126 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), permissions='d')
127 self.call('grant.save', id=None, subject='user:' + self.subject, path=str(self.root / 'Public'), permissions='d')
128 config = (self.cfg / 'copyparty.conf').read_text()128 config = (self.cfg / 'copyparty.conf').read_text()
129 self.assertEqual(config.count('[/clover/Public]'), 1)129 self.assertEqual(config.count('[/clover]'), 1)
130 self.assertIn('r.: *', config)130 clover = config.split('[/clover]')[1].split('[/media]')[0]
131 self.assertIn('d: @snow-user-' + self.subject, config)131 self.assertIn('A: snow', clover)
132 self.assertIn('d: @snow-user-' + self.subject, clover)
132133
133 def test_untrusted_boundary_and_symlink_escape_reject_before_nomad(self):134 def test_untrusted_boundary_and_symlink_escape_reject_before_nomad(self):
134 folder = self.root / 'work'135 folder = self.root / 'work'
...@@ -264,23 +265,31 @@ class Shares(unittest.TestCase):...@@ -264,23 +265,31 @@ class Shares(unittest.TestCase):
264 self.assertEqual((self.root / 'Share').stat().st_mode & 0o777, 0o775)265 self.assertEqual((self.root / 'Share').stat().st_mode & 0o777, 0o775)
265 self.assertEqual((self.root / 'Share/Clover - Restricted').stat().st_mode & 0o777, 0o775)266 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 def test_api_scope_excludes_wildcards_until_ancestor_grant(self):
268 account = self.call('account.create', name='Scoped')['account']269 source = Path(self.temporary.name) / 'base.conf'
269 (self.root / 'Public').mkdir()270 source.write_text(Path(shares.__file__).with_name('copyparty.conf').read_text() +
270 self.call('grant.save', id=None, subject=account['subject'], path=str(self.root), permissions='r')271 '\n[/clover/scoped]\n /w/clover/scoped\n accs:\n r: *\n w: @acct\n')
271 config = (self.cfg / 'copyparty.conf').read_text()272 (self.root / 'scoped').mkdir()
272 public = config.split('[/clover/Public]')[1].split('[/logs]')[0]273 with patch.object(shares, 'configuration', partial(shares.configuration, source=source)):
273 self.assertIn('r: *\n', public)274 account = self.call('account.create', name='Scoped')['account']
274 self.assertIn('w: @acct,-' + account['username'], public)275 config = (self.cfg / 'copyparty.conf').read_text()
275 self.assertIn('r: ' + account['username'], public)276 scoped = config.split('[/clover/scoped]')[1]
276 logs = config.split('[/logs]')[1]277 self.assertIn('r: *,-' + account['username'], scoped)
277 self.assertIn('g: *,-' + account['username'], logs)278 self.assertIn('w: @acct,-' + account['username'], scoped)
278 manager = shares.Manager(self.users)279 self.call('grant.save', id=None, subject=account['subject'], path=str(self.root), permissions='r')
279 manager.data = json.loads((self.cfg / 'manager.json').read_text())280 config = (self.cfg / 'copyparty.conf').read_text()
280 manager.items = self.variable['Items']281 scoped = config.split('[/clover/scoped]')[1]
281 manager.owner_permissions(account['username'], self.root / 'Public', 'r')282 self.assertIn('r: *\n', scoped)
282 with self.assertRaises(shares.Error):283 self.assertIn('w: @acct,-' + account['username'], scoped)
283 manager.owner_permissions(account['username'], self.root / 'Public', 'w')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
285 def test_admin_can_retarget_other_owner_with_destination_permissions(self):294 def test_admin_can_retarget_other_owner_with_destination_permissions(self):
286 destination = self.root / 'other'295 destination = self.root / 'other'
tools/copyparty.md+1
...@@ -4,6 +4,7 @@ Snowglobe's admin Shares page manages native public links and separate API...@@ -4,6 +4,7 @@ Snowglobe's admin Shares page manages native public links and separate API
4accounts. A person's page assigns folder permissions. Existing Copyparty4accounts. A person's page assigns folder permissions. Existing Copyparty
5permissions remain additive; changing a folder is an explicit retarget or move5permissions remain additive; changing a folder is an explicit retarget or move
6action. New shared folders default to `Share/Name - Description` under Clover.6action. New shared folders default to `Share/Name - Description` under Clover.
7The legacy `clover/Public` mount is retired; use managed links and grants.
78
8Copyparty owns its native `cfg/copyparty/shares.db` and selected-file records.9Copyparty owns its native `cfg/copyparty/shares.db` and selected-file records.
9`cfg/manager.json` stores API account labels, UUID-based folder grants, and link10`cfg/manager.json` stores API account labels, UUID-based folder grants, and link