feat(connectivity): protect connectivity-api with the stack auth issuer - #522
Draft
Dav-14 wants to merge 2 commits into
Draft
feat(connectivity): protect connectivity-api with the stack auth issuer#522Dav-14 wants to merge 2 commits into
Dav-14 wants to merge 2 commits into
Conversation
When the stack has an Auth module, wire spec.api.auth on the delegated Connectivity resource through auths.GetProtectedConfiguration, mirroring how ledger and payments self-verify bearer tokens: issuer from the stack auth URL, scope checking driven by the auth.connectivity.check-scopes Setting. Without an Auth module the api.auth block is cleared and the API keeps running unauthenticated.
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…yments The connectivity module delegates its workloads to a connectivity.formance.com Connectivity resource, so the applications package's withJsonLogging mutator — which sets JSON_FORMATTING_LOGGER on Deployments the operator owns — never reaches them. Wire the same platform-wide logging.json Setting through spec.monitoring.logs.format on the delegated resource instead: the connectivity operator turns that field into JSON_FORMATTING_LOGGER on the core, connectivity-api and connector workloads. The format is independent of telemetry export, so the monitoring block is now emitted for json logging alone (carrying no enabled signal) and pruned only once both telemetry and json logging are off. Only "json" is forwarded; the CRD already defaults the field to "text".
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.
Problem
The
connectivity-apicompanion is exposed through the stack gateway at/api/connectivity, but nothing wires its OIDC protection: the module reconciler never setsspec.api.authon the delegatedconnectivity.formance.com/Connectivity, so the connectivity operator renders the API pod withAUTH_ENABLED=false. The gateway does not enforce auth per route either (theSecuredrule flag is not rendered in the Caddyfile), so on a stack with an Auth module — where ledger and payments self-verify bearer tokens — connectivity-api is the only module API reachable without a token.Fix
connectivities.Reconcilenow resolves the module's protection through the sharedauths.GetProtectedConfiguration(the same machinery behind ledger/paymentsAUTH_ENABLED/AUTH_ISSUER):spec.api.auth.issueris set to the stack auth issuer andspec.api.auth.checkScopesfollows theauth.connectivity.check-scopesSetting (platform default: false);spec.api.authis removed and the API keeps running unauthenticated (behind-VPN / in-cluster deployments);APIAuthResolveFailedcondition.checkScopesis always set explicitly because the connectivity CRD defaults it to true while the platform convention defaults to false. The connectivity CRD models a single trusted issuer, so additionalauth.issuersSettings entries are not propagated.Also adds
docs/04-Modules/12-Connectivity.md(the module had no page), covering the module basics and the auth behavior.Tests
internal/resources/connectivities/init_test.go:checkScopes: falsewired when the stack has an Auth module (written first, watched fail);checkScopes: truewhen theauth.connectivity.check-scopesSetting is enabled (written first, watched fail);spec.api.authcleared when the stack has no Auth module (written first, watched fail);APIAuthResolveFailedcondition when the Auth lookup fails (interceptor, added for error-branch coverage).just pre-commit(tidy, lint, generate, manifests, helm validate, docs, settings catalog) — no generated drift.Stack created with GitHub Stacks CLI • Give Feedback 💬