Skip to content

[#1221] e2e characterization tests for OIDC checkSession and endSession - #1234

Merged
maximthomas merged 7 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oidc-session
Nov 17, 2026
Merged

maximthomas merged 7 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oidc-session

Conversation

@maximthomas

@maximthomas maximthomas commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Why

#1221 (a step of #1075) pins the HTTP contract of /oauth2 with e2e tests that pass on master, where Restlet still serves /oauth2. The endpoint families then move to CHF one PR at a time. A test that passes unchanged after a move is that PR's parity proof, and any expectation a move changes must be a divergence listed in that PR.

This is the second part of #1221: the OIDC session endpoints connect/checkSession and connect/endSession. The first part, #1222, covered discovery, connect/jwk_uri, id_token issuance and idtokeninfo. This PR adds no production code.

What

  • e2e/oauth2/oidc-test.spec.mjs: 13 tests in two new describes, OIDC checkSession (7) and OIDC endSession (6). The file grows from 11 to 24 tests.
  • e2e/common/oauth2-fixtures.mjs: the fixtures they need.

The 13 tests are lines 204-599 of e2e/oauth2/oidc-test.spec.mjs at maximthomas/OpenAM@59a89d07cc, the parent of bccbc9c4d9, which moved /oauth2 to CHF on the abandoned features/restlet-migration branch of the fork. They are the 13 tests #1222 left for this PR. On the branch they sat in two describes, OIDC session endpoints (3 tests) and the "5-E3" contract lock (10 rows); here they are grouped by endpoint, and the row numbers and the branch's plan references are gone from the titles and comments.

Test here Branch test
/oauth2/connect/checkSession serves the session-management iframe same title
the bare path is the JSP and the realm-prefixed path is the Restlet page row 6
checkSession answers GET and POST identically row 6b
an id_token in the Referer supplies the client's origin row 6c
an unusable id_token in the Referer leaves the origin empty row 6d
a client without a clientSessionURI leaves the origin empty row 6e
checkSession answers a display other than page with a 400 row 7
/oauth2/connect/endSession requires an id_token_hint same title
/oauth2/connect/endSession accepts a valid id_token_hint same title
a registered post_logout_redirect_uri redirects, with the state in the query row 8
an unregistered or relative post_logout_redirect_uri is a 400 row 9
a malformed id_token_hint or an unparsable post_logout_redirect_uri is a 400 row 10
PUT on checkSession and endSession is a 405 that names the allowed methods row 11

Fixtures

  • POST_LOGOUT_REDIRECT_URI (http://app.invalid/logout) and POST_LOGOUT_REDIRECT_URI_WITH_QUERY (http://app.invalid/logout?ui=1): ensureOidcClient registers both as the client's post-logout redirect URIs. endSession accepts a post_logout_redirect_uri only when the registered set contains it exactly, so the variant with a query is registered on its own.
  • CLIENT_SESSION_URI (http://rp.invalid): ensureOidcClient registers it as the client's clientSessionURI, the origin the checkSession page accepts postMessage calls from.
  • ensureNoSessionUriOidcClient: a confidential client without a clientSessionURI, as the admin API creates one by default. It shares OIDC_CLIENT_SECRET, so a test can sign an HS256 id_token for it locally that passes checkSession's signature check.

oidcSession logs demo in and runs the authorization_code flow for an id_token. The checkSession describe calls it once; the endSession tests call it once per request that carries a valid id_token_hint, 8 times in all.

Changed expectations

The branch file as is (its 20 tests: the 7 of #1222 and these 13), run against master: 17 passed and 3 failed, twice on one container. All three answers changed on master in d8cb3dac7c (GHSA-6f8c-crwq-jqm3), which made CheckSession render the page for an id_token it cannot use instead of throwing, and made endSession reject an unparsable hint itself:

  • an unusable id_token in the Referer leaves the origin empty (row 6d). Branch: 400 server_error JSON for an id_token without aud, with an unknown aud, and for a malformed one. Master: 200 text/html;charset=UTF-8, the page with var clientURI = ""; and var validSession = false;, for all three.
  • a client without a clientSessionURI leaves the origin empty (row 6e). Branch: 400 server_error JSON. Master: 200, the same page.
  • a malformed id_token_hint or an unparsable post_logout_redirect_uri is a 400 (row 10). Branch: 400 server_error with Restlet's "Internal Server Error (500) - ..." text, for a malformed hint with the registered URI and for the same hint with an unparsable URI. Master: 400 {"error":"bad_request","error_description":"The id_token_hint is not a valid signed JWT"} for both. A new case sends a valid hint with the unparsable URI, and master answers 400 {"error":"redirect_uri_mismatch","error_description":"The redirection URI provided does not match a pre-registered value."}.

Framework values no longer pinned

  • Row 6: Server: Restlet-Framework/2.4.4 on the Restlet page and its absence on the JSP.
  • Row 7: error_description of the 400 (Bad Request (400) - Server can not serve the content of authorization page for popup, touch and wap; Internal Server Error (500) - ... for an unknown value): Restlet's status text. The status, the exact Content-Type, the member set (error, error_description) and error (server_error) stay pinned.
  • Row 11: the CREST body of the 405 ({"code":405,"reason":"Method Not Allowed","message":...}), its Content-Type and its missing cache headers. The status and Allow stay pinned: GET, POST for checkSession and GET for endSession, compared as a set because Restlet lists them in reflection order.

Assertions tightened beyond the branch

All values were recorded from master.

  • Content-Type is asserted exactly on every answer with a body: text/html;charset=UTF-8 for every page, and application/json without a charset for every endSession error and the display 400. The branch checked it exactly only on the two pages of row 6 and on display=page, with toContain on the iframe and the JSON errors, and not at all on rows 6b and 6c and the missing-hint error.
  • The endSession errors compare the whole body (requires an id_token_hint, row 9, row 10). The branch checked error and error_description field by field.
  • Row 6: neither checkSession page carries X-Frame-Options. The relying party frames this page, and SecurityHeaders excludes /connect/checkSession.
  • Row 6b: the GET answers 200 too, not only the POST.
  • Row 6e: a control comes first. An id_token signed the same way for the client that has a clientSessionURI gets that origin, so the empty origin of this row is the registration's. A token the signature check refused would get the same empty-origin page.
  • Row 7: display=bogus joins the loop with popup, touch and wap, and display=page must answer the same page as no display at all.
  • Row 8: the branch accepted either %2F or a bare / for the slash in state, because its CHF port encoded it differently. Master answers http://app.invalid/logout?state=st%20ate%2F1, and that exact Location is pinned. A move that changes it lists the change.
  • Row 10: the malformed hint is also sent with a relative URI. It gets the same answer with the registered, the relative and the unparsable URI, although refusing the last two needs no client: the hint is verified before the redirect URI is read. A move that checks the URI first lists the change.

Defects pinned as master answers them

Each carries a comment that names the target.

  • The JSP on the bare path emits var validSession = "false";, a quoted string, so !validSession is false and the page reads the session cookie even when the session is not valid. Target: var validSession = false;, as the Restlet page under realms/ already emits it. The branch pinned the same value.
  • A display other than page answers 400 server_error. check_session_iframe has no display parameter in OpenID Connect Session Management 1.0; Restlet resolves one as for an authorization page and fails. Target: 200 with the same page as without the parameter.

How it was checked locally

The image was FROM openidentityplatform/openam:latest with the WAR replaced, configured the way build-docker configures it (embedded stores locally; CI uses an external OpenDJ user store). The WAR is a local full build of master 3b050dcd99. Since then master has changed nothing under any module's src/main except openam-documentation.

  • The branch file as is: 17 passed and 3 failed, twice on one container. The 3 are listed under "Changed expectations".
  • This spec (24 tests), twice on one container: 24 passed in both runs.
  • Production mutants, compiled from master's sources and patched into copies of the WAR. Each WAR ran the spec twice on one container, with the same red set in both runs:
WAR Mutation Tests turned red
1 EndSession.doCatch calls the 4-argument ExceptionHandler.handle, the error-page overload; in this resource it answers a 500 /oauth2/connect/endSession requires an id_token_hint, a registered post_logout_redirect_uri redirects, with the state in the query, an unregistered or relative post_logout_redirect_uri is a 400, a malformed id_token_hint or an unparsable post_logout_redirect_uri is a 400
1 EndSession.validateRedirect checks the client's redirection URIs instead of its post-logout redirect URIs (masked by the 500 above)
1 CheckSession as it was before d8cb3dac7c an unusable id_token in the Referer leaves the origin empty, a client without a clientSessionURI leaves the origin empty
1 OpenIDConnectCheckSessionEndpoint without @Post checkSession answers GET and POST identically, PUT on checkSession and endSession is a 405 that names the allowed methods
2 EndSession.validateRedirect checks the client's redirection URIs, and a request without post_logout_redirect_uri answers 200 {} instead of 204 /oauth2/connect/endSession accepts a valid id_token_hint (200), a registered post_logout_redirect_uri redirects, with the state in the query (400 redirect_uri_mismatch), an unregistered or relative post_logout_redirect_uri is a 400 (302 for REDIRECT_URI)
3 CheckSession.getClientSessionURI answers "" for a usable id_token an id_token in the Referer supplies the client's origin, a client without a clientSessionURI leaves the origin empty (its control)
4 EndSession parses post_logout_redirect_uri before it verifies the hint a malformed id_token_hint or an unparsable post_logout_redirect_uri is a 400 (redirect_uri_mismatch for the unparsable URI)
5 EndSession checks that a post_logout_redirect_uri it can parse is absolute before it verifies the hint a malformed id_token_hint or an unparsable post_logout_redirect_uri is a 400 (relative_redirect_uri for the relative URI)

WAR 1: 8 failed, 16 passed. WAR 2: 3 failed, 21 passed. WAR 3: 2 failed, 22 passed. WAR 4 and WAR 5: 1 failed, 23 passed. The 11 tests of #1222 stayed green under all five.

Three tests stay green under every mutant, because what they catch lies outside these classes: the iframe test catches an unmapped JSP (404), the JSP/Restlet test a web.xml that sends the bare path to Restlet (an absolute script src and an unquoted flag), and the display test a page that ignores display (200).

  • Shared server: every spec under e2e/oauth2, e2e/uma and e2e/xacml together, twice on one fresh container: 94 passed in both runs (oidc 24, oauth2-test 5, device-flow-test 9, webfinger 19, uma 14, xacml 23). No master spec turned red next to this one.

Tests for /oauth2 behaviour that neither the branch nor this spec covers are #1223.

Part of #1221.

@maximthomas maximthomas added enhancement javascript Pull requests that update Javascript code oauth2 OAuth2 / OpenID Connect tests Test suite: coverage, fixtures, or test infrastructure labels Nov 12, 2026
@maximthomas
maximthomas marked this pull request as ready for review November 12, 2026 11:43
@maximthomas
maximthomas requested a review from vharseko November 12, 2026 11:43

@vharseko vharseko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #1234 at 1171ada, including the PR description and the scope defined in #1221, #1223, and #1075.

No actionable findings. The added tests and fixtures are consistent with the current Restlet handlers and the stated characterization scope.

Validation: both changed JavaScript files pass node --check, and the patch passes git apply --check --whitespace=error. The build-docker CI job passed for this commit, including both Playwright stages. I did not rerun the live e2e suite locally.

@maximthomas
maximthomas changed the base branch from master to features/1075-remove-restlet November 16, 2026 10:52
@maximthomas
maximthomas merged commit 22c3d74 into OpenIdentityPlatform:features/1075-remove-restlet Nov 17, 2026
11 checks passed
@maximthomas
maximthomas deleted the features/1075-e2e-oidc-session branch November 17, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement javascript Pull requests that update Javascript code oauth2 OAuth2 / OpenID Connect tests Test suite: coverage, fixtures, or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants