Skip to content

AGX1-356: Invalidate authz cache for changed principal#304

Draft
deepthi-rao-scale wants to merge 1 commit into
mainfrom
deepthirao/agx1-356-invalidate-agentex-authz-cache-immediately-after-grant
Draft

AGX1-356: Invalidate authz cache for changed principal#304
deepthi-rao-scale wants to merge 1 commit into
mainfrom
deepthirao/agx1-356-invalidate-agentex-authz-cache-immediately-after-grant

Conversation

@deepthi-rao-scale

@deepthi-rao-scale deepthi-rao-scale commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • evict cached authorization checks only for the changed resource and effective principal after Agentex-mediated authz mutations: grant, revoke, register_resource, and deregister_resource
  • keep cached authorization checks for other principals on the same resource intact
  • bypass authorization-check cache lookups and writes for API-key auth contexts, where Spark AuthZ changes can happen outside Agentex
  • avoid logging principal context or secret-bearing values from cache invalidation paths

Why

AGX1-323 deployment authz e2e found that actor permissions can be changed while Agentex still has a positive authorization decision cached. The authorization cache TTL is 300 seconds, so stale allows can persist until expiry.

For grant changes made through Agentex, this PR now evicts only the cache entries for the changed resource/effective-principal pair. For direct Spark AuthZ changes that bypass Agentex, there is no Agentex invalidation signal, so API-key auth contexts skip the local authz cache and re-check AuthZ on each request.

Linear: https://linear.app/scale-epd/issue/AGX1-356/invalidate-agentex-authz-cache-immediately-after-grant-changes

Test Plan

  • uv run --group test pytest tests/unit/services/test_authorization_service_cache.py::test_authorization_mutations_only_clear_checks_for_mutated_principal -q
  • uv run --group test pytest tests/unit/api/test_authentication_cache_metrics.py tests/unit/services/test_authorization_service_cache.py tests/unit/services/test_authorization_service_logging.py -q
  • uv run --group test pytest tests/unit/api/test_agents_authz.py tests/unit/api/test_tasks_authz.py -q

@deepthi-rao-scale deepthi-rao-scale requested a review from a team as a code owner June 12, 2026 04:59
@deepthi-rao-scale deepthi-rao-scale marked this pull request as draft June 12, 2026 04:59
@deepthi-rao-scale deepthi-rao-scale force-pushed the deepthirao/agx1-356-invalidate-agentex-authz-cache-immediately-after-grant branch from fa2e9cd to f72c9ad Compare June 12, 2026 05:09
@deepthi-rao-scale deepthi-rao-scale changed the title AGX1-356: Skip authz cache for API-key principals AGX1-356: Invalidate authz cache on grant changes Jun 12, 2026
@deepthi-rao-scale deepthi-rao-scale force-pushed the deepthirao/agx1-356-invalidate-agentex-authz-cache-immediately-after-grant branch from f72c9ad to 38bb4fa Compare June 12, 2026 05:14
@deepthi-rao-scale deepthi-rao-scale changed the title AGX1-356: Invalidate authz cache on grant changes AGX1-356: Invalidate authz cache for changed resources Jun 12, 2026
@deepthi-rao-scale deepthi-rao-scale force-pushed the deepthirao/agx1-356-invalidate-agentex-authz-cache-immediately-after-grant branch from 38bb4fa to 728e692 Compare June 12, 2026 05:20
@deepthi-rao-scale deepthi-rao-scale force-pushed the deepthirao/agx1-356-invalidate-agentex-authz-cache-immediately-after-grant branch from 728e692 to 132fbc7 Compare June 12, 2026 05:22
@deepthi-rao-scale deepthi-rao-scale changed the title AGX1-356: Invalidate authz cache for changed resources AGX1-356: Invalidate authz cache for changed principal Jun 12, 2026
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