Repository navigation
Gate OIDC on a registered service rather than the Enterprise entitlement - #2
Open
neilLasrado wants to merge 1 commit into
Open
neilLasrado wants to merge 1 commit into
neilLasrado wants to merge 1 commit into
Conversation
ServerWithRoles gated UpsertOIDCConnector, UpdateOIDCConnector, CreateOIDCConnector and CreateOIDCAuthRequest on the OIDC Enterprise entitlement, which is never enabled in an OSS build. Gate on whether an OIDCService has actually been registered via Server.SetOIDCService instead, so a self-hosted implementation can be wired in. This gates on capability rather than licence: the entitlement flag and lib/modules are left untouched, and the enterprise connector-management UI stays locked. Three tool/tctl/common suites set up OIDC connectors by enabling the entitlement and never register a service, so they regress under the new gate. Add authtest.StubOIDCService as a shared stub and register it in those fixtures. Their modulestest.SetTestModules setup is kept, since the SAML gate still reads the entitlement and those subtests run alongside the OIDC ones. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
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.
Slice 0 of 6 toward self-hosted Google login. Merging this alone changes nothing in production — no code calls
SetOIDCServiceyet. See the caveat at the bottom about CI.What and why
ServerWithRolesgated four OIDC methods on the Enterprise entitlement:In an OSS build that entitlement is never enabled, so an OIDC connector cannot be created at all — regardless of whether an implementation exists. This gates on whether an
OIDCServicehas actually been registered instead:This gates on capability, not licence.
lib/modulesand the entitlement itself are untouched, so the enterprise connector-management UI stays locked andFeatures()does not diverge from upstream. The alternative — shipping a forkModulesthat flips the entitlement — would additionally unlock enterprise UI that has never been tested against a non-enterprise service.lib/auth/oidc.go's ownerrOIDCNotImplementedis deliberately left in place. It is the layer below this one and already expresses the same "no service registered" condition.⚠ This is not a no-op for CI
Three existing suites create OIDC connectors by enabling the entitlement via
modulestest.SetTestModulesand never register a service, so they regress under the new gate:tool/tctl/common/resource_command_test.go—TestCreateEnterpriseResources/oidctool/tctl/common/edit_command_test.go—TestEditEnterpriseResources/oidctool/tctl/common/admin_action_test.go—TestAdminActionMFA/OIDCConnector/*(9 subtests)This PR fixes them by adding
authtest.StubOIDCServiceand registering it in each fixture. TheirSetTestModulessetup is kept, not removed: the SAML gate still reads the entitlement directly and those subtests run off the same setup. Two independent gates, two independent setup calls.Verification
Scoped builds only (
GOFLAGS=-p=2 GOMAXPROCS=2, never./...):go vet ./lib/auth/ ./lib/auth/authtest/ ./tool/tctl/common/— cleanTestOIDCGatedOnRegisteredService— PASS, both subtestsTestCreateEnterpriseResources— PASS (oidc + saml)TestEditEnterpriseResources— PASS (oidc + saml)TestAdminActionMFA/OIDCConnector— PASS, all subtestsThe new test was confirmed load-bearing: the gate was temporarily neutered, the "no service registered" subtest failed as expected, then reverted.
Reviewer notes
authtest.StubOIDCServicelives in a non-_test.gofile because it must be importable from bothlib/auth's tests andtool/tctl/common's.lib/auth/authtestis test infrastructure — its only non-test importers areintegration/db/fixture.goandintegrations/lib/testing/integration/authhelper.go, both themselves test helpers. It does not reach the shipped binary.🤖 Generated with Claude Code