Skip to content

feat(gateway-access): bootstrap default-workspace membership and access UI (#976) - #1114

Open
kdoberst wants to merge 24 commits into
openshift-online:mainfrom
kdoberst:GITHUB-976-ui-for-auto-add-user
Open

kdoberst wants to merge 24 commits into
openshift-online:mainfrom
kdoberst:GITHUB-976-ui-for-auto-add-user

Conversation

@kdoberst

@kdoberst kdoberst commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds one-shot default-workspace membership bootstrap for eligible human gateway-access grants and openshell-user service accounts.
  • Adds a persistent, gateway-scoped bootstrap admin, audited bootstrap attempts, and safe API error mapping.
  • Adds the skip_default_workspace_bootstrap opt-out to the human user grant API and exposes it in the web console.
  • Shows available gateway workspaces and default-workspace membership feedback in the gateway access UI, with guidance for the manual OpenShell workspace-membership command.
  • Regenerates the Go, TypeScript, and TUI contracts affected by the new API field and gRPC methods.
  • Extends E2E and integration coverage for automatic default-workspace membership, the console opt-out, and workspace visibility.
  • Adds the DefaultWorkspaceBootstrapReady gateway provisioning condition as a mixed-version rollout compatibility boundary.
  • Makes regrants idempotent when the principal is already a member of the OpenShell default workspace.

Closes #976.

Console experience

  • The gateway access flow can automatically add newly granted human users to the gateway's OpenShell default workspace.
  • Platform administrators and gateway owners/admins can opt out of automatic bootstrap while granting user-tier access.
  • Access listings expose gateway-wide workspace visibility and identify users who are members of the default workspace.
  • The details surface explains when automatic membership is unavailable and provides the manual OpenShell command for administrators who need to add a user directly.
  • The UI reflects the API contract without exposing bootstrap-admin credentials or implementation details.

Rollout behavior

The API server only calls OpenShell membership APIs for gateways whose DefaultWorkspaceBootstrapReady provisioning condition is complete. Gateways without that completed condition, including gateways served by an older control plane during a mixed-version rollout, skip the one-shot bootstrap while user grants and service-account creation retain their pre-bootstrap success behavior.

Once the new control plane starts or reconnects to the gateway watch stream, it reconciles existing gateways. For each converged gateway it validates the Keycloak client, ensures the bootstrap admin exists, and publishes the completed readiness condition. Small installations normally converge within seconds; larger fleets or transient Keycloak/Kubernetes failures can take longer and retry with the normal reconcile backoff. No strict API-server-before-control-plane or control-plane-before-api-server deployment order is required.

Existing gateways may be enrolled lazily by control-plane reconciliation. If an existing gateway remains unmarked, its access operations continue to succeed without default-workspace bootstrap. Once marked, subsequent eligible requests bootstrap automatically; requests that occurred while the gateway was unmarked are not retroactively repaired.

Idempotent membership handling

OpenShell can reject a duplicate membership add with AlreadyExists or FailedPrecondition, depending on whether its request-replay window has expired. HyperShell now treats an already-existing member as success:

  • Before adding a principal, the control plane checks the default workspace membership list.
  • If the principal is already present, it skips AddMember and returns success.
  • If a concurrent add wins the race, HyperShell safely handles AlreadyExists.
  • If OpenShell returns FailedPrecondition, HyperShell rechecks membership and succeeds only when the principal is present; unrelated failures remain errors.

This prevents a previously successful membership from causing later grant/regrant attempts to return default_workspace_bootstrap_failed.

Bootstrap admin permissions

The bootstrap admin is a persistent HyperShell-owned Keycloak service account, not a Kubernetes ServiceAccount and not a human User.

  • It receives the openshell-admin role on exactly one gateway's Keycloak client.
  • It has no role on other gateways and no HyperShell platform-wide RBAC.
  • HyperShell uses it only to manage membership in that gateway's reserved default workspace.
  • Access tokens are short-lived, with a 300-second lifetime, and are obtained through the client-credentials flow.
  • The client credential is stored in a Kubernetes Secret in the gateway namespace and is never returned through the HyperShell API, CLI, console, SDK, or logs.

OpenShell currently has no narrower workspace-admin privilege, so the gateway-scoped openshell-admin role is broader than the single membership operation. HyperShell deliberately limits its own use to default-workspace membership management; narrowing the OpenShell privilege to a dedicated workspace-admin role is documented as a follow-up contract change.

Screenshots

Users

Screenshot 2026-11-16 at 10 26 43 AM Screenshot 2026-11-16 at 10 28 51 AM Screenshot 2026-11-16 at 10 29 10 AM

Service accounts

Screenshot 2026-11-16 at 10 27 33 AM Screenshot 2026-11-16 at 10 53 17 AM

Validation

  • API_ENV=integration_testing go test ./plugins/gatewayAccess -count=1
  • API_ENV=unit_testing go test ./plugins/serviceAccounts -count=1
  • go test ./... in components/control-plane
  • pnpm --filter @openshift-online/hypershell-gateway-management-ui check
  • Web-console i18n, typecheck, production build, and Storybook build
  • PatternFly mockup checks and production data-boundary checks
  • make check-forbidden-dom-injection
  • Repository pre-commit and pre-push policy checks
  • Kind verification: rebuilt the control plane, reproduced the existing-member regrant failure, and confirmed the same grant now returns 201 Created

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

Failed Failed checks: 1 error

Check name Status Explanation Resolution
No-Weak-Crypto Error FAIL: the PR adds a SHA-1 primitive, which the no-weak-crypto check flags. Finding 1 (matches "SHA1 usage"): - File: components/control-plane/internal/defaultworkspace/openshell_client.go, lines 153-1… 1. Replace uuid.NewSHA1 in bootstrapRequestID (openshell_client.go:154) with a SHA-256-based derivation. Build the UUID from sha256 output (for example, a UUIDv5-style layout with a SHA-256 digest), or use a stable non-cryptographic k…
Passed Passed checks: 5 passed

Check name Status Explanation
Container-Privileges Passed The container-privileges check finds no introduced privileged container settings in PR #1114. Evidence: - The checkout is a single root commit (d15af38). It has no parent, so the PR patch cannot be di…
No-Sensitive-Data-In-Logs Passed No log statement in the default-workspace bootstrap code exposes a token, password, client secret, API key, session ID, PII, or customer data. Checked for CWE-532 (Insertion of Sensitive Information i…
No-Hardcoded-Secrets Passed No hardcoded production secret found in the PR-scope code (CWE-798 not observed). Scope and evidence limits: - The local checkout is a single squashed commit (d15af38). No merge base with main exists,…
No-Injection-Vectors Passed No explicit injection-vector condition from the check was found in the PR-related code. Evidence limits: The checkout is shallow. HEAD is one squashed commit with no reachable parent, so the PR patch …
Ai-Attribution Passed Check ai-attribution applies only when AI tools were used and are mentioned in the PR or its commits. The PR description (title, summary, rollout notes, validation list, and screenshots section) does …
Full details: Container-Privileges

Explanation

The container-privileges check finds no introduced privileged container settings in PR #1114. Evidence: - The checkout is a single root commit (d15af38). It has no parent, so the PR patch cannot be diffed against a base. The verdict therefore relies on the PR's declared scope and on the files that implement the feature. - The PR description lists Go API, control-plane, TypeScript/UI, SDK/TUI contract, and E2E changes. It lists no Kubernetes manifest, Helm chart, or pod-spec change. - Files that implement the feature (for example components/api-server/plugins/defaultWorkspaceBootstrap/*, components/control-plane/internal/defaultworkspace/*, components/control-plane/internal/gateway/provisioning.go, components/api-server/plugins/gatewayAccess/*, and the packages/gateway-management-ui files) contain no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation: true, or root runAsUser: 0 settings. - A repository-wide search found privilege-related fields only in pre-existing manifests and scripts (for example deploy/*, charts/openshell/*, scripts/kind/up.sh). Those files are not part of the PR scope described. They are not attributed to this PR. - Where the Go container specs set security context, they set runAsNonRoot: true and allowPrivilegeEscalation: false (components/control-plane/internal/gateway/console.go, components/control-plane/internal/reconciler/agent_runtime_resources.go). - The bootstrap admin is a Keycloak service account with the openshell-admin role. This is an identity grant, not a container privilege, so it is outside this check. Residual gap: the PR patch itself is not available in this checkout. If the PR also changed deploy/, charts/, or scripts/ manifests, those changes were not inspected.

Full details: No-Sensitive-Data-In-Logs

Explanation

No log statement in the default-workspace bootstrap code exposes a token, password, client secret, API key, session ID, PII, or customer data. Checked for CWE-532 (Insertion of Sensitive Information into Log File). Evidence: - The checkout is one squashed commit with no parent. Git reports no merge base with origin/main. The PR diff therefore cannot be isolated. I did not treat the whole tree as PR-introduced. I reviewed the new bootstrap packages and the logging in the files the PR touches, by content. - components/control-plane/internal/defaultworkspace/manager.go:282-287 logs gateway_id, namespace, reason, and error when an Event create fails. None of these is a secret. - components/api-server/plugins/defaultWorkspaceBootstrap/service.go:94-98 logs gateway_id, subject_type, and error. It does not log the subject identity (username or email). The subject is persisted only in the audit record. - components/control-plane/internal/defaultworkspace/token_client.go:14-43 sends client_secret only in the POST body. Error returns are fixed strings or the HTTP status code. The response body is discarded, not logged. - components/control-plane/internal/defaultworkspace/openshell_client.go:48,74,108 places accessToken in gRPC metadata. It does not log it. - components/control-plane/internal/defaultworkspace/manager.go:301-341 handles the client secret through Kubernetes Secret storage and comparison only. It has no log call. - components/api-server/plugins/defaultWorkspaceBootstrap/plugin.go:21 and components/api-server/plugins/serviceAccounts/plugin.go:31,102 log configuration or reconciliation errors only. - components/control-plane/internal/reconciler/reconciler.go:940 logs client_id and the Keycloak client UUID. These are identifiers, not credentials. Residual gap: without a usable diff, I could not confirm which lines in existing files (for example main.go:215, which logs cfg.OIDCTokenEndpoint) are PR-introduced. Those lines do not log credentials, but the endpoint URL could name an internal host. This is an existing log, and the check's hostname clause does not change the result here.

Full details: No-Hardcoded-Secrets

Explanation

No hardcoded production secret found in the PR-scope code (CWE-798 not observed). Scope and evidence limits: - The local checkout is a single squashed commit (d15af38). No merge base with main exists, so the exact PR diff could not be isolated. I scanned the PR-scope packages in the current tree instead: components/control-plane/internal/defaultworkspace, components/control-plane/cmd/hypershell-controller, components/api-server/plugins/defaultWorkspaceBootstrap, components/api-server/plugins/gatewayAccess, components/api-server/plugins/serviceAccounts, packages/gateway-management-ui/src, and components/cli/pkg/gatewayaccess. Production code: - Secret-named identifiers are Kubernetes Secret names and data keys only (bootstrapAdminSecretName, clientSecretSecretKey, keycloakAdminSecretName, and similar). They are not credential values. - Environment reads (HYPERSHELL_SERVICE_ACCOUNT_PROVISIONER_ADDR, HELM_BINARY, HYPERSHELL_LOG_LEVEL, GATEWAY_API_BASE_DOMAIN) have no literal credential fallbacks. - No private key blocks, provider token prefixes (AKIA, ghp_, xox, sk-), JWTs, long base64 literals, or URLs with embedded credentials appear in these paths. Test fixtures: - Placeholder literals match the name-plus-literal heuristic. Examples: ClientSecret: "client-secret" in defaultworkspace/manager_test.go, "one-time-secret" in serviceAccounts tests, {"access_token":"***REDACTED_SECRET_ASSIGNMENT***"} in manager_test.go, and "client-secret": "***REDACTED_SECRET_ASSIGNMENT***" in keycloak_admin_test.go. The frontend tests also use clientSecret: "***REDACTED_SECRET_ASSIGNMENT***". - These values are fake test doubles, not usable credentials. I did not treat them as a failure. If the policy requires flagging any literal assigned to a secret-named variable, including test doubles, this verdict would change to FAIL for those test lines. Conclusion: the PR-scope code introduces no real hardcoded credential.

Full details: No-Injection-Vectors

Explanation

No explicit injection-vector condition from the check was found in the PR-related code. Evidence limits: The checkout is shallow. HEAD is one squashed commit with no reachable parent, so the PR patch could not be isolated. I scanned the PR-named areas in the tree instead: the defaultWorkspaceBootstrap and gatewayAccess plugins, serviceAccounts, control-plane/internal/defaultworkspace, hsctl/CLI gateway-access code, and gateway-management-ui access and service-account code. Results by check item: - SQL string concatenation (CWE-89): Not found. Filters use bound parameters, for example Where("rb.gateway_id = ? ...", gatewayID, ...) and LIKE ... ESCAPE with escaped bound patterns (gatewayAccess/dao.go 48–57; serviceAccounts/dao.go 103–113). The dynamic Order(sortCol + " " + order) (gatewayAccess/dao.go 68–80) and Order(sortColumn + " " + direction) (serviceAccounts/dao.go 119–131) use values from fixed maps, and direction is limited to ASC/DESC. The migration Exec concatenations (serviceAccounts/migration.go 33, 46, 49) use the constant funcTable. - shell=True, os.system, exec, or eval with user input (CWE-78, CWE-95): None in the scanned files. The Go bootstrap and control-plane code has no exec or shell calls. - Copy-paste shell commands in the UI: buildWorkspaceMembershipCommand (service-account-commands.ts 36–51) quotes subject through shellArgument, which escapes single quotes correctly (gateway-connections.ts 44–50). WORKSPACE_NAME='${workspace}' is not escaped, but the only callers pass the constant "default" (workspace-access-command.tsx 32, 88) or the constant placeholder. No user-controlled value reaches it. - pickle, yaml.load, dangerouslySetInnerHTML, innerHTML (CWE-502, CWE-79): None in the scanned files. Available workspace names render as React text (workspace-access-command.tsx 121–133). Residual risk: A file outside the named PR areas could contain a match, and the full PR file list could not be confirmed from git.

Full details: Ai-Attribution

Explanation

Check ai-attribution applies only when AI tools were used and are mentioned in the PR or its commits. The PR description (title, summary, rollout notes, validation list, and screenshots section) does not mention any AI tool. The linked issue #976 also does not mention one. The PR's original commit subjects are unavailable. The local checkout is shallow and contains only one commit (d15af38, "fix(defaultworkspace): compare bootstrap secrets in constant time"), so the PR's commit messages could not be inspected. A repository-wide search for Assisted-by, Generated-by, Co-Authored-By, and common AI tool names in the available commit history returned no hits. No AI use is shown, so no attribution trailer is required and no Co-Authored-By for an AI tool is present in the evidence. The verdict is PASS on the absence of an AI-use mention. It does not confirm the PR's own commit trailers. If the contributor used AI tools, the commit messages must still be checked for an Assisted-by or Generated-by trailer.

Full details: No-Weak-Crypto

Explanation

FAIL: the PR adds a SHA-1 primitive, which the no-weak-crypto check flags. Finding 1 (matches "SHA1 usage"): - File: components/control-plane/internal/defaultworkspace/openshell_client.go, lines 153-155. - Code: bootstrapRequestID returns uuid.NewSHA1(uuid.NameSpaceURL, ...). - Caller: line 52 sets RequestId: bootstrapRequestID(namespace, subject, role) on AddWorkspaceMember. - Causality: the line is an added line in git diff main HEAD (not present on main). The PR introduces it. - Context: the SHA-1 output is a deterministic UUIDv5 idempotency key for OpenShell replay handling. It is not used for secrecy, integrity, or authentication. Severity is low. The check still names SHA1 usage without a purpose exception, so the literal condition is met. CWE-327 and CWE-328 apply to the primitive. Checked and not flagged: - MD5, DES, 3DES, RC4, Blowfish, and ECB: no hits in the full PR diff (Go, TS, Python, shell, and config). - Custom crypto: none. The PR uses standard crypto/tls, crypto/x509, and crypto/subtle. The ecdsa/P256 use is in test code only. - Secret/token comparison: writeAdmin in manager.go now uses subtle.ConstantTimeCompare through secretValuesEqual (HEAD commit d15af38). This addresses the non-constant-time comparison condition (CWE-208). Remaining ==/!= checks on secrets are emptiness checks or test fixtures. Evidence gap: the local clone has a shallow HEAD parent (3dd3d76) that is not an ancestor of main. The main..HEAD diff was used as the PR patch.

Resolution

  1. Replace uuid.NewSHA1 in bootstrapRequestID (openshell_client.go:154) with a SHA-256-based derivation. Build the UUID from sha256 output (for example, a UUIDv5-style layout with a SHA-256 digest), or use a stable non-cryptographic key. Keep the existing determinism and the openshell_client_test.go stability checks. 2. If the check owner accepts non-security SHA-1 use, record a scoped exception for bootstrapRequestID that names its purpose. Do this in the check configuration, not in the code. 3. No change is required for the secret comparison. It already uses subtle.ConstantTimeCompare.

@mergify

mergify Bot commented Nov 16, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@kdoberst kdoberst changed the title Add default workspace membership bootstrap and access UI feat(gateway-access): bootstrap default-workspace membership and access UI (#976) Nov 16, 2026
@kdoberst
kdoberst force-pushed the GITHUB-976-ui-for-auto-add-user branch 4 times, most recently from 2824446 to 81fc094 Compare November 24, 2026 22:38
@kdoberst
kdoberst force-pushed the GITHUB-976-ui-for-auto-add-user branch from 81fc094 to ad6b58b Compare November 27, 2026 18:49

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: default-workspace bootstrap feedback and opt-out

1 participant