Skip to content

test(oidc-auth): port the OIDC authorization tests to testkit - #5787

Draft
matthewgrossman wants to merge 13 commits into
test/5728-share-environment-helpers/matthewgrossmanfrom
test/5731-port-oidc-auth-tests/matthewgrossman
Draft

matthewgrossman wants to merge 13 commits into
test/5728-share-environment-helpers/matthewgrossmanfrom
test/5731-port-oidc-auth-tests/matthewgrossman

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Port the OIDC tests in e2e/rust/tests/oidc_pkce.rs to 13 testkit tests in tests/suites/features/oidc-auth. They run in a new <base>-oidc tmachine environment that reuses the Keycloak setup.

Related Issue

Closes #5731
Part of #5281

Stacked on #5780 (the gateway_overrides role, the environment contract table and the typed Profile/Credential builders, for #5728). This PR targets #5780's branch; merge #5780 first.

Changes

  • <base>-oidc environment (tests/tmachine): the oidc_gateway role applies an oidc override block through gateway_overrides. It sets [openshell.gateway.oidc] to trust the Keycloak realm and sets [openshell.gateway.mtls_auth] operator_enabled = true in place of enabled. It also re-signs testkit's client certificate as an operator (OU=operator), so testkit's own connection sets up and cleans up without signing in as a user. The suite's setup fails with a pointer to the role if the certificate signs in as a user.
    The block also sets [openshell.gateway.tls] to the paths generate-certs writes. config preflight (the unit's first ExecStartPre) accepts operator_enabled only with an explicit client CA, and doesn't pick up the local TLS files the packaged gateway otherwise finds on its own.
  • keycloak-support: User, Session (a signed-in user's SDK client and CLI), browser_login (the PKCE flow with a recorded xdg-open) and token-claim helpers. These are shaped so test(e2e): migrate the Python E2E suites to Rust #5624's oidc_authz.rs can move onto them.
  • testkit: Cli::without_env and Cli::in_workspace; Workspace::track_sandbox, track_provider and import_profile.
  • oidc-auth suite: 13 tests following the issue's mapping table. Per-user clients verify the gateway against its CA and send only a bearer token (no --gateway-insecure, no client certificate). Denials are checked by gRPC code and message. One CLI test checks the remediation command a workspace user sees.
  • CI: one row, ubuntu-docker-rootful-oidc with deb. All 13 tests pass there, so the suite has no tests/suites/unsupported.yaml entries. The test target is oidc-auth with harness = false and a testkit::main() entry point.
  • oidc_pkce.rs keeps only the 4 tests decision D drops: admin_can_delete_workspace, second_workspace_user_cannot_read_first_users_workspace, workspace_admin_can_create_sandbox and workspace_admin_can_delete_sandbox. The e2e:oidc-pkce tasks stay.

Notes for review:

  • The gateway has no built-in provider profiles, so tests import a small test profile into their workspace, or globally for the profile-resolve test, and delete it on cleanup.
  • The CLI-only "requires admin privileges" check is dropped; denials are asserted on the gateway's own messages (role 'openshell-admin' required, not a member of workspace '<ws>', and so on).
  • CI client variables and client_credentials_grant are left to test(e2e): migrate the Python E2E suites to Rust #5624.

Testing

  • cargo clippy -D warnings and cargo fmt for testkit, keycloak-support and the features workspace
  • oidc_pkce.rs compiles clean of new warnings with --features e2e-oidc-pkce
  • E2E tests added/updated
  • ubuntu-docker-rootful-oidc CI row passes

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@copy-pr-bot

copy-pr-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test c29be49

@matthewgrossman matthewgrossman added the test:e2e Requires end-to-end coverage label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for c29be49. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway, sandbox, and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 8b9ac69

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 6740fa3

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 82b5c06

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…eflight

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…file

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
… list

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the test/5731-port-oidc-auth-tests/matthewgrossman branch from 84a2058 to 1dc7b8b Compare November 24, 2026 06:00
@matthewgrossman
matthewgrossman changed the base branch from main to test/5728-share-environment-helpers/matthewgrossman November 24, 2026 06:00

This branch has not been deployed

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

Labels

state:accepted A maintainer decided OpenShell should pursue this issue test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(e2e): port OIDC authorization tests from e2e/rust to features/oidc-auth

1 participant