Authentication
Authentication
Section titled “Authentication”Production mode is GOSHIKQ_AUTH_MODE=oidc. Local development may use none on loopback or api_key for service identities.
| Mode | Who | Binding |
|---|---|---|
none |
Single local owner (local-user, role owner) |
Loopback only unless GOSHIKQ_ALLOW_INSECURE_BIND=true |
api_key |
Hashed keys in api_keys |
Bearer or X-Api-Key |
oidc |
JWT users + optional API keys | Authorization: Bearer |
none is not a production setting.
OIDC / OAuth2
Section titled “OIDC / OAuth2”Validated with jsonwebtoken 12.0.0 (rust_crypto, patched for GHSA-h395-gr6q-cpjc / CVE-2026-25537). Checks: issuer, audience, expiry, nbf-when-present, signature. Required registered claims: exp, iss, aud, sub. String exp/nbf values are rejected. Signing keys come from GOSHIKQ_OIDC_JWKS_URL (HTTPS, or loopback HTTP in tests). Production algorithms: RS256/RS384/RS512, ES256/ES384, PS256/PS384/PS512. alg=none and HMAC are rejected unless loopback HMAC test mode is on.
Unknown kid forces a JWKS re-fetch so key rotation does not wait for the cache TTL (GOSHIKQ_OIDC_JWKS_CACHE_SECONDS, default 300).
Goshikq does not implement OAuth token revocation. A valid JWT works until exp. Cut access by deleting project_members or revoking API keys.
RS256 suite: python -m pytest tests/security/test_oidc_jwks.py. Hosted IdP (Entra/Keycloak/Auth0) has not been run in this milestone.
Required environment:
GOSHIKQ_AUTH_MODE=oidcGOSHIKQ_OIDC_ISSUER=https://idp.example.com/realms/goshikqGOSHIKQ_OIDC_AUDIENCE=goshikqGOSHIKQ_OIDC_JWKS_URL=https://idp.example.com/realms/goshikq/protocol/openid-connect/certsClaims used:
sub— user identity (must matchproject_members.subject)iss/aud/exp/nbf— standard validation- optional
goshikq_project_id,goshikq_tenant_id— hints; membership in PostgreSQL is authoritative
Project selection: X-Goshikq-Project-Id, else the claim, else the default project. Missing membership is 403.
Loopback HMAC (tests only)
Section titled “Loopback HMAC (tests only)”GOSHIKQ_OIDC_ALLOW_TEST_HMAC=true plus GOSHIKQ_OIDC_HMAC_SECRET is refused on non-loopback binds. Use GOSHIKQ_OIDC_BOOTSTRAP_OWNER to seed an owner on the default project at startup.
API keys (service identities)
Section titled “API keys (service identities)”Keys are stored as SHA-256 hashes. Plaintext is returned once. Fields: role, kind, expires_at, rotated_from.
POST /api/v1/api-keysPOST /api/v1/api-keys/{id}/rotatePOST /api/v1/api-keys/{id}/revokeExpired or revoked keys fail authentication. In oidc mode a token starting with axk_ is treated as an API key.
Studio never sends provider credentials to the browser. The Next.js proxy may attach GOSHIKQ_STUDIO_API_KEY server-side and forwards Authorization, X-Api-Key, and X-Goshikq-Project-Id.