invite-member: assertMemberIsNotAdmin ignores HTTP status, reds a correct 403 denial #765

Closed
opened 2026-08-25 02:03:40 +00:00 by matou-build-agent · 2 comments

Verdict: harness defect, not product. The drive went 24 green / 1 skip / 1 red. pair is green (135 ms), so this is not the known own-VPS carrier frontier — that frontier only accounts for the backup-honest-floor skip, whose reason line says so explicitly ("carrier landed (own-VPS, ADR 0152 · #383/#384); reachable once its Stage-3 assertions plan lands").

The failure

artifacts/legs.json:

{"leg":"invite-member","status":"red","ms":9916,
 "error":"member landed cleanly on /settings/admin (HTTP 403, url \"https://files.rehearsal-b.idss.nz/settings/admin\") with no redirect and no access-denied marker — a plain member must never reach the admin screen (DDR 0173 story 11, story 4)"}

The error message quotes the proof that the product behaved correctly. HTTP 403 is the denial. The assertion interpolates the status into its own failure text but never gates on it.

The defect

app/tests/e2e/fixtures/provision.ts:858-881 — assertMemberIsNotAdmin:

const landedUrl = page.url();
const redirectedAway = !landedUrl.endsWith('/settings/admin');
const deniedMarker = page.locator('#body-status, .error');
const denied = (await deniedMarker.count()) > 0;

