-
Notifications
You must be signed in to change notification settings - Fork 0
AuthZService: improve authz caching #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cache-optimization-baseline
Are you sure you want to change the base?
AuthZService: improve authz caching #11
Conversation
* remove the use of client side cache for in-proc authz client Co-authored-by: Gabriel MABILLE <[email protected]> * add a permission denial cache, fetch perms if not in either of the caches Co-authored-by: Gabriel MABILLE <[email protected]> * Clean up tests Co-authored-by: Ieva <[email protected]> * Cache tests Co-authored-by: Ieva <[email protected]> * Add test to list + cache Co-authored-by: Ieva <[email protected]> * Add outdated cache test Co-authored-by: Ieva <[email protected]> * Re-organize metrics Co-authored-by: Ieva <[email protected]> --------- Co-authored-by: Gabriel MABILLE <[email protected]>
Codoki PR ReviewSummary: Harden denial cache keys, prevent collisions Issues (Critical & High only)
Showing top 1 issues. Critical: 0, High: 1. See inline suggestions for more. Key Feedback (click to expand)
Confidence: 3/5 — Needs work before merge (1 high · status: Requires changes) Sequence DiagramsequenceDiagram
participant Caller
participant Service
Caller->>Service: Check()
opt build permDenialKey
alt permDenialCache hit
Service-->>Caller: Allowed=false
else cache miss
Service->>Service: getCachedIdentityPermissions()
alt cached perms found
Service->>Service: checkPermission()
alt allowed
Service-->>Caller: Allowed=true
else not allowed
Service->>Service: getIdentityPermissions()
Service->>Service: checkPermission()
alt not allowed
Service->>Service: permDenialCache.Set()
Service-->>Caller: Allowed=false
else allowed
Service-->>Caller: Allowed=true
end
end
else not found
Service->>Service: getIdentityPermissions()
Service->>Service: checkPermission()
alt not allowed
Service->>Service: permDenialCache.Set()
Service-->>Caller: Allowed=false
else allowed
Service-->>Caller: Allowed=true
end
end
end
end
React with 👍 or 👎 if you found this review useful. |
| } | ||
|
|
||
| func userPermDenialCacheKey(namespace, userUID, action, name, parent string) string { | ||
| return namespace + ".perm_" + userUID + "_" + action + "_" + name + "_" + parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return namespace + ".perm_" + userUID + "_" + action + "_" + name + "_" + parent | |
| return namespace + ".perm_" + userUID + "_" + action + "\x1F" + name + "\x1F" + parent |
Mirrors ai-code-review-evaluation#2 for like-for-like benchmarking.
cache-optimization-baselineauthz-service-improve-caching-prOriginal PR excerpt: