-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Grant necessary Kibana application privileges to reporting_user role
#118058
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
Merged
elasticsearchmachine
merged 11 commits into
elastic:main
from
slobodanadamovic:sa-grant-kibana-app-privileges-to-reporting-user
Dec 13, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e4421be
Grant necessary Kibana application privileges to `reporting_user` role
slobodanadamovic ea6538c
Update docs/changelog/118058.yaml
slobodanadamovic 2fff424
Merge branch 'main' into sa-grant-kibana-app-privileges-to-reporting-…
slobodanadamovic 3c15133
test application privileges for reporting_user role
slobodanadamovic b793000
Merge branch 'main' into sa-grant-kibana-app-privileges-to-reporting-…
slobodanadamovic cbd0742
remove deprecation warning
slobodanadamovic 4217052
update `reporting_user` docs and description
slobodanadamovic 659734a
Merge branch 'main' of github.com:elastic/elasticsearch into sa-grant…
slobodanadamovic 04d7d0a
fix tests
slobodanadamovic 580ed80
apply review suggestions
slobodanadamovic 41e3b74
Merge branch 'main' into sa-grant-kibana-app-privileges-to-reporting-…
slobodanadamovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 118058 | ||
| summary: Grant necessary Kibana application privileges to `reporting_user` role | ||
| area: Authorization | ||
| type: enhancement | ||
| issues: [] |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2646,12 +2646,57 @@ public void testReportingUserRole() { | |
| RoleDescriptor roleDescriptor = ReservedRolesStore.roleDescriptor("reporting_user"); | ||
| assertNotNull(roleDescriptor); | ||
| assertThat(roleDescriptor.getMetadata(), hasEntry("_reserved", true)); | ||
| assertThat(roleDescriptor.getMetadata(), hasEntry("_deprecated", true)); | ||
|
|
||
| final String applicationName = "kibana-.kibana"; | ||
|
|
||
| final Set<String> applicationPrivilegeNames = Set.of( | ||
| "feature_discover.minimal_read", | ||
| "feature_discover.generate_report", | ||
| "feature_dashboard.minimal_read", | ||
| "feature_dashboard.generate_report", | ||
| "feature_dashboard.download_csv_report", | ||
| "feature_canvas.minimal_read", | ||
| "feature_canvas.generate_report", | ||
| "feature_visualize.minimal_read", | ||
| "feature_visualize.generate_report" | ||
| ); | ||
|
|
||
| final Set<String> allowedApplicationActionPatterns = Set.of( | ||
| "login:", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are only test examples of allowed actions and are not ment to represent the accurate list of actions. |
||
| "app:discover", | ||
| "app:canvas", | ||
| "app:kibana", | ||
| "ui:catalogue/canvas", | ||
| "ui:navLinks/canvas", | ||
| "ui:catalogue/discover", | ||
| "ui:navLinks/discover", | ||
| "ui:navLinks/kibana", | ||
| "saved_object:index-pattern/*", | ||
| "saved_object:search/*", | ||
| "saved_object:query/*", | ||
| "saved_object:config/*", | ||
| "saved_object:config/get", | ||
| "saved_object:config/find", | ||
| "saved_object:config-global/*", | ||
| "saved_object:telemetry/*", | ||
| "saved_object:canvas-workpad/*", | ||
| "saved_object:canvas-element/*", | ||
| "saved_object:url/*", | ||
| "ui:discover/show" | ||
| ); | ||
|
|
||
| final List<ApplicationPrivilegeDescriptor> applicationPrivilegeDescriptors = new ArrayList<>(); | ||
| for (String appPrivilegeName : applicationPrivilegeNames) { | ||
| applicationPrivilegeDescriptors.add( | ||
| new ApplicationPrivilegeDescriptor(applicationName, appPrivilegeName, allowedApplicationActionPatterns, Map.of()) | ||
| ); | ||
| } | ||
|
|
||
| Role reportingUserRole = Role.buildFromRoleDescriptor( | ||
| roleDescriptor, | ||
| new FieldPermissionsCache(Settings.EMPTY), | ||
| RESTRICTED_INDICES | ||
| RESTRICTED_INDICES, | ||
| applicationPrivilegeDescriptors | ||
| ); | ||
| assertThat(reportingUserRole.cluster().check(TransportClusterHealthAction.NAME, request, authentication), is(false)); | ||
| assertThat(reportingUserRole.cluster().check(ClusterStateAction.NAME, request, authentication), is(false)); | ||
|
|
@@ -2723,6 +2768,33 @@ public void testReportingUserRole() { | |
|
|
||
| assertNoAccessAllowed(reportingUserRole, TestRestrictedIndices.SAMPLE_RESTRICTED_NAMES); | ||
| assertNoAccessAllowed(reportingUserRole, XPackPlugin.ASYNC_RESULTS_INDEX + randomAlphaOfLengthBetween(0, 2)); | ||
|
|
||
| applicationPrivilegeNames.forEach(appPrivilege -> { | ||
| assertThat( | ||
| reportingUserRole.application() | ||
| .grants( | ||
| ApplicationPrivilegeTests.createPrivilege( | ||
| applicationName, | ||
| appPrivilege, | ||
| allowedApplicationActionPatterns.toArray(new String[0]) | ||
| ), | ||
| "*" | ||
| ), | ||
| is(true) | ||
| ); | ||
| }); | ||
| assertThat( | ||
| reportingUserRole.application() | ||
| .grants( | ||
| ApplicationPrivilegeTests.createPrivilege( | ||
| "kibana-.*", | ||
| "feature_random.minimal_read", | ||
| allowedApplicationActionPatterns.toArray(new String[0]) | ||
| ), | ||
| "*" | ||
| ), | ||
| is(false) | ||
| ); | ||
| } | ||
|
|
||
| public void testSuperuserRole() { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.