Skip to content

fix: remove api keys from principal context#295

Closed
rpatel-scale wants to merge 3 commits into
mainfrom
codex/remove-api-key-from-principal-context
Closed

fix: remove api keys from principal context#295
rpatel-scale wants to merge 3 commits into
mainfrom
codex/remove-api-key-from-principal-context

Conversation

@rpatel-scale

Copy link
Copy Markdown
Contributor

Summary

  • Remove API-key fields from auth gateway principal contexts before assigning request.state.principal_context.
  • Sanitize cached auth gateway principals before write and read, so cached values cannot reintroduce api_key.
  • Add focused unit coverage for recursive key removal and sanitized auth gateway/cache behavior.

Validation

  • uv run --project agentex ruff check agentex/src/api/schemas/principal_context.py agentex/src/api/middleware_utils.py agentex/src/api/authentication_middleware.py agentex/src/api/authentication_cache.py agentex/tests/unit/api/test_principal_context.py agentex/tests/unit/api/test_authentication_cache_metrics.py
  • uv run --project agentex --group test pytest agentex/tests/unit/api/test_principal_context.py agentex/tests/unit/api/test_authentication_cache_metrics.py
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant