front door: the auth gate learns to redirect a browser to the IdP — then the files route gets gated #363

Closed
opened 2026-08-09 18:18:10 +00:00 by ben · 2 comments
Owner

Follow-up named by ADR 0150 + the drive-arc spec (docs/superpowers/specs/2026-08-09-nextcloud-provision-e2e-design.md (commit c72bff1)).

The auth gate (internal/controlapi/authgate.go) answers 204/401/403 but its docstring's "redirects the browser to the IdP" is unbuilt — Caddy's forward_auth has no handle_response for 401, so any gated browser gets a JSON 401. Build the redirect (and the return trip), then put the files route behind the gate per ADRs 0074/0076 — including the WebDAV exempt-path set (FilesExemptPaths) ADR 0074 describes, which does not exist as code.

Follow-up named by ADR 0150 + the drive-arc spec (`docs/superpowers/specs/2026-08-09-nextcloud-provision-e2e-design.md` (commit `c72bff1`)). The auth gate (`internal/controlapi/authgate.go`) answers 204/401/403 but its docstring's "redirects the browser to the IdP" is unbuilt — Caddy's `forward_auth` has no `handle_response` for 401, so any gated browser gets a JSON 401. Build the redirect (and the return trip), then put the files route behind the gate per ADRs 0074/0076 — including the WebDAV exempt-path set (`FilesExemptPaths`) ADR 0074 describes, which does not exist as code.
Author
Owner

Backlog walk (Ben, 2026-08-12): promoted ready-for-agent — server-side with ADRs 0074/0076 as the contract (browser redirect + return trip, then the files route behind the gate incl. FilesExemptPaths). Also a prerequisite the #388 dashboard-auth design will lean on.

Backlog walk (Ben, 2026-08-12): promoted `ready-for-agent` — server-side with ADRs 0074/0076 as the contract (browser redirect + return trip, then the files route behind the gate incl. `FilesExemptPaths`). Also a prerequisite the #388 dashboard-auth design will lean on.
Author
Owner

close-report for #363 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 363,
  "status": "success",
  "commits": [
    "00903e2"
  ],
  "changed_files": [
    "internal/clan/frontdoor.go",
    "internal/clan/files.go",
    "internal/clan/frontdoor_test.go",
    "internal/clan/files_frontdoor_test.go",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ ./internal/controlapi/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Build the redirect: the auth gate's 401 becomes a browser redirect to the IdP (no more JSON 401)": "internal/clan/frontdoor.go renderGateRedirect adds forward_auth handle_response @unauth (status 401) -> redir https://id.<apex>/ 302; proven by TestRenderFrontDoor_UnauthBrowserRedirectsToIdP",
    "Build the return trip: the redirect carries where the browser was headed so login returns it there": "redir carries rd={http.request.scheme}://{http.request.host}{http.request.uri}; asserted in TestRenderFrontDoor_UnauthBrowserRedirectsToIdP",
    "Put the files route behind the gate per ADRs 0074/0076": "public renderRoute gates every route incl files behind forward_auth http://127.0.0.1:8080 with header_up X-Ourcloud-Service files; proven by TestAttachFrontDoor_FilesDAVPathsBypassTheGate",
    "The WebDAV exempt-path set (FilesExemptPaths) which does not exist as code": "internal/clan/files.go declares FilesExemptPaths (/remote.php/dav*, /remote.php/webdav*, /public.php/dav*); render exempts them from the gate; proven by TestAttachFrontDoor_FilesDAVPathsBypassTheGate and TestFilesExemptPaths_CoverTheDAVProtocol"
  },
  "summary": "The gated forward_auth template now redirects an unauthenticated browser to the IdP carrying its return destination, and the files port declares FilesExemptPaths so DAV sync bypasses the gate while browser entry stays gated (ADR 0074/0076/0150).",
  "blockers": []
}
**close-report** for #363 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 363, "status": "success", "commits": [ "00903e2" ], "changed_files": [ "internal/clan/frontdoor.go", "internal/clan/files.go", "internal/clan/frontdoor_test.go", "internal/clan/files_frontdoor_test.go", "STATUS.md" ], "tests": [ { "command": "go test ./internal/clan/ ./internal/controlapi/", "exit_code": 0 } ], "criteria": { "Build the redirect: the auth gate's 401 becomes a browser redirect to the IdP (no more JSON 401)": "internal/clan/frontdoor.go renderGateRedirect adds forward_auth handle_response @unauth (status 401) -> redir https://id.<apex>/ 302; proven by TestRenderFrontDoor_UnauthBrowserRedirectsToIdP", "Build the return trip: the redirect carries where the browser was headed so login returns it there": "redir carries rd={http.request.scheme}://{http.request.host}{http.request.uri}; asserted in TestRenderFrontDoor_UnauthBrowserRedirectsToIdP", "Put the files route behind the gate per ADRs 0074/0076": "public renderRoute gates every route incl files behind forward_auth http://127.0.0.1:8080 with header_up X-Ourcloud-Service files; proven by TestAttachFrontDoor_FilesDAVPathsBypassTheGate", "The WebDAV exempt-path set (FilesExemptPaths) which does not exist as code": "internal/clan/files.go declares FilesExemptPaths (/remote.php/dav*, /remote.php/webdav*, /public.php/dav*); render exempts them from the gate; proven by TestAttachFrontDoor_FilesDAVPathsBypassTheGate and TestFilesExemptPaths_CoverTheDAVProtocol" }, "summary": "The gated forward_auth template now redirects an unauthenticated browser to the IdP carrying its return destination, and the files port declares FilesExemptPaths so DAV sync bypasses the gate while browser entry stays gated (ADR 0074/0076/0150).", "blockers": [] } ``` </details>
ben closed this issue 2026-08-12 16:55:14 +00:00
Sign in to join this conversation.
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
Matou/idss#363
No description provided.