mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 20:04:31 +00:00
Bringing the long-running session-feature branch back into main in one deliberate sweep. The branch carried the cluster work that's been live for weeks (cross-cluster CNPG metrics, Grafana w/ Google OAuth, supabase oauth2-proxy, cluster recovery, pg.0.knoe.dev + per-engineer onboarding, GCS-backed CNPG backups via Workload Identity, the env-contamination guard, the Junie brief queue, the cnpg-grafana CSRF + memory-request fixes from today), while main accumulated Junie's parallel knoe-auth Phase 2 OIDC work (full provider surface: discovery, authorize, token, userinfo, JWKS, RS256 signing, code exchange, session services). Key decision: the two branches did COMPETING rebrands off the same starting point (5ba9b63, 2026-04-27): - claude branch (commit b355855, earlier): org.prole.authority.* → dev.knoe.auth.* (artifact renamed to knoe-auth.jar) - main (commit9daa94b, recent): org.prole.authority.* → dev.knoe.authority.* (kept "authority" artifact name) dev.knoe.auth wins: cluster runs from this name, the Maven artifact is already knoe-auth.jar, and the broader rename is the documented namespace direction (per ~/.claude/projects/-Users-chrisfu-dev-knoe-db/ memory/MEMORY.md). All of main's recent Phase 2 OIDC content was ported from authority/src/.../dev/knoe/authority/ into authority/src/.../dev/knoe/auth/ with package declarations rewritten. == File-level resolution summary == Textual conflicts (4): authority/pom.xml - Took our artifactId="auth" - Took our branch's removal of spring-security-kerberos-client (verified: Junie's Phase 2 OIDC code does not import it; the dep was already-dead config) docs/pipeline-phases.md - Took our branch's "Phase 1 not started" status. Main had a misplaced "✅ Complete" with a knoe-auth-Phase-1 commit ref in the autobuild Phase 1 section — different domain. docs/plans/knoe-auth-round-1.md - Took our branch's dev.knoe.auth file table (vs main's dev.knoe.authority listing). Pure rename mismatch. supabase/helm/knoe-supabase/templates/kong/config.yaml - Took our branch's onboard route + plain dashboard wiring. Main had an oauth2proxy.enabled toggle that put oauth2-proxy as a Kong upstream — but the deployed architecture (commit 25f1b2e) has oauth2-proxy in FRONT of Kong, not behind. Main's wrapper reflected an architecture that was never deployed. - Took our branch's removal of basic-auth from dashboard route (queue #15 brief still tracks the matching values.yaml / kong/deployment.yaml cleanup). Java tree reconciliation (44 file-pairs): 20 dual-path source files + 2 dual-path tests Body-identical between main's authority/ and our branch's auth/ after stripping package decls — main's commit9daa94bwas a pure rebrand. Took our branch's auth/ version for all 22. 8 main-only source files (Phase 2 OIDC), ported into auth/: web/JwksController.java web/OidcAuthorizeController.java web/OidcDiscoveryController.java web/OidcTokenController.java web/OidcUserInfoController.java session/OidcCodeService.java session/OidcTokenService.java session/SessionService.java 12 main-only test files, ported into auth/: HealthControllerTest.java enroll/EnrollValueTypesTest.java enroll/EnrollmentControllerTest.java enroll/TotpServiceTest.java kerberos/KadminClientTest.java kerberos/KerberosSpnegoResultTest.java web/LoginControllerTest.java admin/AdminControllerTest.java user/PrincipalNormalizerTest.java regression/IdentityRegressionTest.java session/OidcCodeServiceTest.java session/SessionServiceTest.java Port mechanics: read main:authority/...<file> via git show, then sed rewrite `package dev.knoe.authority` → `package dev.knoe.auth` and `import dev.knoe.authority` → `import dev.knoe.auth`. Body content unchanged. authority/src/main/java/dev/knoe/authority/ — DELETED (duplicate) authority/src/test/java/dev/knoe/authority/ — DELETED (duplicate) == Verification == - grep -rln '<<<<<<<' across .java/.md/.yaml/.yml/.sh/.xml/.tpl: clean - find authority/src -path '*/dev/knoe/authority*': empty (subtree gone) - grep 'package dev.knoe.authority' across repo: clean - bash -n install.sh deploy.sh etc/preflight_kubecontext.sh: clean - git ls-files -u | wc -l: 0 unmerged paths - helm lint supabase/helm/knoe-supabase: pre-existing failure on studioIngress.enabled undefined in values.yaml (introduced by Junie on main; unrelated to this merge — flagging as follow-up). == Followups (carried into TODO ranked queue or noted here) == - helm lint failure: studioIngress block in values.yaml is missing enable flag; templates/studio/{ingress,oauth2proxy-deployment, oauth2proxy-service}.yaml all reference studioIngress.enabled with no default. Pre-existing on main; not introduced by this merge. - The five Junie briefs filed on this branch are now reachable from main at docs/plans/junie/{02,06,07,13,15}-*.md. Junie can pick them up in any order. - knoe-auth Phase 2 OIDC source (now at dev.knoe.auth.*) is not yet deployed to the cluster. Deployment is its own task. - The branch claude/crazy-bose-fec256 stays in place (worktree at .claude/worktrees/crazy-bose-fec256 may have ongoing context for Claude Code sessions). Safe to delete once next session starts cleanly from main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
194 lines
6.7 KiB
YAML
194 lines
6.7 KiB
YAML
# oauth2-proxy gate in front of Supabase Studio at db.0.knoe.dev.
|
|
#
|
|
# Sits between the GCE Ingress and supabase-kong; redirects unauthenticated
|
|
# requests to Google Workspace, allows any @knoey.com identity through, then
|
|
# proxies the request upstream to supabase-kong:8000 (which serves Studio at
|
|
# the / route). Outside-domain users are rejected at this layer.
|
|
#
|
|
# Bootstrap: ./etc/init_oauth2_proxy.sh
|
|
# Cluster: knoe-dev-0 (GKE app cluster)
|
|
# Namespace: supabase (alongside supabase-* workloads + the existing Ingress)
|
|
#
|
|
# After this Deployment is Ready, the supabase-kong Ingress is patched to
|
|
# route db.0.knoe.dev through oauth2-proxy:80, and the basic-auth plugin on
|
|
# the Kong dashboard route is removed (oauth2-proxy is the gate now).
|
|
#
|
|
# Unified host model (Studio + SDK on the same hostname):
|
|
# the `--skip-auth-route` args below let SDK requests on /auth/v1, /rest/v1,
|
|
# /realtime/v1, /storage/v1, /functions/v1, /graphql/v1, /pg/* bypass the
|
|
# Google sign-in flow and pass straight through to supabase-kong, where
|
|
# Kong's `key-auth` plugin enforces the existing anon/service-role API keys.
|
|
# The Studio UI at / remains Google-gated (no skip rule). Net effect: one
|
|
# URL (db.0.knoe.dev) covers humans-in-Studio AND robots-via-supabase-py,
|
|
# with the same security envelope as before — Kong's key-auth is the
|
|
# enforcer on API paths regardless of which hostname they came in on.
|
|
#
|
|
# When knoe-auth Round 1 ships an OIDC OP at https://api.knoe.dev/auth, swap
|
|
# the args below from `--provider=google` to `--provider=oidc` +
|
|
# `--oidc-issuer-url=https://api.knoe.dev/auth` and reapply — no other
|
|
# manifest changes needed.
|
|
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: oauth2-proxy
|
|
namespace: supabase
|
|
labels:
|
|
app: oauth2-proxy
|
|
app.kubernetes.io/managed-by: knoe-installer
|
|
---
|
|
apiVersion: cloud.google.com/v1
|
|
kind: BackendConfig
|
|
metadata:
|
|
name: oauth2-proxy-backend-config
|
|
namespace: supabase
|
|
labels:
|
|
app: oauth2-proxy
|
|
app.kubernetes.io/managed-by: knoe-installer
|
|
spec:
|
|
healthCheck:
|
|
type: HTTP
|
|
requestPath: /ping
|
|
port: 4180
|
|
timeoutSec: 60
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: oauth2-proxy
|
|
namespace: supabase
|
|
labels:
|
|
app: oauth2-proxy
|
|
app.kubernetes.io/managed-by: knoe-installer
|
|
annotations:
|
|
cloud.google.com/backend-config: '{"default": "oauth2-proxy-backend-config"}'
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: oauth2-proxy
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
targetPort: 4180
|
|
protocol: TCP
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: oauth2-proxy
|
|
namespace: supabase
|
|
labels:
|
|
app: oauth2-proxy
|
|
app.kubernetes.io/managed-by: knoe-installer
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 0
|
|
selector:
|
|
matchLabels:
|
|
app: oauth2-proxy
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: oauth2-proxy
|
|
spec:
|
|
serviceAccountName: oauth2-proxy
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 65532
|
|
runAsGroup: 65532
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: oauth2-proxy
|
|
image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.2
|
|
imagePullPolicy: IfNotPresent
|
|
args:
|
|
- --provider=google
|
|
- --email-domain=knoey.com
|
|
- --upstream=http://supabase-kong:8000
|
|
- --http-address=0.0.0.0:4180
|
|
- --reverse-proxy=true
|
|
- --cookie-secure=true
|
|
- --cookie-name=_knoe_studio_oauth2
|
|
- --cookie-domain=db.0.knoe.dev
|
|
- --whitelist-domain=db.0.knoe.dev
|
|
- --redirect-url=https://db.0.knoe.dev/oauth2/callback
|
|
- --skip-provider-button=true
|
|
- --scope=openid email profile
|
|
# NB: do NOT set --pass-authorization-header / --set-authorization-header.
|
|
# Those flags rewrite (or strip) the request's Authorization header,
|
|
# which clobbers the supabase-py / Studio Authorization: Bearer <apikey>
|
|
# value that the storage and other Supabase services expect to parse
|
|
# against JWT_SECRET. When per-user identity passthrough lands (post
|
|
# knoe-auth Round 1), use --pass-user-headers / --set-xauthrequest
|
|
# instead — those use X-Forwarded-* headers and don't collide with
|
|
# Supabase's own auth.
|
|
#
|
|
# Bypass Google auth for Supabase API surfaces — Kong's key-auth
|
|
# is the enforcer on these paths (anon / service-role keys).
|
|
- --skip-auth-route=^/(auth|rest|realtime|storage|functions|graphql)/v1/.*
|
|
- --skip-auth-route=^/pg/.*
|
|
# Bypass Google auth for the onboarding reveal page. URL fragments
|
|
# don't survive an OAuth redirect, so we can't gate this with
|
|
# Google sign-in; instead, the engineer's URL is single-shot
|
|
# delivery (email / QR), the temp password expires in 24h, and
|
|
# the page recommends immediate rotation via `\password`.
|
|
- --skip-auth-route=^/onboard\.html$
|
|
# Public support endpoint — 302s to mailto:support@knoe.dev. Skipping
|
|
# auth so an unauthenticated user looking for help isn't bounced into
|
|
# a confusing Google sign-in detour.
|
|
- --skip-auth-route=^/support$
|
|
- --request-logging=true
|
|
- --auth-logging=true
|
|
- --standard-logging=true
|
|
env:
|
|
- name: OAUTH2_PROXY_CLIENT_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: oauth2-proxy-google-oidc
|
|
key: client_id
|
|
- name: OAUTH2_PROXY_CLIENT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: oauth2-proxy-google-oidc
|
|
key: client_secret
|
|
- name: OAUTH2_PROXY_COOKIE_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: oauth2-proxy-google-oidc
|
|
key: cookie_secret
|
|
ports:
|
|
- name: http
|
|
containerPort: 4180
|
|
protocol: TCP
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: http
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: http
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
resources:
|
|
requests:
|
|
cpu: 50m
|
|
memory: 64Mi
|
|
limits:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
readOnlyRootFilesystem: true
|