Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security - kibana_system - add delete privileges for synthetics #85844

Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions docs/changelog/85844.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 85844
summary: Add delete privilege to `kibana_system` for Synthetics
area: Authorization
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,13 @@ public static RoleDescriptor kibanaSystemRoleDescriptor(String name) {
"metrics-apm-*",
"metrics-apm.*-*",
"traces-apm-*",
"traces-apm.*-*"
"traces-apm.*-*",
Copy link
Member

Choose a reason for hiding this comment

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

nit: it'd make sense to mention Synthetics in the comment above.

"synthetics-http-*",
"synthetics-icmp-*",
"synthetics-tcp-*",
"synthetics-browser-*",
"synthetics-browser.network-*",
"synthetics-browser.screenshot-*"
Comment on lines +785 to +790
Copy link
Member

Choose a reason for hiding this comment

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

question: do we document these patterns anywhere like we do for APM patterns (dataset part in particular, http/icmp/tcp/browser/browser.network/browser.screenshot)? I wanted to make sure there are no typos in the names and so on, but couldn't quickly find any references.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately no, we do have this docs ticket where we will address in the future elastic/synthetics#286

)
.privileges(DeleteIndexAction.NAME)
.build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,14 +865,20 @@ public void testKibanaSystemRole() {
assertThat(kibanaRole.indices().allowedIndicesMatcher(SearchAction.NAME).test(indexAbstraction), is(isAlsoReadIndex));
assertThat(kibanaRole.indices().allowedIndicesMatcher(MultiSearchAction.NAME).test(indexAbstraction), is(isAlsoReadIndex));

// Endpoint diagnostic and APM data streams also have an ILM policy with a delete action, all others should not.
// Endpoint diagnostic, APM and Synthetics data streams also have an ILM policy with a delete action, all others should not.
final boolean isAlsoIlmDeleteIndex = indexName.startsWith(".logs-endpoint.diagnostic.collection-")
|| indexName.startsWith("logs-apm-")
|| indexName.startsWith("logs-apm.")
|| indexName.startsWith("metrics-apm-")
|| indexName.startsWith("metrics-apm.")
|| indexName.startsWith("traces-apm-")
|| indexName.startsWith("traces-apm.");
|| indexName.startsWith("traces-apm.")
|| indexName.startsWith("synthetics-http-*")
|| indexName.startsWith("synthetics-tcp-*")
|| indexName.startsWith("synthetics-icmp-*")
|| indexName.startsWith("synthetics-browser-*")
|| indexName.startsWith("synthetics-browser.network-*")
|| indexName.startsWith("synthetics-browser.screenshot-*");
assertThat(kibanaRole.indices().allowedIndicesMatcher(DeleteIndexAction.NAME).test(indexAbstraction), is(isAlsoIlmDeleteIndex));
});

Expand Down Expand Up @@ -984,7 +990,13 @@ public void testKibanaSystemRole() {
"metrics-apm-" + randomAlphaOfLengthBetween(3, 8),
"metrics-apm." + randomAlphaOfLengthBetween(3, 8) + "-" + randomAlphaOfLengthBetween(3, 8),
"traces-apm-" + randomAlphaOfLengthBetween(3, 8),
"traces-apm." + randomAlphaOfLengthBetween(3, 8) + "-" + randomAlphaOfLengthBetween(3, 8)
"traces-apm." + randomAlphaOfLengthBetween(3, 8) + "-" + randomAlphaOfLengthBetween(3, 8),
"synthetics-http-" + randomAlphaOfLengthBetween(3, 8),
"synthetics-icmp-" + randomAlphaOfLengthBetween(3, 8),
"synthetics-tcp-" + randomAlphaOfLengthBetween(3, 8),
"synthetics-browser-" + randomAlphaOfLengthBetween(3, 8),
"synthetics-browser.network-" + randomAlphaOfLengthBetween(3, 8),
"synthetics-browser.screenshot-" + randomAlphaOfLengthBetween(3, 8)
).forEach(indexName -> {
logger.info("index name [{}]", indexName);
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
Expand Down