Share-link policy enforcement — org ceiling, not just defaults (#62) #65

Merged
Cordy merged 2 commits from feat/share-policy into main 2026-07-30 01:18:51 +00:00
Owner

Closes #62. First of the public-sector batch (#59 derived).

Settings store gains three enforced policy fields (all zero-value = today's behavior): shareMaxExpiry (links may not outlive this; "" = no ceiling), shareRequirePassword, shareUploadsForbidden. Validation parity with the existing expiry field.

Enforcement lives in shareCreate right after decode — one chokepoint, so the web dialog, raw REST calls, and anything else hitting POST /api/v1/shares all obey it. Policy violations return 400 with a policy: message.

UI: Settings panel gets the three controls (with a clear "enforced" label vs the existing defaults); the share dialog hides expiry options beyond the ceiling (including "Never"), clamps the default, marks the password field required, and hides the upload checkbox when forbidden — the server remains the enforcement point.

Tests: all four rejection branches + compliant pass-through + zero-value/nil-settings permissiveness + settings validation. gofmt/vet/build/test + node --check on the embedded script green on the runner.

Closes #62. First of the public-sector batch (#59 derived). **Settings store** gains three enforced policy fields (all zero-value = today's behavior): `shareMaxExpiry` (links may not outlive this; "" = no ceiling), `shareRequirePassword`, `shareUploadsForbidden`. Validation parity with the existing expiry field. **Enforcement** lives in `shareCreate` right after decode — one chokepoint, so the web dialog, raw REST calls, and anything else hitting `POST /api/v1/shares` all obey it. Policy violations return 400 with a `policy:` message. **UI**: Settings panel gets the three controls (with a clear "enforced" label vs the existing defaults); the share dialog hides expiry options beyond the ceiling (including "Never"), clamps the default, marks the password field required, and hides the upload checkbox when forbidden — the server remains the enforcement point. Tests: all four rejection branches + compliant pass-through + zero-value/nil-settings permissiveness + settings validation. gofmt/vet/build/test + `node --check` on the embedded script green on the runner.
Cordy merged commit aa0c7b5de4 into main 2026-07-30 01:18:51 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
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#65
No description provided.