Repository navigation
feat(mecak8s): match the execution allowlist on issuer and subject - #2544
Merged
Merged
Conversation
Add --execution-allowed-principal=ISSUER|SUBJECT (Helm execution.allowedPrincipals) so execution template listing and owner binding admit a caller only when both its issuer and subject match. --execution-allowed-subjects keeps working as subjects of --oidc-issuer while --oidc-owner-identity is off, is refused with it on and alongside the new form, and is deprecated. Closes #2521 Co-authored-by: Mecatl <[email protected]>
…ubjects Refuse allowlist issuers that are not an https:// or http:// URL with a host and no credentials, spaces, query, or fragment, at startup and at chart render time, so a typo fails instead of matching nobody. Plain HTTP stays valid because mecak8s never contacts the issuer. Let the chart accept subjects with internal spaces, as the flag already does. Co-authored-by: Mecatl <[email protected]>
Helm 3 reports the schema failure as execution.allowedPrincipals and the Helm in CI as /execution/allowedPrincipals; assert on the field name. Co-authored-by: Mecatl <[email protected]>
1 of 14 tasks
jhrozek
approved these changes
Oct 27, 2026
jhrozek
left a comment
Contributor
There was a problem hiding this comment.
Approving. One non-blocking item:
The Helm chart accepts two issuer forms that the binary refuses: a malformed percent escape in the path (for example https://idp.example/%zz) and a brace in the host (for example https://idp{x}.example). helm template renders both, and the binary then fails at startup, so the pod crash-loops instead of failing at render time. Suggest tightening the chart issuer regex in deploy/helm/mecak8s/templates/_helpers.tpl to match what url.Parse accepts, and adding those two cases to TestExecutionAllowedPrincipalsChart.
The chart's issuer check accepted a malformed percent escape in the path
and host characters Go's url.Parse rejects ({, }, \, ^, `, %), so the
chart rendered values that crash-looped the pod. Match url.Parse there.
Co-authored-by: Mecatl <[email protected]>
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2521.
The mecak8s execution allowlist matched a caller's subject alone. With
--oidc-owner-identity=sub_id, the caller's issuer comes from the token'ssub_idclaim, so a user from another IdP with an allowlistedsubwould have been allowed. The allowlist now names principals by issuer and subject, matched exactly withsession.Principal.SameIdentity, for both template listing (ExecutionTemplateAllowed) and owner binding and reattachment (ExecutionOwnerAllowed).--execution-allowed-principal=ISSUER|SUBJECT, Helmexecution.allowedPrincipals: [{issuer, subject}]. The entry splits at the first|. An issuer URL can't contain|, but a subject can (for example Auth0'sauth0|123). Empty, padded, control-character and duplicate entries are rejected at startup, and the chart rejects the same at render time.https://orhttp://URL with a host and no credentials, spaces, query or fragment. mecak8s and the chart both enforce this, so a typo such asidp.examplefails at startup instead of matching nobody. It is validated but never normalized: entries still match byte-exactly. Plain HTTP is accepted because mecak8s never contacts the allowlist issuer, and a local IdP stand-in such as Dex behind AS-1 may be served over HTTP. Subjects may contain internal spaces (team carol) in both the flag and the chart.--execution-allowed-subjects/execution.allowedSubjectsnow resolves to--oidc-issuerplus each subject. The validator already pinsissto that issuer byte-exactly, so admission is unchanged while--oidc-owner-identityis off. With it on, mecak8s refuses subject-only entries at startup, and the chart refuses them at render time. Setting both forms is refused too. The subject-only form is deprecated in the flag help, values comments and docs.settings.yamlkey. That matches how the rest of the execution client is configured.caller-identity.mdand the mecak8s native-execution guide describe the new form and the upgrade path.server-cli.mdis regenerated.API compatibility
engine/sessionorinternal/adapter/serverchange. The callback signatures inapp.Configare unchanged; only the operator policy behind them changes.--oidc-owner-identityis off.allowedPrincipalswithissuer: <oidc.issuer>is recommended.sub_idon: replaceallowedSubjectswithallowedPrincipalsentries naming thesub_ididentity, which is the company IdP's issuer and subject. This combination previously matched on subject alone. It only shipped with feat(authn): own sessions by the sign-in's sub_id identity #2497, and the real AS-1 isn't hosted yet (Host AS-1 in mecak8s #2490).Test plan
go test -race ./cmd/mecak8s/ ./deploy/helm/mecak8s/passes. The new tests cover:|inside the subject;--oidc-issuer;task lint: root module clean. The one finding is pre-existing,environment/microvm/launch_ownership_darwin.go:754(gosec G703), which this change doesn't touch.task docs:server-cli:check, matlatl strict (0 findings on a clean checkout of this branch),task site:buildandgo run ./cmd/mecademopass.task test:race:cmd/mecak8spasses. A few tests in packages this change doesn't touch fail locally on macOS:origin/mainworktree:cmd/mecatuiTestStartupCompatibilityEmbeddedRejectedcmd/mecatuiTestConnectUsesSavedServerCAForLazyTLSRPCcmd/mecatedTestMecatedCLICompositionValidatesMicroVMDefaultAfterReadinessinternal/adapter/microvmmanagerTestDefaultOperationsStartScrubsDaemonEnvironmentAndDetachesFromRequestfails only in the main checkout. It passes in a fresh worktree of this branch.CI is the reference run for these.
Notes
deploy/mecatl-execution-kind/mecak8s-values.yamlkeepsallowedSubjects: [alice], which stays valid with owner identity off. Moving the demo values is left to Phase 1 end-to-end test against the real ToolHive in kind #2542.cmd/mecak8s/flags.goand the chart. Expect textual conflicts only.