Skip to content

Commit

Permalink
Add security-configuration-insights perms for kibana_system
Browse files Browse the repository at this point in the history
Adds auto_configure, read, write, and create_index permissions for the
new .security-workflows-insights-* index. This index is created and
used internally by Kibana.
  • Loading branch information
joeypoon committed Nov 19, 2024
1 parent db63a28 commit 28f304b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,22 @@ static RoleDescriptor kibanaSystem(String name) {
// Endpoint heartbeat. Kibana reads from these to determine metering/billing for
// endpoints.
RoleDescriptor.IndicesPrivileges.builder().indices(".logs-endpoint.heartbeat-*").privileges("read", "create_index").build(),
// Security Solution workflows insights. Kibana creates, manages, and uses these
// to provide users with insights on potential configuration improvements
RoleDescriptor.IndicesPrivileges.builder()
.indices(".security-workflow-insights-*")
.privileges(
"create_index",
"auto_configure",
"manage",
"read",
"write",
"delete",
TransportUpdateSettingsAction.TYPE.name(),
TransportPutMappingAction.TYPE.name(),
RolloverAction.NAME
)
.build(),
// For connectors telemetry. Will be removed once we switched to connectors API
RoleDescriptor.IndicesPrivileges.builder().indices(".elastic-connectors*").privileges("read").build() },
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,28 @@ public void testKibanaSystemRole() {
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
});

// index for Security Solution workflow insights
Arrays.asList(".security-workflow-insights-" + randomAlphaOfLength(randomIntBetween(0, 13))).forEach((index) -> {
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index);
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportMultiSearchAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(indexAbstraction),
is(true)
);
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
});

// Data telemetry reads mappings, metadata and stats of indices
Arrays.asList(randomAlphaOfLengthBetween(8, 24), "packetbeat-*").forEach((index) -> {
logger.info("index name [{}]", index);
Expand Down

0 comments on commit 28f304b

Please sign in to comment.