owncloud: extend skill from read-only audit to full occ management

Layer gated admin writes onto the read-only GPS-audit skill, driven through
occ over SSH (same paramiko/vault/filecache plumbing):

- user lifecycle (add/delete/enable/disable/reset-password/modify), quota
  get/set/reset, groups (create/delete/members), read-only share listing
  (from oc_share; occ has no share create/list), apps, system config,
  maintenance mode, files scan, ownership transfer, trashbin/versions cleanup.
- All writes gated behind --confirm (refuse -> rc 3); hard-fail guards (rc 2)
  for invalid uid, missing password, and all-users cleanup with no target.
- --all-users trashbin/versions purge now ALSO requires --force-all-users in
  addition to --confirm, so a single stray --confirm cannot trigger an
  irreversible fleet-wide purge.

Built against the verified live occ surface (occ list / occ help), not guessed
flags. Fixes from code-review + security-review: Python-side share filtering
(no MySQL SQL-injection via '' -doubling), occ reads no longer mask a failed
read as healthy (maintenance/quota/config), guarded json.loads, clean --json
output, and '--' end-of-options guards so dash-leading uids can't be parsed as
occ flags. dry_test.sh added as a non-destructive regression harness (43 checks).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-05 20:52:25 -07:00
parent 3d8aa2be59
commit da6567ffe0
3 changed files with 19 additions and 4 deletions

View File

@@ -50,6 +50,9 @@ chk 2 "user-modify no fields" -- py "$OC" user-modify zz.dry --confirm
chk 2 "files-scan no target" -- py "$OC" files-scan --confirm
chk 2 "trashbin-cleanup no target"-- py "$OC" trashbin-cleanup --confirm
chk 2 "versions-cleanup no target"-- py "$OC" versions-cleanup --confirm
# --all-users must NOT execute on --confirm alone (needs --force-all-users) -> rc 2
chk 2 "versions --all-users no force" -- py "$OC" versions-cleanup --all-users --confirm
chk 2 "trashbin --all-users no force" -- py "$OC" trashbin-cleanup --all-users --confirm
echo "== read-only commands must succeed (rc 0) =="
chk 0 "status" -- py "$OC" status