Add benchmarks and documentation for IAM policy performance characteristics#1694
Open
Add benchmarks and documentation for IAM policy performance characteristics#1694
Conversation
|
|
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize IAM-like policy system design
Add benchmarks and documentation for IAM policy performance characteristics
Jan 25, 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.
Users reported significant performance degradation when using explicit allow/deny effect fields (
p_eft) versus separate policy types for IAM-like authorization systems.Analysis
The ~2x performance difference is fundamental to the evaluation semantics:
p_eft): Short-circuits on first matching allow. Average N/2 policy evaluations.p_eft): Must evaluate all N policies since deny can appear anywhere.This is correct behavior for AWS IAM-like semantics, not a performance bug.
Changes
Benchmarks (
iam_optimization_b_test.go):BenchmarkIAMWithoutEffectField/BenchmarkIAMWithEffectFieldDocumentation (
docs/IAM_POLICY_OPTIMIZATION.md):Example
Use Option 1 for performance-critical allow-only systems. Use Option 2 when deny semantics are required and 2x overhead is acceptable.
Original prompt
This section details on the original issue you should resolve
<issue_title>[Question] Optimization for IAM-like policies</issue_title>
<issue_description>Hello,
I'm trying to design an AWS IAM like system where we have a set of resources which you can "allow" or "deny" for certain roles and users.
My Initial was this:
Initial Option: Model
Initial Option: Policy
I find it's not ideal because I would need to duplicate every
pto have one fordenyand one forallow.So My second option is this:
Tentative Option; Model
Tentative Option; Policy