Skip to content

Lazy compute and cache grantsAll per privilege#136684

Merged
slobodanadamovic merged 2 commits intoelastic:mainfrom
slobodanadamovic:sa-optimize-app-privileges-grants-check
Oct 16, 2025
Merged

Lazy compute and cache grantsAll per privilege#136684
slobodanadamovic merged 2 commits intoelastic:mainfrom
slobodanadamovic:sa-optimize-app-privileges-grants-check

Conversation

@slobodanadamovic
Copy link
Contributor

@slobodanadamovic slobodanadamovic commented Oct 16, 2025

This change avoids calling expensive Operations.isTotal every
time an application privilege is checked. This is done by caching
the result per privilege. It avoids re-building privilege's automaton
each time upstream ApplicationPermission#grants gets called.

This change avoids calling expensive `Operations.isTotal` every
time an application privilege is checked. This is done by caching
the result per privilege. It avoids re-building privilege's automaton
each time upstream `ApplicationPermission#grants` is called.
@slobodanadamovic slobodanadamovic self-assigned this Oct 16, 2025
@slobodanadamovic slobodanadamovic requested a review from a team as a code owner October 16, 2025 10:45
@slobodanadamovic slobodanadamovic added :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team auto-backport Automatically create backport pull requests when merged v9.2.0 v8.19.6 v9.1.6 v9.3.0 labels Oct 16, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@elasticsearchmachine
Copy link
Collaborator

Hi @slobodanadamovic, I've created a changelog YAML for you.

Copy link
Contributor

@jfreden jfreden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great improvement! 🚀

@slobodanadamovic slobodanadamovic merged commit 0b6338a into elastic:main Oct 16, 2025
40 checks passed
slobodanadamovic added a commit to slobodanadamovic/elasticsearch that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every 
time an application privilege is checked. This is done by caching 
the result per privilege. It avoids re-building privilege's automaton 
each time upstream `ApplicationPermission#grants` gets called.
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.2
8.19 Commit could not be cherrypicked due to conflicts
9.1

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 136684

slobodanadamovic added a commit to slobodanadamovic/elasticsearch that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every 
time an application privilege is checked. This is done by caching 
the result per privilege. It avoids re-building privilege's automaton 
each time upstream `ApplicationPermission#grants` gets called.
elasticsearchmachine pushed a commit that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every 
time an application privilege is checked. This is done by caching 
the result per privilege. It avoids re-building privilege's automaton 
each time upstream `ApplicationPermission#grants` gets called.
elasticsearchmachine pushed a commit that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every 
time an application privilege is checked. This is done by caching 
the result per privilege. It avoids re-building privilege's automaton 
each time upstream `ApplicationPermission#grants` gets called.
slobodanadamovic added a commit that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every
time an application privilege is checked. This is done by caching
the result per privilege. It avoids re-building privilege's automaton
each time upstream `ApplicationPermission#grants` gets called.

(cherry picked from commit 0b6338a)

# Conflicts:
#	x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/Privilege.java
elasticsearchmachine pushed a commit that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every
time an application privilege is checked. This is done by caching
the result per privilege. It avoids re-building privilege's automaton
each time upstream `ApplicationPermission#grants` gets called.

(cherry picked from commit 0b6338a)

# Conflicts:
#	x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/Privilege.java
Kubik42 pushed a commit to Kubik42/elasticsearch that referenced this pull request Oct 16, 2025
This change avoids calling expensive `Operations.isTotal` every 
time an application privilege is checked. This is done by caching 
the result per privilege. It avoids re-building privilege's automaton 
each time upstream `ApplicationPermission#grants` gets called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending >enhancement :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team v8.19.6 v9.1.6 v9.2.0 v9.3.0

3 participants