if (!redirectedAway && !denied) {
  throw new Error(
    `member landed cleanly on /settings/admin (HTTP ${resp?.status() ?? '(no response)'}, ` + ...

Only two denial signals are accepted: redirect-away, or a #body-status/.error DOM node. Nextcloud 32 refuses a signed-in non-admin with a bare 403 at the same URL, rendered from a guest error template that carries neither.

The docstring states the wrong premise outright (provision.ts:850-851):

* signed-in plain member still gets an authenticated 200 at /settings/admin
* (Nextcloud does not 401 a logged-in session), but must NOT actually reach

The asymmetry is the tell. The positive twin assertOperatorIsAdmin does gate on status (provision.ts:814-822):

// Unauthenticated, Nextcloud serves /settings/admin as a plain 401 at the
// SAME URL with none of the denial markers below — drive 20260810T134228Z
// rode that page to a false green. The status code is the first honest gate.
if (!resp || !resp.ok()) { throw new Error(...) }

The inverse assertion never got the same gate.

Live-droplet corroboration (209.38.91.9 — ssh accepted, read-only)

Role separation on the box is genuinely correct:

$ nextcloud-occ group:list
  - admin:
    - ocadmin
    - operator@id.rehearsal-b.idss.nz
  - e2e-crew:
    - e2e-member@id.rehearsal-b.idss.nz

e2e-member is in e2e-crew only, never in admin. Nothing is broken underneath it:

$ systemctl --failed --no-legend      # (empty)
$ nextcloud-occ status
  - version: 32.0.11.1
  - maintenance: false

And the status codes are three-valued and distinguishable — anonymous is 401, not 403:

$ curl -o /dev/null -w "status=%{http_code}" -H "Host: files.rehearsal-b.idss.nz" \
    http://127.0.0.1:8084/settings/admin
status=401

The member's session was really authenticated before the check ran — logs/droplet-journal.txt:1977:

Aug 25 01:55:57 gateway kanidmd[1069]: ... Issuing Cookie session (privilege_capable)
  4a2503e7-f332-41af-ab46-fd8458d7a3c5 for e2e-member@id.rehearsal-b.idss.nz

and oidcSignInAsMember had already asserted the #header Files landing immediately before (journey.droplet.spec.ts:743-745). So the 403 is not "not signed in" — it is authenticated-and-refused, exactly what DDR 0173 story 11 asks for.

One gap I could not close: I could not re-render the 403 body to observe the missing DOM markers first-hand. e2e-member is OIDC-provisioned and has no local password, so basic auth returns 401 {"message":""} for member and operator alike. The marker absence is inferred from the assertion's own denied === false, not independently re-observed. It does not change the diagnosis — the status alone is decisive.

Suspected layer

Harness (e2e fixture). No product change is warranted. An agent that "fixes" Nextcloud here would be breaking correct authorization.

What plugging it needs

A healer already diagnosed this during the run, and its fix is lost — logs/healer-claude.out:

{"action":"healed","commit":"2f7f3094eaefbce80f2277e8de6f9d1dadff0415",
 "summary":"... the ruling now lives in a pure readMemberAdminDenial that accepts 403
 (and redirect/marker) as denial while still failing loud on 401 (an unsigned-in session
 proves nothing about role) and on an undenied 200."}

That commit is not in the repo — git rev-parse 2f7f3094… → fatal: bad object; git worktree list shows only main; provision.ts's newest commit is still bb9c7005 (#658). The healer's worktree was reclaimed before the work landed. Re-implement it; do not go hunting for the commit.

The fix:

  1. Extract a pure readMemberAdminDenial({ status, landedUrl, markerCount }) returning denied / undenied / inconclusive, so the ruling is unit-testable without a browser.
  2. Accept 403 as denial, alongside redirect-away and the #body-status/.error marker.
  3. Keep failing loud on 401 — an unsigned-in session proves nothing about role (the drive-20260810T134228Z false-green lesson the operator twin already encodes at provision.ts:814-816).
  4. Keep failing loud on an undenied 200 — the real defect this leg exists to catch.
  5. Correct the docstring premise at provision.ts:850-851.
  6. Add the unit test in app/tests/e2e/fixtures/provision.test.ts.

Worth a separate follow-up: a healer reporting "action":"healed" with a commit SHA that no ref anywhere carries is its own hazard — a candidate docs/GOTCHAS.md entry, since it silently converts a diagnosed red into a repeating one.

Absent evidence

  • artifacts/journey.json is {"rows": null, "fault": null} — founding rows were never captured this run. The drive reddened after founding, so there is no row-level evidence either way.
  • logs/guest-*.log all read no SSH hostfwd in /home/dev/.config/systemd/user/idss-guest.service — the guest was never created, so there is nothing to ask, and logs/qemu.log shows no qemu process. Expected — this is the droplet target, not the qemu guest; those probes are inapplicable, not failing.
  • logs/state-logs.log: ERROR: no state logs directory at .../state/logs.
  • logs/helper.log is entirely headless-Electron GLX/ANGLE/D-Bus noise with no bearing on the red; logs/cert-reseed.txt reads reseed: OK.

drive 20260825T014431Z red at invite-member: member landed cleanly on /settings/admin (HTTP 403, url "https://files.rehearsal-b.idss.nz/settings/admin") with no redirect and no access-denied marker — a plain member must never reach the admin s
evidence: test-results/…/20260825T014431Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

**Verdict: harness defect, not product.** The drive went 24 green / 1 skip / 1 red. `pair` is **green** (135 ms), so this is *not* the known own-VPS carrier frontier — that frontier only accounts for the `backup-honest-floor` **skip**, whose reason line says so explicitly ("carrier landed (own-VPS, ADR 0152 · #383/#384); reachable once its Stage-3 assertions plan lands"). ## The failure `artifacts/legs.json`: ``` {"leg":"invite-member","status":"red","ms":9916, "error":"member landed cleanly on /settings/admin (HTTP 403, url \"https://files.rehearsal-b.idss.nz/settings/admin\") with no redirect and no access-denied marker — a plain member must never reach the admin screen (DDR 0173 story 11, story 4)"} ``` The error message quotes the proof that the product behaved **correctly**. HTTP 403 *is* the denial. The assertion interpolates the status into its own failure text but never gates on it. ## The defect `app/tests/e2e/fixtures/provision.ts:858-881` — `assertMemberIsNotAdmin`: ```ts const landedUrl = page.url(); const redirectedAway = !landedUrl.endsWith('/settings/admin'); const deniedMarker = page.locator('#body-status, .error'); const denied = (await deniedMarker.count()) > 0; if (!redirectedAway && !denied) { throw new Error( `member landed cleanly on /settings/admin (HTTP ${resp?.status() ?? '(no response)'}, ` + ... ``` Only two denial signals are accepted: redirect-away, or a `#body-status`/`.error` DOM node. Nextcloud 32 refuses a signed-in non-admin with a bare **403** at the same URL, rendered from a guest error template that carries neither. The docstring states the wrong premise outright (`provision.ts:850-851`): > `* signed-in plain member still gets an authenticated 200 at /settings/admin` > `* (Nextcloud does not 401 a logged-in session), but must NOT actually reach` The asymmetry is the tell. The positive twin `assertOperatorIsAdmin` **does** gate on status (`provision.ts:814-822`): ```ts // Unauthenticated, Nextcloud serves /settings/admin as a plain 401 at the // SAME URL with none of the denial markers below — drive 20260810T134228Z // rode that page to a false green. The status code is the first honest gate. if (!resp || !resp.ok()) { throw new Error(...) } ``` The inverse assertion never got the same gate. ## Live-droplet corroboration (209.38.91.9 — ssh accepted, read-only) Role separation on the box is genuinely correct: ``` $ nextcloud-occ group:list - admin: - ocadmin - operator@id.rehearsal-b.idss.nz - e2e-crew: - e2e-member@id.rehearsal-b.idss.nz ``` `e2e-member` is in `e2e-crew` only, never in `admin`. Nothing is broken underneath it: ``` $ systemctl --failed --no-legend # (empty) $ nextcloud-occ status - version: 32.0.11.1 - maintenance: false ``` And the status codes are three-valued and distinguishable — **anonymous is 401, not 403**: ``` $ curl -o /dev/null -w "status=%{http_code}" -H "Host: files.rehearsal-b.idss.nz" \ http://127.0.0.1:8084/settings/admin status=401 ``` The member's session was really authenticated before the check ran — `logs/droplet-journal.txt:1977`: ``` Aug 25 01:55:57 gateway kanidmd[1069]: ... Issuing Cookie session (privilege_capable) 4a2503e7-f332-41af-ab46-fd8458d7a3c5 for e2e-member@id.rehearsal-b.idss.nz ``` and `oidcSignInAsMember` had already asserted the `#header` Files landing immediately before (`journey.droplet.spec.ts:743-745`). So the 403 is not "not signed in" — it is authenticated-and-refused, exactly what DDR 0173 story 11 asks for. **One gap I could not close:** I could not re-render the 403 body to observe the missing DOM markers first-hand. `e2e-member` is OIDC-provisioned and has no local password, so basic auth returns `401 {"message":""}` for member and operator alike. The marker absence is inferred from the assertion's own `denied === false`, not independently re-observed. It does not change the diagnosis — the status alone is decisive. ## Suspected layer **Harness** (e2e fixture). No product change is warranted. An agent that "fixes" Nextcloud here would be breaking correct authorization. ## What plugging it needs A healer already diagnosed this during the run, and **its fix is lost** — `logs/healer-claude.out`: ``` {"action":"healed","commit":"2f7f3094eaefbce80f2277e8de6f9d1dadff0415", "summary":"... the ruling now lives in a pure readMemberAdminDenial that accepts 403 (and redirect/marker) as denial while still failing loud on 401 (an unsigned-in session proves nothing about role) and on an undenied 200."} ``` That commit is not in the repo — `git rev-parse 2f7f3094…` → `fatal: bad object`; `git worktree list` shows only `main`; `provision.ts`'s newest commit is still `bb9c7005 (#658)`. The healer's worktree was reclaimed before the work landed. **Re-implement it; do not go hunting for the commit.** The fix: 1. Extract a pure `readMemberAdminDenial({ status, landedUrl, markerCount })` returning denied / undenied / inconclusive, so the ruling is unit-testable without a browser. 2. Accept **403 as denial**, alongside redirect-away and the `#body-status`/`.error` marker. 3. Keep failing loud on **401** — an unsigned-in session proves nothing about role (the drive-20260810T134228Z false-green lesson the operator twin already encodes at `provision.ts:814-816`). 4. Keep failing loud on an **undenied 200** — the real defect this leg exists to catch. 5. Correct the docstring premise at `provision.ts:850-851`. 6. Add the unit test in `app/tests/e2e/fixtures/provision.test.ts`. Worth a separate follow-up: a healer reporting `"action":"healed"` with a commit SHA that no ref anywhere carries is its own hazard — a candidate `docs/GOTCHAS.md` entry, since it silently converts a diagnosed red into a repeating one. ## Absent evidence - `artifacts/journey.json` is `{"rows": null, "fault": null}` — founding rows were never captured this run. The drive reddened after founding, so there is no row-level evidence either way. - `logs/guest-*.log` all read `no SSH hostfwd in /home/dev/.config/systemd/user/idss-guest.service — the guest was never created, so there is nothing to ask`, and `logs/qemu.log` shows no qemu process. **Expected** — this is the droplet target, not the qemu guest; those probes are inapplicable, not failing. - `logs/state-logs.log`: `ERROR: no state logs directory at .../state/logs`. - `logs/helper.log` is entirely headless-Electron GLX/ANGLE/D-Bus noise with no bearing on the red; `logs/cert-reseed.txt` reads `reseed: OK`. drive `20260825T014431Z` red at `invite-member`: `member landed cleanly on /settings/admin (HTTP 403, url "https://files.rehearsal-b.idss.nz/settings/admin") with no redirect and no access-denied marker — a plain member must never reach the admin s` evidence: `test-results/…/20260825T014431Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 1dc3e7a84786 -->
Author
Member

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

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

close-report for #765 — status success

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

envelope
{
  "issue": 765,
  "status": "success",
  "commits": [
    "a9bc6b5"
  ],
  "changed_files": [
    "app/tests/e2e/fixtures/provision.ts",
    "app/tests/e2e/fixtures/provision.test.ts"
  ],
  "tests": [
    {
      "command": "npx vitest run tests/e2e/fixtures/provision.test.ts",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Extract a pure readMemberAdminDenial({status,landedUrl,markerCount}) returning denied/undenied/inconclusive, unit-testable without a browser": "provision.ts: new exported readMemberAdminDenial + MemberAdminDenial type; assertMemberIsNotAdmin now delegates to it",
    "Accept 403 as denial alongside redirect-away and the #body-status/.error marker": "readMemberAdminDenial returns 'denied' for status===403, redirectedAway, or markerCount>0; test 'reads a bare 403 ... as denied'",
    "Keep failing loud on 401 (unsigned-in session proves nothing about role)": "status===401 -> 'inconclusive' -> throw; test 'reads a 401 as inconclusive'",
    "Keep failing loud on an undenied 200 (the real defect this leg catches)": "clean 200/no redirect/no marker -> 'undenied' -> throw; test 'reads a clean 200 ... as undenied'",
    "Correct the docstring premise at provision.ts:850-851": "docstring rewritten: removed the false 'still gets an authenticated 200' claim, states NC32 403s the member",
    "Add the unit test in app/tests/e2e/fixtures/provision.test.ts": "6 tests in describe('readMemberAdminDenial (#765)'); full file 13 tests pass, exit 0"
  },
  "summary": "assertMemberIsNotAdmin now accepts Nextcloud 32's bare 403 as a denial via a pure, unit-tested readMemberAdminDenial ruling, so a correct authorization refusal no longer reds the invite-member leg.",
  "blockers": []
}
**close-report** for #765 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 765, "status": "success", "commits": [ "a9bc6b5" ], "changed_files": [ "app/tests/e2e/fixtures/provision.ts", "app/tests/e2e/fixtures/provision.test.ts" ], "tests": [ { "command": "npx vitest run tests/e2e/fixtures/provision.test.ts", "exit_code": 0 } ], "criteria": { "Extract a pure readMemberAdminDenial({status,landedUrl,markerCount}) returning denied/undenied/inconclusive, unit-testable without a browser": "provision.ts: new exported readMemberAdminDenial + MemberAdminDenial type; assertMemberIsNotAdmin now delegates to it", "Accept 403 as denial alongside redirect-away and the #body-status/.error marker": "readMemberAdminDenial returns 'denied' for status===403, redirectedAway, or markerCount>0; test 'reads a bare 403 ... as denied'", "Keep failing loud on 401 (unsigned-in session proves nothing about role)": "status===401 -> 'inconclusive' -> throw; test 'reads a 401 as inconclusive'", "Keep failing loud on an undenied 200 (the real defect this leg catches)": "clean 200/no redirect/no marker -> 'undenied' -> throw; test 'reads a clean 200 ... as undenied'", "Correct the docstring premise at provision.ts:850-851": "docstring rewritten: removed the false 'still gets an authenticated 200' claim, states NC32 403s the member", "Add the unit test in app/tests/e2e/fixtures/provision.test.ts": "6 tests in describe('readMemberAdminDenial (#765)'); full file 13 tests pass, exit 0" }, "summary": "assertMemberIsNotAdmin now accepts Nextcloud 32's bare 403 as a denial via a pure, unit-tested readMemberAdminDenial ruling, so a correct authorization refusal no longer reds the invite-member leg.", "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.

Reference
Matou/idss#765
No description provided.