[Resource Sharing] Allow specifying default access level in resouce access levels yml file#6018
Merged
cwperks merged 6 commits intoopensearch-project:mainfrom Mar 23, 2026
Merged
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6018 +/- ##
==========================================
- Coverage 73.88% 73.82% -0.07%
==========================================
Files 440 440
Lines 27229 27261 +32
Branches 4044 4053 +9
==========================================
+ Hits 20119 20126 +7
- Misses 5199 5215 +16
- Partials 1911 1920 +9
🚀 New features to boost your workflow:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
…urity into default-access-level
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
DarshitChanpura
approved these changes
Mar 23, 2026
Member
DarshitChanpura
left a comment
There was a problem hiding this comment.
LGTM! Default access level is a great addition to RP setup. We should update doc to explicitly mention which access levels will be default for each plugin, once they have it that is.
RyanL1997
approved these changes
Mar 23, 2026
Member
Author
I'll raise a PR to the documentation website repo |
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.
Description
Allows plugin authors to mark a default access level directly in their
resource-access-levels.ymlfile, reducing the burden on callers of the migration API.Category: Enhancement
Why these changes are required?
The migration API (
POST _plugins/_security/api/resources/migrate) previously required callers to explicitly supply adefault_access_levelfor every resource type being migrated. This is unnecessary friction — the plugin author already knows which access level is the safe default (typically the lowest-privilege one), and that knowledge belongs in the plugin's own definition rather than being re-specified at migration time.Old behavior:
default_access_levelwas a mandatory field in the migrate request body. Omitting it returned a400 Bad Request.New behavior: Plugin authors can mark one access level per resource type as the default by adding
default: trueinresource-access-levels.yml. Thedefault_access_levelfield in the migrate request becomes optional — when omitted, the registered default is used. If explicitly supplied, the request value takes precedence. If neither is available and the resource has backend roles to migrate, the API fails fast with a descriptive400rather than silently dropping the backend role assignments.Issues Resolved
N/A
Is this a backport? No.
Do these changes introduce new permission(s) to be displayed in the static dropdown on the front-end? No.
Testing
MigrateApiTestsintegration tests:testMigrateAPIWithSuperAdmin_noDefaultAccessLevel_usesRegisteredDefault— verifies that omittingdefault_access_levelsucceeds and sharing records are created using the yml-registered default (sample_read_only)testMigrateAPIWithSuperAdmin_noDefaultAccessLevel— updated to reflect that omittingdefault_access_levelis now valid when a registered default existsdefault_access_leveland invalid access level values continue to pass unchangedCheck List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.