Repository navigation
feat(deploy/sbx): wire the oidc identity provider into the SBX0 installer - #851
Conversation
…ller SBX0's control plane runs the same code as the harness stack, which has had OIDC login since the identity-provider work merged, but deploy/sbx/setup.sh still required a GitHub OAuth app and admitted only github: subjects, so a deployment could not offer w3id (or any OIDC) login to its users. - setup.sh: SBX_IDENTITY_PROVIDER (github, the default, or oidc); with oidc, SBX_OIDC_ISSUER, SBX_OIDC_CLIENT_ID and SBX_OIDC_REDIRECT_URI are required (SBX_OIDC_SCOPE optional) and written to moca-settings, whose env wiring the base already carries; SBX_GITHUB_CLIENT_ID is required only with github. The client secret stays out of settings entirely: the operator creates the moca-oidc Secret, as on the k8s stack. The subject grammar now accepts github:<numeric id> or oidc:<provider sub> entries (the control plane's MEMBER_SUBJECT_RE), mixed lists included, so a GitHub enrollment survives a provider switch. A github deployment's settings array is byte-identical to before, so its settings hash does not move. - ocp-sbx overlay: the credentials volume stays PROJECTED so the optional moca-oidc source mounts the client secret under CREDENTIALS_DIRECTORY; the moca-mu1 source's field is name:, the SecretSource schema's spelling (the old plain-secret volume's secretName: would not validate in a projection). - install-host.sh: the janitor-token check's [!-~] range becomes [[:graph:]], which matches printable ASCII under a UTF-8 locale too; the same fix setup.sh's copy already has. [!-~] NOMATCHed a valid token under en_US.UTF-8 and refused an install that LC_ALL=C would accept. - tests: refusals for the new validation and the oidc subject grammar, a positive oidc run asserting the settings, the absent GitHub client id and the stamped hash, and the overlay's credentials-volume assertions updated to the projected shape. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: George Almasi <[email protected]>
… components Both components replace the credentials volume's projected source list (a strategic merge replaces lists), so each restates every source the others add -- but neither restated moca-oidc: with the template store or egress credentials on, the oidc client secret's optional source vanished and an SBX_IDENTITY_PROVIDER=oidc deployment lost the secret file it needs to boot. Add the optional moca-oidc source to both components' lists and assert it in the store-on and egress-on overlay shapes. Found live: enabling SBX_TEMPLATE_STORE on the epoc001 rig rendered a credentials volume without moca-oidc. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: George Almasi <[email protected]>
|
Follow-up: found live while enabling |
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
This adds SBX_IDENTITY_PROVIDER=oidc to deploy/sbx/setup.sh (it writes the SH_OIDC_* settings, the subject grammar now matches MEMBER_SUBJECT_RE, and the GitHub client id is required only for github). It switches the ocp-sbx credentials volume to a projected one with an optional moca-oidc source, and fixes the [!-~] locale bug in install-host.sh. The github path is byte-identical, and the overlay change renders correctly: I checked with kubectl kustomize deploy/k8s/overlays/ocp-sbx and got exactly one projected volume with moca-mu1 plus optional moca-oidc.
One blocker. The base still reads SH_GITHUB_CLIENT_ID through a non-optional configMapKeyRef (base/control-plane.yaml:59-60, unchanged in the rendered ocp-sbx overlay), and the oidc branch of ensure_settings never writes that key. Because apply_configmap is a server-side apply with one field manager, a dropped key is also removed on upgrade. So a fresh oidc install, or a github→oidc switch, leaves the control-plane pod in CreateContainerConfigError (couldn't find key SH_GITHUB_CLIENT_ID in ConfigMap moca/moca-settings). The live epoc001 run may have passed because an earlier manager still owned that key. deploy/k8s/setup.sh avoids this by always writing SH_GITHUB_CLIENT_ID (empty for oidc), and main.ts only requires it when the provider is github.
Also (not inline, since the file isn't in the diff): deploy/sbx/README.md (L29 inputs table) and RUNBOOK.md (L22/L36) still list SBX_GITHUB_CLIENT_ID as required and don't mention SBX_IDENTITY_PROVIDER / SBX_OIDC_* or the operator-created moca-oidc Secret.
Author: galmasi (MEMBER — maintainer)
Areas reviewed: Shell (deploy/sbx setup.sh, install-host.sh, tests), Helm/K8s (ocp-sbx overlay)
Agent/IDE config (.claude/.vscode): none
Commits: 2, all signed-off: yes
CI status: all green (17 checks)
| moca=("SH_GITHUB_CLIENT_ID=$SBX_GITHUB_CLIENT_ID" "SH_ADMIN_SUBJECTS=${SBX_ADMIN_SUBJECTS:-}" | ||
| 'SH_API_TOKEN_TTL_SECONDS=' 'SH_SESSION_TOKEN_TTL_SECONDS=') | ||
| else | ||
| moca=("SH_ADMIN_SUBJECTS=${SBX_ADMIN_SUBJECTS:-}" 'SH_API_TOKEN_TTL_SECONDS=' 'SH_SESSION_TOKEN_TTL_SECONDS=' |
There was a problem hiding this comment.
must-fix: The oidc array omits SH_GITHUB_CLIENT_ID, but base/control-plane.yaml:59-60 reads it with a required configMapKeyRef (no optional: true; still required after the ocp-sbx overlay, checked with kubectl kustomize). On an oidc install the pod can't start (CreateContainerConfigError: couldn't find key SH_GITHUB_CLIENT_ID), and on a github→oidc switch the SSA removes the key, so it breaks there too. Write 'SH_GITHUB_CLIENT_ID=' in this branch, as deploy/k8s/setup.sh does (main.ts only required()s it for github). The github array stays byte-identical, so no hash change there.
| [[ "$(cm moca-settings SH_OIDC_CLIENT_ID)" == 0123456789abcdef ]] || fail 'oidc client id not written' | ||
| [[ "$(cm moca-settings SH_OIDC_REDIRECT_URI)" == https://sbx-api.apps.example.invalid/v1/auth/oidc/callback ]] || fail 'oidc redirect URI not written' | ||
| [[ "$(cm moca-settings SH_OIDC_SCOPE)" == 'openid email profile' ]] || fail 'oidc scope not written' | ||
| jq -e '.data | has("SH_GITHUB_CLIENT_ID") | not' "$MOCK_STATE/configmap-moca-settings.json" >/dev/null || |
There was a problem hiding this comment.
suggestion: This asserts the opposite of what the base needs: once the oidc branch writes an empty SH_GITHUB_CLIENT_ID, assert cm moca-settings SH_GITHUB_CLIENT_ID is empty instead. Also consider rendering the generated overlay here (already done for the hash) and checking that every non-optional configMapKeyRef key the control plane reads exists in the written moca-settings. That would have caught this.
| # in SBX_ALLOWED_SUBJECTS and SBX_ADMIN_SUBJECTS are then oidc:<provider | ||
| # sub> entries, per the control plane's subject grammar; a mixed list is | ||
| # accepted, so a GitHub enrollment survives the switch | ||
| # SBX_ALLOWED_SUBJECTS required; comma-separated github:<numeric id>, who may log in |
There was a problem hiding this comment.
nit: The header for SBX_ALLOWED_SUBJECTS (and SBX_ADMIN_SUBJECTS below) still says "comma-separated github:". Add or oidc:<provider sub> to match the new grammar and error messages.
clawgenti
left a comment
There was a problem hiding this comment.
Summary
This wires SBX_IDENTITY_PROVIDER=oidc into the SBX0 installer: new subject grammar matching the control plane's MEMBER_SUBJECT_RE, provider-conditional validation, an oidc settings block in ensure_settings, and the optional moca-oidc secret source restated in all three ocp-sbx overlay patches. The dual-mode split is careful (github array kept byte-identical, secret kept out of settings, [!-~] → [[:graph:]] locale fix is correct), and the overlay/test updates are thorough.
I independently reproduced the blocker from the earlier human review on this exact head (0530eb5): rendered kubectl kustomize deploy/k8s/overlays/ocp-sbx on the PR branch still shows SH_GITHUB_CLIENT_ID as a non-optional configMapKeyRef, and the oidc branch of ensure_settings never writes that key — so a fresh oidc install (or a github→oidc switch, given SSA) leaves the control-plane pod in CreateContainerConfigError. I verified the rest of the base's env wiring (SH_IDENTITY_PROVIDER, SH_OIDC_ISSUER/CLIENT_ID/REDIRECT_URI/SCOPE, all optional: true) is fully covered by the keys this PR writes, and that the oidc:<sub> grammar in setup.sh matches OIDC_SUB_PATTERN in packages/control-plane/src/identity.ts exactly. So the SH_GITHUB_CLIENT_ID gap is the only config-parity break I found. I'd also second the earlier note that deploy/sbx/README.md and RUNBOOK.md still list SBX_GITHUB_CLIENT_ID as unconditionally required and don't mention SBX_IDENTITY_PROVIDER/SBX_OIDC_*.
Everything else is a nit. Nice work overall — the test coverage in 13b and the overlay assertions are exactly the kind of pinning that makes a dual-mode change reviewable.
Author: galmasi (NONE — first-time contributor, reviewed with highest scrutiny; every changed file read in full)
Areas reviewed: Shell (deploy/sbx setup.sh, install-host.sh, tests), K8s/kustomize (ocp-sbx overlays), config parity vs base/control-plane.yaml and identity.ts
Agent/IDE config (.claude/.vscode): none
Commits: 2, all signed-off: yes
CI status: all green (17 checks); DCO pass
Verified by: fetched the PR branch locally and rendered deploy/k8s/overlays/ocp-sbx with kubectl kustomize; fetched deploy/k8s/base/control-plane.yaml and packages/control-plane/src/identity.ts from upstream main via the GitHub API to check env-key and regex parity.
Generated by RepoMan github-pr-review@9672454 (https://github.com/rossoctl/agent-skills/blob/96724547c162978f58d845b9a8331a679bf39444/skills/github-pr-review/SKILL.md).
| moca=("SH_GITHUB_CLIENT_ID=$SBX_GITHUB_CLIENT_ID" "SH_ADMIN_SUBJECTS=${SBX_ADMIN_SUBJECTS:-}" | ||
| 'SH_API_TOKEN_TTL_SECONDS=' 'SH_SESSION_TOKEN_TTL_SECONDS=') | ||
| else | ||
| moca=("SH_ADMIN_SUBJECTS=${SBX_ADMIN_SUBJECTS:-}" 'SH_API_TOKEN_TTL_SECONDS=' 'SH_SESSION_TOKEN_TTL_SECONDS=' |
There was a problem hiding this comment.
must-fix (confirms the earlier review's blocker with a fresh reproduction on this head): rendering deploy/k8s/overlays/ocp-sbx from this branch with kubectl kustomize still yields SH_GITHUB_CLIENT_ID with a required configMapKeyRef (no optional: true), and this branch never writes that key — the control-plane pod lands in CreateContainerConfigError on a fresh oidc install, and a github→oidc switch drops the key via SSA. Suggested fix: write 'SH_GITHUB_CLIENT_ID=' (empty) in the oidc branch, as deploy/k8s/setup.sh does; main.ts only requires it when the provider is github, and the github array above stays byte-identical so GitHub hashes don't move. This also resolves cleanly with the prior review's suggestion to flip the 13b assertion from "key absent" to "key empty". It matters now because without it the feature this PR adds cannot actually boot.
|
|
||
| SUBJECTS_RE='^github:[0-9]+(,github:[0-9]+)*$' | ||
| # The control plane's MEMBER_SUBJECT_RE (packages/control-plane/src/identity.ts): github:<numeric | ||
| # id> or oidc:<provider sub>, the sub per OIDC_SUB_PATTERN. A comma list of either form, no spaces. |
There was a problem hiding this comment.
nit: the new OIDC_SUBJECT uses locale-sensitive [A-Za-z0-9] ranges in a bash ERE — the same bug class this PR fixes two files over with the [!-~] → [[:graph:]] change (ranges can misbehave under a UTF-8 collation locale). [[:digit:]] / [[:alnum:]] classes would be locale-proof and consistent with that fix. Low risk in practice (ranges usually behave in bash under common UTF-8 locales), hence a nit.
clawgenti
left a comment
There was a problem hiding this comment.
Generated by RepoMan github-pr-review@9672454 (https://github.com/rossoctl/agent-skills/blob/96724547c162978f58d845b9a8331a679bf39444/skills/github-pr-review/SKILL.md).
…ment The base's env ref for SH_GITHUB_CLIENT_ID is not optional, so the key must exist in moca-settings: omitting it on the oidc path left the pod in CreateContainerConfigError (couldn't find key SH_GITHUB_CLIENT_ID). Write it empty instead -- the control plane ignores it when the provider is oidc (it refuses a value only when the provider is github), the same convention the k8s installer's oidc deployments use. Found live: deploying the branch on the epoc002 rig. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: George Almasi <[email protected]>
238dc8b to
e3b6a72
Compare
…lasses, key-coverage check - The SBX_ALLOWED_SUBJECTS and SBX_ADMIN_SUBJECTS header lines now name the oidc:<provider sub> form, matching the grammar and the error messages (review nit). - GITHUB_SUBJECT and OIDC_SUBJECT use POSIX classes ([[:digit:]], [[:alnum:]]) instead of [0-9]/[A-Za-z0-9] ranges: the same UTF-8-collation bug class the [!-~] fix in this PR addresses (review nit). - The oidc test now renders the generated overlay and asserts every non-optional configMapKeyRef the control plane reads exists in the written ConfigMaps -- the class of bug the empty SH_GITHUB_CLIENT_ID was, which would have been caught by exactly this check (review suggestion). The must-fix (write an empty SH_GITHUB_CLIENT_ID on the oidc path) is commit e3b6a72, found by the live epoc002 deployment before the review landed. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: George Almasi <[email protected]>
|
All review points addressed:
The branch is deployed live (epoc002, w3id preprod, oidc subjects) and was tested end-to-end to the point of the control plane serving its routes. Assisted-By: Claude Code |
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
Follow-up at e9e8e75, one commit on e3b6a72, which we already drafted. It handles the remaining items from our earlier review: the setup.sh header now names oidc:<provider sub>, and the oidc test now has a render-time check that every non-optional configMapKeyRef on the control plane exists in the written ConfigMaps. One issue is new in this commit. Swapping [A-Za-z0-9] for [[:alnum:]] in OIDC_SUBJECT makes the grammar locale-dependent: under a UTF-8 locale, glibc's [[:alnum:]] matches non-ASCII letters, so setup.sh now accepts subjects the control plane's ASCII-only OIDC_SUB_PATTERN will never match. It isn't blocking, but it should be fixed.
Still open from before, non-blocking: deploy/sbx/README.md and RUNBOOK.md still list SBX_GITHUB_CLIENT_ID as required and don't document SBX_IDENTITY_PROVIDER / SBX_OIDC_* / the moca-oidc Secret. A follow-up PR is fine.
Author: galmasi (MEMBER — maintainer)
Areas reviewed: Shell (deploy/sbx/setup.sh, deploy/sbx/tests/setup.test.sh), incremental diff e3b6a72..e9e8e75
Agent/IDE config (.claude/.vscode): none
Commits: 4, all signed-off: yes (DCO pass)
CI status: all checks passing at submit time except deploy-scripts-bash32 (macOS), still pending
| # Locale-proof classes, not [0-9]/[A-Za-z0-9] ranges: the same UTF-8-collation bug class as the | ||
| # [!-~] fix below (a range can misbehave where a POSIX class cannot). | ||
| GITHUB_SUBJECT='github:[[:digit:]]+' | ||
| OIDC_SUBJECT='oidc:[[:alnum:]][[:alnum:]._@+-]{0,127}' |
There was a problem hiding this comment.
suggestion: [[:alnum:]] isn't locale-proof. It's the opposite: under C.UTF-8, glibc classifies é, ß and so on as alnum. I checked: oidc:café matches this regex under LC_ALL=C.UTF-8 but not under LC_ALL=C, and the old [A-Za-z0-9] refused it under both. The control plane's OIDC_SUB_PATTERN (identity.ts:246) is an ASCII-only JS regex, so setup.sh would now enroll a subject that can never log in, with no error. Suggest restoring the explicit ranges and pinning the match with local LC_ALL=C in the validation function, or spelling out the class ([abc…xyzABC…XYZ0123456789]). [[:digit:]] on L160 is fine. Related: the same reasoning applies to the [[:graph:]] change in install-host.sh / setup.sh:818, since under UTF-8 it also admits non-ASCII printables that [!-~] didn't. That matters less for a token, but LC_ALL=C is the strict fix for both.
| # wrote (review #851: the empty SH_GITHUB_CLIENT_ID bug was exactly a key the base reads | ||
| # unconditionally that the oidc path did not write; this would have caught it). | ||
| KUBECONFIG=/dev/null "$REAL_KUBECTL" label --local -f "$TMP/render.yaml" sbx-render- -o json 2>/dev/null | jq -s . >"$TMP/render.json" | ||
| for ref in $(jq -r '.[] | select(.kind == "Deployment" and .metadata.name == "moca-control-plane") |
There was a problem hiding this comment.
nit: for ref in $(…) passes trivially if the query finds nothing. That happens if the Deployment is renamed or the env moves to envFrom, and set -e doesn't catch a failing substitution in a for list either. Assert at least one ref was checked (for example, that moca-settings/SH_GITHUB_CLIENT_ID is among them), so the guard can't silently go vacuous.
Brings 25 upstream merges since 1aa8dd6, among them the sbx OIDC identity provider (rossoctl#851), the Redis schema-version key and config bundle format marker (rossoctl#868), the provisioner Redis ACL user (rossoctl#869), the relay keepalive env (rossoctl#866), the per-source OIDC pending bound with the forwarded-headers Route pin (rossoctl#874), the egress refusal hints and control-plane index (rossoctl#864), the empty-workspace sweep (rossoctl#872) and the orphan-sweep log split (rossoctl#849). No conflicts. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
What
SBX0 deployments could not offer OIDC (e.g. w3id) login:
deploy/sbx/setup.shrequired a GitHub OAuth app and admitted onlygithub:subjects, even though the SBX0 control plane runs the same identity code as the harness stack that has had OIDC since the identity-provider work merged.Change
SBX_IDENTITY_PROVIDER(github, the default, oroidc). Withoidc:SBX_OIDC_ISSUER,SBX_OIDC_CLIENT_IDandSBX_OIDC_REDIRECT_URIare required (SBX_OIDC_SCOPEoptional) and written tomoca-settings, whose env wiring the base already carries;SBX_GITHUB_CLIENT_IDis required only withgithub. The client secret never becomes a setting — the operator creates themoca-oidcSecret, exactly as on the k8s stack. The subject grammar now acceptsgithub:<numeric id>oroidc:<provider sub>(the control plane'sMEMBER_SUBJECT_RE), mixed lists included, so a GitHub enrollment survives a provider switch. Agithubdeployment's settings array is byte-identical to before, so its settings hash does not move and no pod rolls on upgrade.projectedso the optionalmoca-oidcsource mountsSH_OIDC_CLIENT_SECRETunderCREDENTIALS_DIRECTORY; themoca-mu1source's field isname:, the SecretSource schema's spelling (secretName:from the old plain-secret volume does not validate in a projection — caught by the overlay test).[!-~]becomes[[:graph:]]: under a UTF-8 locale the former NOMATCHes printable ASCII it should match and refuses an install thatLC_ALL=Caccepts. Same fixsetup.sh's copy of the check already has.Verified live on the epoc001 rig: deployed with
SBX_IDENTITY_PROVIDER=oidcagainst w3id preprod, andmake test-deployis green.Assisted-By: Claude Code