Skip to content

fix(agents-api): wire CREDENTIAL_INGEST_BEARER so credential ingest stops 401-ing#737

Merged
ExtraToast merged 1 commit into
mainfrom
fix/agents-api-credential-ingest-bearer
Jun 26, 2026
Merged

fix(agents-api): wire CREDENTIAL_INGEST_BEARER so credential ingest stops 401-ing#737
ExtraToast merged 1 commit into
mainfrom
fix/agents-api-credential-ingest-bearer

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

What was broken

After the worker started reaching agents-api (the lease fix in #736), submitting an authorization code failed with:

agents-api credential ingest failed: 401 {"status":401,"error":"Unauthorized","path":"/api/v1/internal/credentials"}

Root cause

/api/v1/internal/credentials is guarded by InternalBearerAuthFilter(props.credentialIngestBearer). That property is sourced from CREDENTIAL_INGEST_BEARER, which the agents-api Deployment never set. With no configured bearer the filter takes its expected == null branch and rejects every request as "Internal endpoint not configured" (surfaced to the browser as a bare 401).

The agents-login worker already presents the shared agents-login-internal token as its Authorization: Bearer. The Deployment only wired that secret into INTERNAL_TOKEN (the token agents-api uses to call the worker), not into the ingest bearer the filter checks.

Fix

Both agents-api Deployments (deployment.yaml and deployment-enschede-ws.yaml) now source CREDENTIAL_INGEST_BEARER from agents-login-internal/token — the same secret key the worker presents — so expected and presented tokens match.

Validation

kubectl kustomize platform/cluster/flux/apps/stateless/agents-api renders both deployments with CREDENTIAL_INGEST_BEARER; platform tests pass (56/56).

…uthenticates

Posting a captured credential to /api/v1/internal/credentials returned 401
Unauthorized. The endpoint is guarded by InternalBearerAuthFilter, which
compares the request's bearer against CREDENTIAL_INGEST_BEARER. The agents-api
Deployment never set that variable, so the filter had no expected token and
rejected every request as "Internal endpoint not configured".

The agents-login worker already presents the shared agents-login-internal
token as its bearer. Both agents-api Deployments now source
CREDENTIAL_INGEST_BEARER from the same secret key, so the presented and
expected tokens match.
@ExtraToast ExtraToast added the bug Something isn't working label Jun 26, 2026
@ExtraToast ExtraToast self-assigned this Jun 26, 2026
@ExtraToast ExtraToast added the bug Something isn't working label Jun 26, 2026
@ExtraToast ExtraToast merged commit e78fe32 into main Jun 26, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant