Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,21 @@ static RoleDescriptor kibanaSystem(String name) {
"logs-tenable_io.vulnerability-*",
"logs-rapid7_insightvm.vulnerability-*",
"logs-rapid7_insightvm.asset_vulnerability-*",
"logs-carbon_black_cloud.asset_vulnerability_summary-*"
"logs-carbon_black_cloud.asset_vulnerability_summary-*",
"logs-m365_defender.vulnerability-*",
"logs-microsoft_defender_endpoint.vulnerability-*"
Copy link
Contributor Author

@kcreddy kcreddy Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds permission for the transform, without which results in following error inside the transform:

Cannot create transform [logs-m365_defender.latest_cdr_vulnerabilities-default-0.1.0] because user elastic/kibana lacks the required permissions [logs-m365_defender.vulnerability-*:[read], security_solution-m365_defender.vulnerability_latest:[], security_solution-m365_defender.vulnerability_latest-v1:[]]

Copy link
Contributor

@slobodanadamovic slobodanadamovic Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: Per ILM policy you shared, Kibana needs the permission to execute rollover action but that is already covered by logs-* pattern here:

"logs-*",
"synthetics-*",
"traces-*",
"/metrics-.*&~(metrics-endpoint\\.metadata_current_default.*)/",
".logs-endpoint.action.responses-*",
".logs-endpoint.diagnostic.collection-*",
".logs-endpoint.actions-*",
".logs-endpoint.heartbeat-*",
".logs-osquery_manager.actions-*",
".logs-osquery_manager.action.responses-*",
"logs-osquery_manager.action.responses-*",
"profiling-*"
)
.privileges(
TransportUpdateSettingsAction.TYPE.name(),
TransportPutMappingAction.TYPE.name(),
RolloverAction.NAME,
"indices:admin/data_stream/lifecycle/put"
)

)
.privileges("read", "view_index_metadata")
.build(),
// For source indices of the Cloud Detection & Response (CDR) packages
// that has ILM policy
RoleDescriptor.IndicesPrivileges.builder()
.indices("logs-m365_defender.vulnerability-*", "logs-microsoft_defender_endpoint.vulnerability-*")
.privileges(
// Require "delete_index" to perform ILM policy actions
TransportDeleteIndexAction.TYPE.name()
)
.build(),
Copy link
Contributor Author

@kcreddy kcreddy Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the permission error for the ILM policy.
The ILM policies are already part of existing integration code: here and here.

Without this correct permissions following error is received when deleting index as user with kibana_system role (as in ILM).

{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "action [indices:admin/delete] is unauthorized for user [kibana-system] with effective roles [editor,kibana_system,viewer] on indices [.ds-logs-m365_defender.vulnerability-default-2025.08.05-000002], this action is granted by the index privileges [delete_index,manage,all]"
      }
    ],
    "type": "security_exception",
    "reason": "action [indices:admin/delete] is unauthorized for user [kibana-system] with effective roles [editor,kibana_system,viewer] on indices [.ds-logs-m365_defender.vulnerability-default-2025.08.05-000002], this action is granted by the index privileges [delete_index,manage,all]"
  },
  "status": 403
}

// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
// transform
RoleDescriptor.IndicesPrivileges.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1687,15 +1687,22 @@ public void testKibanaSystemRole() {
"logs-tenable_io.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
"logs-rapid7_insightvm.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
"logs-rapid7_insightvm.asset_vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
"logs-carbon_black_cloud.asset_vulnerability_summary-" + randomAlphaOfLength(randomIntBetween(0, 13))
"logs-carbon_black_cloud.asset_vulnerability_summary-" + randomAlphaOfLength(randomIntBetween(0, 13)),
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
).forEach(indexName -> {
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
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(false)
);
if (indexAbstraction.getName().startsWith("logs-m365_defender.vulnerability-") == false
&& indexAbstraction.getName().startsWith("logs-microsoft_defender_endpoint.vulnerability-") == false) {
// delete_index is granted for m365_defender.vulnerability and microsoft_defender_endpoint.vulnerability
// because of ILM policy. So exclude both from this check.
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
is(false)
);
}
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
Expand All @@ -1715,6 +1722,20 @@ public void testKibanaSystemRole() {
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
});

Arrays.asList(
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
).forEach(indexName -> {
logger.info("index name [{}]", indexName);
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
// Allow delete index
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
// Implied by the overall view_index_metadata and monitor privilege
assertViewIndexMetadata(kibanaRole, indexName);
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));

});

Arrays.asList(
"logs-cloud_security_posture.findings_latest-default",
"logs-cloud_security_posture.scores-default",
Expand Down