Skip to content

Commit 7f3b9c3

Browse files
committed
added tests and changelog
1 parent 8b7022f commit 7f3b9c3

File tree

3 files changed

+87
-2
lines changed

3 files changed

+87
-2
lines changed

docs/changelog/132387.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 132387
2+
summary: "[ExtraHop & QualysGAV] Add `manage`, `create_index`, `read`, `index`, `write`, `delete`, permission for third party agent indices `kibana_system`"
3+
area: Authorization
4+
type: enhancement
5+
issues:
6+
- 131825

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/KibanaOwnedReservedRoleDescriptors.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,30 @@ static RoleDescriptor kibanaSystem(String name) {
515515
"logs-tenable_io.vulnerability-*",
516516
"logs-rapid7_insightvm.vulnerability-*",
517517
"logs-rapid7_insightvm.asset_vulnerability-*",
518-
"logs-carbon_black_cloud.asset_vulnerability_summary-*",
518+
"logs-carbon_black_cloud.asset_vulnerability_summary-*"
519+
)
520+
.privileges("read", "view_index_metadata")
521+
.build(),
522+
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
523+
// for configured ILM policies.
524+
RoleDescriptor.IndicesPrivileges.builder()
525+
.indices(
519526
"logs-extrahop.investigation-*",
520527
"logs-qualys_gav.asset-*"
521528
)
522-
.privileges("read", "view_index_metadata")
529+
.privileges(
530+
"manage",
531+
"create_index",
532+
"read",
533+
"index",
534+
"write",
535+
"delete",
536+
// Require "delete_index" to perform ILM policy actions
537+
TransportDeleteIndexAction.TYPE.name(),
538+
TransportIndicesAliasesAction.NAME,
539+
TransportUpdateSettingsAction.TYPE.name(),
540+
TransportAutoPutMappingAction.TYPE.name()
541+
)
523542
.build(),
524543
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
525544
// transform

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,66 @@ public void testKibanaSystemRole() {
18841884
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
18851885
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
18861886
});
1887+
1888+
// Tests for third-party agent indices (ExtraHop, QualysGAV) that `kibana_system` has full management access to
1889+
// This includes read, write, create, delete, and all ILM-related management actions.
1890+
Arrays.asList(
1891+
"logs-extrahop.investigation-" + randomAlphaOfLength(randomIntBetween(1, 10)),
1892+
"logs-qualys_gav.asset-" + randomAlphaOfLength(randomIntBetween(1, 10))
1893+
).forEach((index) -> {
1894+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index);
1895+
1896+
// Assert Read Actions (Allowed by "read")
1897+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1898+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1899+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1900+
1901+
// Assert Write & Delete Document Actions (Allowed by "write", "index", "delete")
1902+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
1903+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
1904+
// The "update" action is also implicitly part of "write"
1905+
assertThat(kibanaRole.indices().allowedIndicesMatcher(UpdateAction.NAME).test(indexAbstraction), is(true));
1906+
1907+
// Assert Index Management Actions (Allowed by "create_index", "delete_index", and "manage")
1908+
// Allowed by the explicit "create_index" privilege
1909+
assertThat(
1910+
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
1911+
is(true)
1912+
);
1913+
// Allowed by the explicit TransportDeleteIndexAction
1914+
assertThat(
1915+
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
1916+
is(true)
1917+
);
1918+
1919+
// Assert ILM Actions (Allowed by "manage" and explicit transport actions)
1920+
// Allowed due to the "manage" privilege and explicit TransportUpdateSettingsAction
1921+
assertThat(
1922+
kibanaRole.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(indexAbstraction),
1923+
is(true)
1924+
);
1925+
// Allowed due to the "manage" privilege and explicit TransportAutoPutMappingAction
1926+
assertThat(
1927+
kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction),
1928+
is(true)
1929+
);
1930+
// Allowed due to the explicit TransportIndicesAliasesAction
1931+
assertThat(
1932+
kibanaRole.indices().allowedIndicesMatcher(TransportIndicesAliasesAction.NAME).test(indexAbstraction),
1933+
is(true)
1934+
);
1935+
// Rollover requires 'manage' on the alias and 'create_index', both of which are granted.
1936+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1937+
1938+
1939+
// Assert Denied Actions
1940+
// This role should not have cross-cluster permissions on these indices
1941+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1942+
1943+
// A check against a completely different index should fail
1944+
final IndexAbstraction otherIndex = mockIndexAbstraction("some-unrelated-index");
1945+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(otherIndex), is(false));
1946+
});
18871947
}
18881948

18891949
public void testKibanaAdminRole() {

0 commit comments

Comments
 (0)