fix(authz): check authorization through gateway#304
Merged
deepthi-rao-scale merged 1 commit intoJun 12, 2026
Merged
Conversation
fa2e9cd to
f72c9ad
Compare
f72c9ad to
38bb4fa
Compare
728e692 to
132fbc7
Compare
132fbc7 to
0c7a89a
Compare
800b7e0 to
e1a4fcb
Compare
rpatel-scale
approved these changes
Jun 12, 2026
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.
Summary
Why
Sharing/revoking permissions updates Spark directly, but Agentex's local authorization-check cache was not centrally managed or invalidated by Spark. A cached allow/deny could remain stale until TTL expiry, so checks now ask Spark for current permission state.
Test Plan
Note: local execution of the Docker-backed integration test was blocked because Docker was unavailable in this environment; CI should run it with Docker.
Greptile Summary
This PR removes the local in-process authorization-check cache from
AuthorizationService.check, routing everycheckcall directly to the Spark gateway so that share/revoke changes are immediately visible rather than waiting for a TTL expiry.authorization_service.py: Drops theget_auth_cacheimport and removes the cache read/write blocks fromcheck(), leaving the method as a thin pass-through toself.gateway.check.test_authorization_service_cache.py: New parametrized unit test covering all four resource types (agent, task, api_key, schedule) to confirmgateway.checkis called on every invocation.test_agents_auth_api.py: Updatestest_agent_checkto assert one/v1/authz/checkcall on the second HTTP request (previously zero, thanks to the now-removed cache);test_agent_listis unchanged becauselist_resourceswas never cached.Confidence Score: 5/5
Safe to merge — the change is a targeted removal of a stale local cache with no risk of data loss or regression in authorization decisions.
The diff is a clean deletion of ~20 lines of caching logic. The gateway call it exposed already existed and is exercised by both the new parametrized unit test and the updated integration test. The list_resources path (authz/search) was already uncached and is unaffected. No new code paths are introduced.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant AuthorizationService participant SparkGateway Note over AuthorizationService: Before this PR Client->>AuthorizationService: check(resource, op) [call 1] AuthorizationService->>SparkGateway: gateway.check(...) SparkGateway-->>AuthorizationService: allowed/denied AuthorizationService-->>Client: result (cached locally) Client->>AuthorizationService: check(resource, op) [call 2] Note over AuthorizationService: Cache HIT – no RPC AuthorizationService-->>Client: cached result (possibly stale) Note over AuthorizationService: After this PR Client->>AuthorizationService: check(resource, op) [call 1] AuthorizationService->>SparkGateway: gateway.check(...) SparkGateway-->>AuthorizationService: allowed/denied AuthorizationService-->>Client: result Client->>AuthorizationService: check(resource, op) [call 2] AuthorizationService->>SparkGateway: gateway.check(...) SparkGateway-->>AuthorizationService: allowed/denied (always fresh) AuthorizationService-->>Client: resultReviews (2): Last reviewed commit: "fix(authz): check authorization through ..." | Re-trigger Greptile