@@ -1059,6 +1059,33 @@ public void testKibanaSystemRole() {
10591059 assertThat (kibanaRole .indices ().allowedIndicesMatcher (RolloverAction .NAME ).test (indexAbstraction ), is (true ));
10601060 });
10611061
1062+ Arrays .asList ("logs-osquery_manager.result-" + randomAlphaOfLength (randomIntBetween (0 , 13 ))).forEach ((osqIndex ) -> {
1063+ final IndexAbstraction indexAbstraction = mockIndexAbstraction (osqIndex );
1064+ assertThat (kibanaRole .indices ().allowedIndicesMatcher ("indices:foo" ).test (indexAbstraction ), is (false ));
1065+ assertThat (kibanaRole .indices ().allowedIndicesMatcher ("indices:bar" ).test (indexAbstraction ), is (false ));
1066+ assertThat (
1067+ kibanaRole .indices ().allowedIndicesMatcher (TransportDeleteIndexAction .TYPE .name ()).test (indexAbstraction ),
1068+ is (false )
1069+ );
1070+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (GetIndexAction .NAME ).test (indexAbstraction ), is (true ));
1071+ assertThat (
1072+ kibanaRole .indices ().allowedIndicesMatcher (TransportCreateIndexAction .TYPE .name ()).test (indexAbstraction ),
1073+ is (false )
1074+ );
1075+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportIndexAction .NAME ).test (indexAbstraction ), is (false ));
1076+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportDeleteAction .NAME ).test (indexAbstraction ), is (false ));
1077+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportSearchAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1078+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportMultiSearchAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1079+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportGetAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1080+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (READ_CROSS_CLUSTER_NAME ).test (indexAbstraction ), is (false ));
1081+ assertThat (
1082+ kibanaRole .indices ().allowedIndicesMatcher (TransportUpdateSettingsAction .TYPE .name ()).test (indexAbstraction ),
1083+ is (true )
1084+ );
1085+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportPutMappingAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1086+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (RolloverAction .NAME ).test (indexAbstraction ), is (true ));
1087+ });
1088+
10621089 // Tests for third-party agent indices that `kibana_system` has only `read` access
10631090 Arrays .asList (
10641091 "logs-sentinel_one." + randomAlphaOfLength (randomIntBetween (0 , 13 )),
@@ -1617,6 +1644,34 @@ public void testKibanaSystemRole() {
16171644 assertThat (kibanaRole .indices ().allowedIndicesMatcher (RolloverAction .NAME ).test (indexAbstraction ), is (true ));
16181645 });
16191646
1647+ // read-only datastream for osquery_manager
1648+ Arrays .asList ("logs-osquery_manager.result-" + randomAlphaOfLength (randomIntBetween (0 , 13 ))).forEach ((osqIndex ) -> {
1649+ final IndexAbstraction indexAbstraction = mockIndexAbstraction (osqIndex );
1650+ assertThat (kibanaRole .indices ().allowedIndicesMatcher ("indices:foo" ).test (indexAbstraction ), is (false ));
1651+ assertThat (kibanaRole .indices ().allowedIndicesMatcher ("indices:bar" ).test (indexAbstraction ), is (false ));
1652+ assertThat (
1653+ kibanaRole .indices ().allowedIndicesMatcher (TransportDeleteIndexAction .TYPE .name ()).test (indexAbstraction ),
1654+ is (false )
1655+ );
1656+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (GetIndexAction .NAME ).test (indexAbstraction ), is (true ));
1657+ assertThat (
1658+ kibanaRole .indices ().allowedIndicesMatcher (TransportCreateIndexAction .TYPE .name ()).test (indexAbstraction ),
1659+ is (false )
1660+ );
1661+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportIndexAction .NAME ).test (indexAbstraction ), is (false ));
1662+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportDeleteAction .NAME ).test (indexAbstraction ), is (false ));
1663+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportSearchAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1664+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportMultiSearchAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1665+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportGetAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1666+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (READ_CROSS_CLUSTER_NAME ).test (indexAbstraction ), is (false ));
1667+ assertThat (
1668+ kibanaRole .indices ().allowedIndicesMatcher (TransportUpdateSettingsAction .TYPE .name ()).test (indexAbstraction ),
1669+ is (true )
1670+ );
1671+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (TransportPutMappingAction .TYPE .name ()).test (indexAbstraction ), is (true ));
1672+ assertThat (kibanaRole .indices ().allowedIndicesMatcher (RolloverAction .NAME ).test (indexAbstraction ), is (true ));
1673+ });
1674+
16201675 // read-only datastream for csp indices
16211676 Arrays .asList ("logs-cloud_security_posture.findings-" + randomAlphaOfLength (randomIntBetween (0 , 13 ))).forEach ((cspIndex ) -> {
16221677 final IndexAbstraction indexAbstraction = mockIndexAbstraction (cspIndex );
0 commit comments