stack/apps
Bilal Godil 36d00f2c4d test(e2e): add full SAML SP-initiated round-trip tests via mock IdP
apps/e2e/tests/backend/endpoints/api/v1/auth/saml/round-trip.test.ts
exercises the entire SP-initiated flow against the running mock IdP on
port 8115:

  GET /auth/saml/login → IdP URL with SAMLRequest
  POST mock /idp/[tenant]/login → auto-POST HTML with signed SAMLResponse
  POST /auth/saml/acs → backend verifies + issues OAuth code

Five test cases:

1. Happy path: new user JIT-created, ACS responds with 303/307 + OAuth
   code in the redirect.

2. Wrong audience: mock IdP misbehaves via /test-controls
   { kind: 'wrong-audience' }, backend rejects.

3. Bad signature (cross-tenant forgery): mock signs with another
   tenant's key via { kind: 'bad-signature' }, backend rejects.

4. Expired assertion: NotOnOrAfter in the past via { kind: 'expired' },
   backend rejects.

5. Replay: same SAMLResponse POSTed twice — second attempt rejected
   because SamlOuterInfo was consumed by the first ACS call.

Fetches the mock IdP's cert at test setup time so the SAML
verification chain is real (the mock regenerates keys per startup, so
hardcoded certs would never match).

Test integrity reaffirmed: the test file imports only from helpers,
backend-helpers, and ports — NO imports from apps/backend/src/saml/.
Negative cases come from the mock deliberately misbehaving, never from
injecting bad data into the backend's own validator. Mock IdP uses
samlify; backend uses @node-saml/node-saml — different libraries on
each side mean a bug in either surfaces as a test failure rather than
canceling out.

Tests written and lint/typecheck clean; runtime verification needs the
backend + mock-saml-idp services up (CI workflow already wired).
2026-04-29 16:47:17 -07:00
..
backend fix(saml): harden route guards and accept Response-level signature 2026-04-29 16:46:22 -07:00
dashboard fix(dashboard): UI bug fixes (#1377) 2026-04-28 18:49:28 -07:00
dev-launchpad chore: update package versions 2026-04-20 19:06:56 -07:00
e2e test(e2e): add full SAML SP-initiated round-trip tests via mock IdP 2026-04-29 16:47:17 -07:00
hosted-components chore: update package versions 2026-04-20 19:06:56 -07:00
internal-tool Dashboard: DataGrid refactor + layout (stacked on overview-revamp) (#1338) 2026-04-27 13:50:24 -07:00
mock-oauth-server fix(emulator): move mock OAuth off 8114 to avoid pnpm dev conflict (#1385) 2026-04-27 09:39:34 -07:00
mock-saml-idp feat(mock-saml-idp): scaffold mock SAML 2.0 IdP for SAML SSO testing 2026-04-29 16:38:03 -07:00
oauth-mock-server In-source unit tests (#429) 2025-02-14 11:47:52 -08:00