front door: strip inbound X-Idss-Identity on service routes' exempt paths (header-trusting services) #1167

Closed
opened 2026-09-02 20:24:26 +00:00 by matou-build-agent · 2 comments

What

The front door must strip inbound X-Idss-Identity on each service route's client-protocol EXEMPT paths, not only on the ungated portal route.

Why (found while porting Grist, #1166)

The data-collections port (Grist) is the first catalogue service that TRUSTS the front door's identity header — it rides forwarded-header auth (GRIST_FORWARD_AUTH_HEADER = X-Idss-Identity) because grist-core's own OIDC needs a full-edition activation key (ruled on #1166 under ADR 0174).

Today (internal/clan/frontdoor.go):

  • the gated handler runs forward_auth and copy_headers X-Idss-Identity, which overwrites any client-supplied value with the gate's verified one — safe;
  • the ungated portal route strips it inbound (header_up -X-Idss-Identity, #1094) — safe;
  • but the exempt-path handler (renderRoute, the handle @<slug>_exempt { ... } block) reverse-proxies straight through with no strip. For every prior port that was harmless (Forgejo/Nextcloud/etc. authenticate exempt API paths with their OWN tokens and ignore the header). For a header-trusting service like Grist, a public caller hitting https://data-collections.<apex>/api/... could forge X-Idss-Identity and be trusted as any user.

This gap is not live today: these container ports are all gated out of P4-S2 selection (provisionCannotDeploy), so no public route yet carries their exempt paths. But the front-door routing work that makes them selectable MUST close it, or it ships the spoofing gap.

Proposed fix

In renderRoute's exempt handler (before/inside renderProxy), emit header_up -X-Idss-Identity (reuse the identityHeader const already in the file), so an exempt-path request reaches the backend with no caller-supplied identity — the same discipline renderPortalRoute already applies. Add a frontdoor render seam test asserting the exempt handler strips it.

Ticket found while working

#1166 (data-collections / Grist port). The port itself does not need the strip yet (gated out of selection); this arms the routing work.

## What The front door must **strip inbound `X-Idss-Identity` on each service route's client-protocol EXEMPT paths**, not only on the ungated portal route. ## Why (found while porting Grist, #1166) The data-collections port (Grist) is the **first catalogue service that TRUSTS the front door's identity header** — it rides forwarded-header auth (`GRIST_FORWARD_AUTH_HEADER = X-Idss-Identity`) because grist-core's own OIDC needs a full-edition activation key (ruled on #1166 under ADR 0174). Today (`internal/clan/frontdoor.go`): - the **gated** handler runs `forward_auth` and `copy_headers X-Idss-Identity`, which **overwrites** any client-supplied value with the gate's verified one — safe; - the **ungated portal** route strips it inbound (`header_up -X-Idss-Identity`, #1094) — safe; - but the **exempt-path** handler (`renderRoute`, the `handle @<slug>_exempt { ... }` block) reverse-proxies straight through with **no strip**. For every prior port that was harmless (Forgejo/Nextcloud/etc. authenticate exempt API paths with their OWN tokens and ignore the header). For a header-trusting service like Grist, a public caller hitting `https://data-collections.<apex>/api/...` could forge `X-Idss-Identity` and be trusted as any user. This gap is **not live today**: these container ports are all gated out of P4-S2 selection (`provisionCannotDeploy`), so no public route yet carries their exempt paths. But the front-door routing work that makes them selectable MUST close it, or it ships the spoofing gap. ## Proposed fix In `renderRoute`'s exempt handler (before/inside `renderProxy`), emit `header_up -X-Idss-Identity` (reuse the `identityHeader` const already in the file), so an exempt-path request reaches the backend with no caller-supplied identity — the same discipline `renderPortalRoute` already applies. Add a frontdoor render seam test asserting the exempt handler strips it. ## Ticket found while working #1166 (data-collections / Grist port). The port itself does not need the strip yet (gated out of selection); this arms the routing work.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=16658
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=16658 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1167 — status success

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

envelope
{
  "issue": 1167,
  "status": "success",
  "commits": [
    "858f3c2ebc273f25f7317d8de181672ca366889d"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/frontdoor.go",
    "internal/clan/frontdoor_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ -run TestRenderFrontDoor",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build/vet/test/golangci-lint ./... (pre-push gate)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Exempt-path handler strips inbound X-Idss-Identity before proxying to the backend": "internal/clan/frontdoor.go renderRoute's exempt handle now calls renderProxy(b, r, 10, true), and renderProxy emits `header_up -X-Idss-Identity` when stripIdentity is set (reusing the identityHeader const)",
    "Gated handler still sets identity from the gate's answer and does not strip": "renderRoute's gated handle passes renderProxy(b, r, 10, false); copy_headers X-Idss-Identity from forward_auth is unchanged",
    "A frontdoor render seam test asserts the exempt handler strips it": "TestRenderFrontDoor_ExemptPathStripsInboundIdentityHeader in internal/clan/frontdoor_test.go — proven red against the pre-fix render, asserts exempt handle strips and gated handle keeps copy_headers without stripping"
  },
  "summary": "The front door's exempt-path handler now strips inbound X-Idss-Identity so a header-trusting service can no longer be spoofed on a public exempt path.",
  "blockers": []
}
**close-report** for #1167 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1167, "status": "success", "commits": [ "858f3c2ebc273f25f7317d8de181672ca366889d" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/frontdoor.go", "internal/clan/frontdoor_test.go" ], "tests": [ { "command": "go test ./internal/clan/ -run TestRenderFrontDoor", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build/vet/test/golangci-lint ./... (pre-push gate)", "exit_code": 0 } ], "criteria": { "Exempt-path handler strips inbound X-Idss-Identity before proxying to the backend": "internal/clan/frontdoor.go renderRoute's exempt handle now calls renderProxy(b, r, 10, true), and renderProxy emits `header_up -X-Idss-Identity` when stripIdentity is set (reusing the identityHeader const)", "Gated handler still sets identity from the gate's answer and does not strip": "renderRoute's gated handle passes renderProxy(b, r, 10, false); copy_headers X-Idss-Identity from forward_auth is unchanged", "A frontdoor render seam test asserts the exempt handler strips it": "TestRenderFrontDoor_ExemptPathStripsInboundIdentityHeader in internal/clan/frontdoor_test.go — proven red against the pre-fix render, asserts exempt handle strips and gated handle keeps copy_headers without stripping" }, "summary": "The front door's exempt-path handler now strips inbound X-Idss-Identity so a header-trusting service can no longer be spoofed on a public exempt path.", "blockers": [] } ``` </details>
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#1167
No description provided.