-
Notifications
You must be signed in to change notification settings - Fork 0
[CLEAN] Synthetic Benchmark PR #137712 - Add User Profile Size Limit Enforced During Profile Updates #31
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: base_pr_137712_20251204_2220
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
Benchmark PR elastic#137712
Type: Clean (correct implementation)
Original PR Title: Add User Profile Size Limit Enforced During Profile Updates
Original PR Description: Currently, there are no limits on the size of a user profile. Profiles store username, initials, avatars, etc.
Authorized Kibana observability clients can store an unlimited amount of data in user profile via update-profile.
This change puts a limit on profile size to avoid heap memory pressure and OOM crashes.
A new configuration setting,
xpack.security.profile.max_size, was introduced with a default value of 10 MB to remain safely above the 1 MB request limit size enforced by Kibana.Limit enforcement is implemented with a profile document read before the update, to provide a full view of the profile footprint. This approach is intended to be lightweight. Still, a document read is now incurred for every update request.
Original PR URL: elastic#137712
PR Type
Enhancement
Description
Add configurable user profile size limit to prevent heap memory pressure
Implement profile size validation before update operations
Introduce
xpack.security.profile.max_sizesetting with 10 MB defaultAdd comprehensive tests for profile size quota enforcement
Diagram Walkthrough
flowchart LR A["Profile Update Request"] --> B["Fetch Current Profile"] B --> C["Validate Combined Size"] C --> D{Size within Limit?} D -->|Yes| E["Execute Update"] D -->|No| F["Reject with Error"] E --> G["Update Successful"] F --> H["BAD_REQUEST Exception"]File Walkthrough
ProfileService.java
Implement profile size validation and configurationx-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/profile/ProfileService.java
MAX_SIZE_SETTINGconfiguration for profile size limit (default 10MB)
maxProfileSizeas instance variable initialized from settingsvalidateProfileSize()method to check combined profile sizeagainst limit
combineMaps(),mapFromBytesReference(),serializationSize()updateProfileData()to fetch current profile and validate sizebefore update
Security.java
Register profile size limit settingx-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
ProfileService.MAX_SIZE_SETTINGin the security settings listProfileServiceTests.java
Add unit tests for profile size validationx-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/profile/ProfileServiceTests.java
serializationSize()method with various map inputsmapFromBytesReference()with null and JSON inputscombineMaps()with nested map mergingvalidateProfileSize()with size limit enforcementProfileIntegTests.java
Add integration test for profile quota enforcementx-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/profile/ProfileIntegTests.java
testUpdateProfileDataHitStorageQuota()to verifyquota enforcement
new key
137712.yaml
Add changelog entry for profile size limitdocs/changelog/137712.yaml