Skip to content

Realm/tenant context-lock for app-service identity (Keycloak, Auth0, Clerk) #38

Closed

Description

@sandstream

Follow-up to the SSH-identity context-lock (#37) and the git-host locks (#35).

Layer distinction

The existing [context] lock is developer/CLI identity ("am I acting as the right me?" — gcloud account, vercel team, github/gitlab/bitbucket org, SSH key). That family is now complete.

This issue is the app-service-config layer: the app's identity provider / backend, currently handled as [secrets] (e.g. the Keycloak registry entry carries KEYCLOAK_REALM, KEYCLOAK_CLIENT_ID/SECRET, KEYCLOAK_ADMIN). It is not a CLI identity, so it does not belong in the dev-identity lock — but it has the same cross-environment contamination risk.

The risk

Pointing dev at the PROD realm/tenant (or staging at prod) is the service-config analog of pushing as the wrong account: e.g. a dev .env.local with the production KEYCLOAK_REALM / AUTH0_DOMAIN. Today nothing verifies the live config value matches what the project + environment should use.

Proposal: a [context]-style check on declared config values

A per-project, per-environment lock on identity-provider config keys:

  • Declare expected values per env, e.g. [context.keycloak] realm = "kjorre-dev" (dev) vs "kjorre-prod" (prod), [context.auth0] domain = "...", [context.clerk] instance = "...".
  • kit context check reads the live resolved value (from the env / vault-resolved secret) and verifies it matches the declared value for the active environment.
  • Mismatch (dev resolving the prod realm) → flagged, not a silent pass. Reuses the existing compareContext (tool, field) model — these are config values, read from secrets/env rather than a CLI.

Open questions

  • Where to read the live value: resolved [secrets] value vs raw env vs the IdP's own API. Local/deterministic preferred (resolved secret/env), per kit's local-first posture.
  • Whether to generalize to "any declared service config key per env" rather than per-provider blocks.
  • Tie-in with governance.environment (dev/staging/prod) for the active-env selection.

Scope: design + a compareContext-style extension; no live IdP calls in v1 (compare the resolved config value).

Activity

  1. added a commit that references this issue on Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions