Repository navigation
Check KF-Console-Token and call KF as the OIDC client - #3708
Merged
Merged
Conversation
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.
Merge only after kf-console #76 is deployed to production. On staging, the console must be running #76 before this goes to DuqDuq.
PubPub stops using the shared
AUTH_INTERNAL_API_KEY, as kf-console'sdocs/calling-kf.mddescribes.PubPub → KF. The orgs lookup, ban and unban sync, and the legacy
/api/logincheck now sendAuthorization: Basic base64(OIDC_CLIENT_ID:OIDC_CLIENT_SECRET), the client credentials PubPub already signs in with./api/logintakes the KF Auth path when the client secret is set, instead of when the key is set.KF → PubPub.
/api/kf/webhooks,/summary,/branding,/contextsand/usagenow check theKF-Console-Tokenheader withjose(new dependency), and no longer readAuthorization:<OIDC_ISSUER_INTERNAL_URL>/api/auth/jwks)iss<OIDC_ISSUER_URL>/api/auth,audOIDC_CLIENT_ID,subkf-console,exp(60s max age, 30s skew)htmis the method, andhtuisAPP_URLplus the route's path, not the URL the request arrived on.APP_URLmust behttps://www.pubpub.orgin prod andhttps://www.duqduq.orgon DuqDuq, the URLs registered in kf-console'sapps.*.yaml. It must already be, sinceREDIRECT_URIis built from it.body_sha256against the raw body.express.jsonkeeps the raw bytes for that path only, through itsverifyhook. The guards are registered withrouter.allahead of the routes, so the handlers are unchanged.Any failure answers 401.
Checked
fetch. They accept a good token on every route and a webhook with a matching body. They refuse a missing header, the old Bearer key alone, a wrongaud,suboriss, an expired token, a wronghtm, a wronghtu(including the request-as-seen URL), another signing key, a tampered body, and a webhook token with no body hash./api/logintest now expects Basic.pnpm run lint(biome and tsc) is green. The full suite (vitest --rununder the Firebase emulator, Node 24) passes: 789 passed, 3 skipped, 2 todo.After deploy, the
secret: ${KF_INTERNAL_API_KEY}on PubPub's webhook in kf-console can go, andAUTH_INTERNAL_API_KEYcan come out ofinfra/.env.enc,.env.dev.encand.env.local.enc. Nothing reads it any more.