Skip to content

feat(gateway): ct gateway proxy --simulate (read as another person) - #213

Open
2000game wants to merge 1 commit into
mainfrom
feat/gateway-proxy-simulate
Open

2000game wants to merge 1 commit into
mainfrom
feat/gateway-proxy-simulate

Conversation

@2000game

Copy link
Copy Markdown
Member

What

Teaches ct gateway proxy the gateway's GET /simulate/<personId>/api/... route (gateway side: eqrm/eqrm-infra#164, #176).

  • --simulate (opt-in) and --simulate-profile (default eqrm-ct-simulate). Without the flag /simulate is denied locally as before; the deny reason names the flag.
  • Filter: with the flag, additionally allows only GET /simulate/<digits>/api/... (no 0, no leading zero, normalized, same query handling and login_token stripping). Everything else under /simulate and all non-GET stay denied.
  • Two credential sets: /simulate/... is signed with the simulate role, everything else with the reader role. The simulate role asks for the MFA code at startup (fails fast); MFA itself is enforced by the role's trust policy.
  • Expiry: the simulate creds use the same cachingCredentials as the reader, so the next /simulate request after expiry re-prompts for an MFA code on the proxy terminal (that request waits). /api is unaffected.
  • Log lines of simulated requests carry [simulate person <id>].
  • Docs: docs/gateway.md (flag, profile block, MFA by trust policy, admins can't be simulated, one simulation per ChurchTools session, measured 2026-11-09). Fixed the stale "reader role with MFA" comment in src/env/envs.ts.

Tests

Filter (allowed/denied shapes), per-route credential selection, no-flag unchanged, expiry re-prompt. format:check, lint, typecheck clean; vitest run tests/gateway: 3 files, 57 tests passed; docs-staleness current. No live MFA test (needs a real code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant