Enforce permissions in API guards and retire interim access #52
Labels
No Label
area:auth
area:docs
area:export
area:ops
area:storage
area:supply-chain
auth
backend
blocked
collab
deployment
docs
effort:L
effort:M
effort:S
frontend
plugins
qa
vs-nfd
vs-nfd:blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: stwaidele/dorfteich#52
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Every route must pass through the real permission guard; the M2 interim service is deleted.
Scope
Implement the Nest
PermissionGuard+ decorators (@RequiresPondRole('reader'|'editor'|'pond_admin'), page-level variants) loading grants+labels efficiently (per-request cache; per (user,pond) cache with invalidation on grant/label change), apply to every existing route (ponds, pages, files, labels, search, versions, trash), deleteInterimAccessService, and add grant CRUD endpoints (/ponds/:id/grants) guarded by pond_admin.Acceptance criteria
InterimAccessServiceis gone; all routes carry an explicit permission decorator (lint rule or test enumerating routes)Technical notes
Dependencies
Depends on #51.
Size: ~2 days
Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add
deanden), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.Implemented in
0c6494f, pipeline fully green (CI + CD: Test deploy, smoke, Int promotion), verified live on Test and Int.Acceptance criteria:
InterimAccessServiceis gone —grep -rn InterimAccessService apps packagesover source is empty; the service file is deleted. Every route now carries an explicit access declaration (@RequiresPondRole/@RequiresPagePermission/@RequiresAttachmentPermission/@AuthenticatedOnly/@Public/ Site-Admin guard), enforced by the newPermissionGuard, and the route-enumeration testroute-permissions.e2e.db.test.tsfails CI for any future route without one.permissions.e2e.db.test.ts): reader cannot edit (403 on readable pages, per the documented 404/403 policy), editor cannot manage members/labels/settings (403), a second pond admin can, foreign users see 404 consistently (pond, page, grants, trash, pond list). Also covered: label-scope deny beating pond-scope allow,authenticated-subject grants, trash gated on write capability, ro/rw collab tokens, personal-pond admin rules.pond_access_changedfor the collab server (#39/#53).audit: grant created/audit: grant deletedwith pond, subject, role, scope, effect, and acting user.Also in this change: grant CRUD under
/ponds/:id/grants(pond_admin-gated) with referential validation (grant_scope_not_found/grant_subject_not_found) and last-admin protection (grant_last_admin, de+en); owner Pond-Admin grants backfilled by migration20260709140000_owner_admin_grantsand created transactionally with every new pond; page lists, search, backlinks, phantom links, and trash listings filtered per page through the shared resolver; 404/403 policy documented in the architecture README conventions.Live verification: after the deploy, all ponds on Test and Int carry their owner's
pond_admingrant (migration backfill), the grants endpoint is pond_admin-gated, and pond visibility follows grants (fixture-user sees only their pond; site admin sees all).