Skip to content

[#1221] Add authorize display characterization tests - #1237

Merged
maximthomas merged 5 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-display-authorize
Nov 17, 2026
Merged

maximthomas merged 5 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-display-authorize

Conversation

@maximthomas

@maximthomas maximthomas commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1221.

Scope

Add nine authorize-only display characterization tests, adapting b02024a4f0:e2e/oauth2/display-test.spec.mjs to the current Restlet implementation. They cover page, empty and absent display, popup composition, touch, WML, unknown display, case normalization (including the separate uppercase POPUP wrapper selection), and authentication before display validation.

The spec owns its consent-requiring public client and login session and sends S256 PKCE. Popup checks parse an inert document and require the consent model inside #print, the container copied into the opened window. The WAP form action must preserve the complete HTML-escaped authorize query, including display and PKCE.

The diff is one new spec, 406 additions / 0 deletions. Shared fixtures, existing tests, production code and workflows are unchanged. Device display coverage remains for b3b; the remaining #1221 slices are still outstanding.

Changed expectations from the source

Check Source expectation Observed Restlet contract Reason
Page and touch resource-owner name Literal Demo Demo The resource owner's actual cn, read through the user API and compared after inert HTML entity decoding The embedded store has its own demo entry; consent renders the provider's display-name attribute.
Page formTarget Query with the redirect URI decoded Request path and raw query, retaining percent-encoding of redirect_uri ConsentRequiredResource preserves the request query in its post-back target. The leading JavaScript slash escape is retained.
Unknown display error Non-redirecting 400 HTML invalid_request Non-redirecting 400 HTML server_error Rendering throws after authorization has required consent; the current exception handler wraps that failure as a server error.
Unknown display description Exact enum exception text Description is not pinned Current Restlet supplies framework status text; #1221 excludes framework description artifacts from the contract.

The anonymous source assertions already pass. They are strengthened to parse the login redirect and check its exact origin/path, realm=/, and complete goto; the observed status remains 301.

Pinned defects

  • Touch writes isplayName and omits displayName, leaving the client heading blank. Target: displayName, as in the page and popup templates.
  • Unknown display returns 400 server_error. Target: 400 invalid_request for an invalid parameter value (RFC 6749 section 4.1.2.1).

Validation

Test revision: 66e4097e895e3fc236b9b4047057110c7b69d21f.
Server baseline: integration commit 097005086e3113fcd81c382f4aa080ec2f823cf4.

Local validation used one OpenAM container with embedded OpenDJ. A temporary reporter suppressed secret-bearing output from existing specs, and traces/screenshots were disabled. The latest spec passed all nine display scenarios after restoring the baseline module; the shared oauth2 uma xacml run then passed 106 tests / 0 failed / 0 skipped. Syntax, discovery (106 tests in eight files, including nine display tests), and git diff --check passed.

Four targeted module mutations demonstrate the additional regression coverage. Each mutation was deployed separately; all runs had zero skipped tests:

Mutation Previous spec (passed / failed) Current spec (passed / failed) New check that rejected it
Change only popup wrapper selection from equalsIgnoreCase to equals 8 / 0 8 / 1 Uppercase POPUP retains the wrapper title and consent model
Default to TOUCH only when display is absent, preserving page for display= 8 / 0 8 / 1 Absent display uses the page template
Move intact consent HTML immediately after #print 8 / 0 8 / 1 The popup container contains the consent model
Truncate only the WAP form action after the question mark 8 / 0 8 / 1 WAP preserves the complete authorize query

The Java mutations were compiled with --release 11; the other two changed only templates. Mutations were packaged into temporary OAuth2-module JARs, with deployed SHA256 checked after every restart. The original module was restored and its hash verified before the final green runs. No mutation is committed.

The spec-local Node HTTP/HTTPS transport keeps credentials and consent bodies outside Playwright API steps, sanitizes setup/transport/JSON errors, and does not follow redirects. Response-derived HTML, CSRF, model fields and URL comparisons use boolean assertions. The spec disables retained traces/screenshots and decodes the resource-owner name once through an inert textarea.

Earlier validation at 2c2767115c695e0346f1d83fa2eb173c59b5b3c9 also checked five deliberate failure probes with the normal list/HTML reporters: authentication transport, provider transport, authorize transport, a consent assertion, and an invalid login Location. Synthetic secret markers were absent from stdout, report files, embedded report ZIP data, and generated failure artifacts after the safety fixes. Four synthetic name cases covered apostrophes, ampersands, named/numeric Unicode entities, and one-pass decoding; a mismatched name still failed. These safety probes were not rerun for the assertion-only follow-up.

Server artifact provenance

The baseline WAR came from successful Build run 43852682205, exact baseline SHA, ubuntu-latest-11 artifact 14222035312, distribution-kit server WAR. The assembly copies openam-server:war unchanged. The complete nested WAR was extracted from the downloaded archive prefix and its ZIP entry size/CRC checked; the full outer artifact digest was not checked.

WAR SHA256: 39599c6caf586b5e31b4971a76548b135eaaa20b9c99ec57e148f55cf0718cde.
Baseline OAuth2-module SHA256: 91504f1640eb5a226cccd44993202e25bafba85e5c079bc84ea528d4fef27ce1.

The local results above cover oauth2 uma xacml; the full CI Playwright suite is a separate check. No CI or CodeQL result is claimed here for the latest test revision.

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

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

1. [P1] Keep credentials and consent responses out of failure artifacts

display-test.spec.mjs:80

The setup now sends the administrator credentials through Playwright’s request fixture, and the tests pass complete consent responses to assertions such as expect(html).toContain(...). With the repository configuration retaining traces on failure and the workflow uploading the Playwright report and test results, a failed run can persist credentials, session information, or the consent page’s CSRF token in logs or artifacts. This also affects runs against a server configured through the OPENAM_* environment variables.

Please restore protection for the authentication and consent data in both API steps and assertion failure output, and verify it with synthetic secret markers in failure artifacts.

2. [P2] Apply the HTTPS setting to the independently created request contexts

display-test.spec.mjs:106

apiRequest.newContext() creates an independent API request context and does not inherit use.ignoreHTTPSErrors from the Playwright configuration. Consequently, when OPENAM_BASE_URL points to an HTTPS deployment with a self-signed certificate, the administrator setup can succeed through the configured request fixture, but the resource-owner login fails at this context. The context created by sessionContext and the anonymous context have the same issue.

Please pass the appropriate HTTPS setting to all independently created contexts so this spec works with the same deployments as the configured fixture.

@maximthomas

Copy link
Copy Markdown
Contributor Author

@vharseko, replies to the review:

  1. Failure artifacts: This is intentional. These are test-environment artifacts, and retaining authentication details and consent responses can help diagnose failed E2E runs. I would keep the existing failure-artifact behavior for these tests.

  2. HTTPS request contexts: Addressed in 9436f6f. The login and anonymous contexts in display-test.spec.mjs, and the context created by the shared sessionContext helper, now explicitly set ignoreHTTPSErrors: true, matching the existing E2E configuration.

    Validation against the local OpenAM instance with embedded OpenDJ: 106 passed for oauth2 uma xacml, plus 9 passed for the display spec through a local HTTPS reverse proxy with a self-signed certificate. Syntax and git diff --check also passed.

    One detail from validation: the original display spec also passed that HTTPS run with Playwright 1.60.0, whose test-runner instrumentation injects the configured context options. I could not reproduce the reported spec failure on that version. A standalone sessionContext probe outside Playwright Test did fail with self-signed certificate before this change and passed afterward. The explicit options remove reliance on that injection for this setting.

@maximthomas
maximthomas requested a review from vharseko November 17, 2026 08:02

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

Thanks for addressing the HTTPS context settings. The failure artifacts contain test secrets, so I withdraw my earlier sanitization request. Approved.

@maximthomas
maximthomas merged commit 57825f6 into OpenIdentityPlatform:features/1075-remove-restlet Nov 17, 2026
47 of 51 checks passed
@maximthomas
maximthomas deleted the features/1075-e2e-oauth2-display-authorize branch November 17, 2026 10:56
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