Log Auth0 client IDs in Cloud Run gateway request logs - #1650
Merged
Conversation
anth-volk
marked this pull request as ready for review
August 12, 2026 18:33
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.
Fixes #1649
Summary
client_id,azp, or machine-to-machinesubclaimsauth0_client_idonly to the Cloud Run gateway's canonical request-completion logWhy
Gateway logs already contain request ID, route, status, duration, and backend, but the gateway previously only forwarded bearer tokens and had no trusted application client ID to record. Using the generic observability setter would also have promoted the high-cardinality value into tracing, so this change adds a log-only request-context path.
Attribution is best effort and never changes routing or the worker's authoritative authentication decision. Invalid or unavailable attribution omits the field, and bearer tokens and authorization headers are never logged.
JWKS successes are cached for five minutes and refreshed when stale or when a JWT identifies a key absent from the cached set. Concurrent cold-cache or forced refreshes share one outbound request per issuer; refresh failures retain the last known-good set, and successful or failed attempts impose a 30-second minimum retry interval.
PolicyEngine's staging and production deploy jobs provide
AUTH0_ADDRESS_NO_DOMAINandAUTH0_AUDIENCE_NO_DOMAINfrom repository secrets, and a workflow-level test pins that contract. The generic deploy wrapper omits either variable when unset so local and third-party deployments remain usable without Auth0 configuration.Validation
uv run pytest -q tests/unit/auth/test_validation.py— 41 passeduv run pytest -q .github/scripts/test_cloud_run_deploy_failover.py .github/scripts/test_deploy_staged_workflow.py— 14 passedmake test— 755 passed, 1 skippedmake test-with-auth— 7 passedmake test-analytics-isolated— 7 passed; Authlib/Joserfc remained outside the writer closuremake format-check— passedbash -n, andgit diff --check— passeduv lock --check— passedbash .github/scripts/check-changelog-fragment.sh— passed