Skip to content

[#1221] Add device display characterization tests - #1238

Open
maximthomas wants to merge 2 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-display-device
Open

maximthomas wants to merge 2 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-display-device

Conversation

@maximthomas

Copy link
Copy Markdown
Contributor

Part of #1221.

Add the three device display scenarios from b02024a4f0:e2e/oauth2/display-test.spec.mjs on top of merged b3a (#1237). The incremental diff is 141 additions / 1 deletion (142 changed lines) and touches only e2e/oauth2/display-test.spec.mjs: a separate consent-requiring device client, two helpers, and three tests. All nine merged authorize tests remain unchanged, giving twelve display tests in total. Production code, shared fixtures, workflows and existing device-PKCE coverage are unchanged.

The consent scenario retains all four display variants (page, popup, touch, wap). For the three XUI templates it verifies the client identity, response type, scope, nonempty CSRF, user code and form target. For WAP it verifies the corresponding existing hidden submission fields and form action. The code-entry scenario checks all five display values, including bogus, and compares the complete HTML after masking only freshly generated CSRF values.

Changed expectations from the source

Check Source Current Restlet contract Reason
Reach device consent GET with user_code and display in the query, expecting 200 POST user code and CSRF in the form body with a session cookie; display stays in the query Source GET returns 303 without processing the code. The POST follows the actual code-entry form.
Consent post-back target Includes user code in the query Contains only display; XUI carries the code as pageData.userCode The body-only user code does not become part of the query target.
Unknown consent display 400 invalid_request, exact enum description Non-redirecting 400 HTML server_error; error-page title and error code retained, description omitted The current renderer failure reaches the generic exception handler. #1221 excludes framework error descriptions.
Entry-page HTML equality Unmasked byte equality across displays Equality after masking only the fresh CSRF property; a nonempty token is required on every page Each render generates a different CSRF token. Display does not change the entry template.

Pinned defects

  • Touch renders the client name as isplayName and omits displayName. Target: displayName.
  • Unknown consent display returns 400 server_error. Target: 400 invalid_request.
  • The WAP consent action carries only display and the template has no hidden user_code, so its next consent submission loses the code. Target: a hidden user_code body field. This characterization explicitly requires the current absence; it does not fix the template.

Validation

Test commit: e7f0c535e1f4d1969151a0d2aba77960e070c760.
Integration base: 57825f6732dd04bdd4ae6aafabb2d0a31cd7539b.

Server WAR source: 097005086e3113fcd81c382f4aa080ec2f823cf4, successful Build run 43852682205, ubuntu-latest-11 artifact 14222035312. Only e2e files differ between that source and the integration base, establishing production-source equivalence. The complete nested server WAR was verified against its archive entry size and CRC; the full outer archive digest was not checked.

WAR SHA256: 39599c6caf586b5e31b4971a76548b135eaaa20b9c99ec57e148f55cf0718cde.

Local validation uses one OpenAM container with embedded OpenDJ. The temporary runner emits login success labels without token bytes; traces and screenshots are disabled and a local reporter suppresses existing secret-bearing diagnostics. New secret/HTML assertions compare booleans and retain useful labels. Five deliberately failing matchers using the actual added assertion lines confirmed that user-code, CSRF and complete-HTML sentinels are absent from captured assertion errors.

Source-contract recording with diagnostic-only sanitization preserved all three source requests, payloads and expected contract values. Both runs executed all three scenarios: 0 passed / 3 failed / 0 skipped. The first failures were consent GET expecting 200 but receiving 303, unknown-display GET expecting 400 but receiving 303, and unmasked entry-page equality expecting true but receiving false after five 200 responses. Raw HTML matchers and secret-bearing logs/errors were sanitized without masking contract differences.

Run Passed Failed Skipped
Full display spec, each of two runs on one fresh stand 12 0 0
Restored shared oauth2 uma xacml, each of two runs on one fresh stand 132 0 0
Ignore-display product mutant 5 7 0
Device-consent-only missing-CSRF product mutant 11 1 0
Display-dependent code-entry template product mutant 11 1 0

The ignore-display mutant fails the five existing authorize checks for popup, touch, WAP, unknown display and case normalization. Device consent passes its page leg then fails popup's lowercase-doctype predicate; unknown device display fails expected 400 versus received 200. Entry rendering remains green. The missing-CSRF mutant returns 200 consent HTML but fails the exact CSRF-presence boolean; all authorize, unknown-display and entry scenarios stay green. Deployed module hashes were verified against each mutant WAR.

The entry-template mutant routes only popup through a separate code-entry template, preserving the default entry page. All five responses retain their expected status and shell markers; the CSRF-masked HTML equality fails. Only the entry scenario is red. This mutates the product routing/template selection rather than inverting a test assertion.

After restoring the original WAR, oauth2 uma xacml ran twice on one fresh embedded stand: 132 passed / 0 failed / 0 skipped in each run, including all twelve display tests and all existing device-PKCE tests. The restored deployed OAuth2 module hash matches the original WAR. Discovery confirms 132 tests in nine files, superseding the plan's older counts.

node --check, test discovery, git diff --check, incremental changed-line budget and independent code review passed. No review findings remain. All nine authorize tests are unchanged. No temporary specs or production mutations are present in the repository.

The remaining b4/b5 ports and #1221's formal master acceptance condition remain outstanding. This PR completes the device slice of b3; it does not close #1221. PR-specific Build/build-docker validation is pending; no CodeQL result is claimed for this integration base.

@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 17, 2026
@maximthomas
maximthomas marked this pull request as ready for review November 17, 2026 12:25
@maximthomas
maximthomas requested a review from vharseko November 17, 2026 12:25

@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.

[P2] Check the device consent model inside the popup container

e2e/oauth2/display-test.spec.mjs:408

The popup assertions search the entire response, but popup.ftl copies only #print into the opened window. A device-specific rendering regression that leaves the consent model outside that container therefore passes every check here while the popup opens without the consent form and cannot submit the user code. The existing /authorize test checks the container, but it cannot detect a regression limited to the device response. Please parse the device popup's #print content and check that it contains the consent model, including the matching user code and form target.

@maximthomas

Copy link
Copy Markdown
Contributor Author

@vharseko, addressing this review.

Updated in fc0f24618e: the device popup test now parses #print inertly and checks the consent model inside that container, including the matching userCode and formTarget, client identity, response type, scope, and nonempty CSRF.

A focused FreeMarker/Chromium probe passes the normal templates and rejects nine container mutations; the previous assertions accepted all nine. Live OpenAM e2e validation has not been rerun because Docker Desktop was unavailable during local validation.

@maximthomas
maximthomas requested a review from vharseko November 17, 2026 13:09

@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.

The device popup assertions now inspect the consent model inside #print, including the matching user code and form target. This addresses my previous finding. I found no further issues in the fix.

I verified the parsing behavior with a focused Chromium probe. I did not rerun the live OpenAM e2e suite; the PR checks are still running.

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