@@ -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