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 Solution] Changes default role for serverless from admin to platform_engineer #183608

Merged
merged 33 commits into from
Jun 3, 2024

Conversation

MadameSheema
Copy link
Member

@MadameSheema MadameSheema commented May 16, 2024

Summary

Addresses: #184140

In this PR we are addressing the short-term solution of #184135 where we are moving from using for serverless admin role for MKI environments and system_indices_superuser for stateless environments to platform_engineer.

To make the above change happen, some adjustments have been introduced to make the tests work:

Rename of custom indexes

The admin or system_indices_superuser has access to any index on the system, but built-in roles in security serverless projects just have access to some or all the security default indexes, so they cannot access custom indexes.

To make the tests work with the platform_engineer all the custom indexes that we use for testing purposes have been renamed to match ours.

waitForTheRuleToBeExecuted removed from some tests

waitForTheRuleToBeExecuted waits for the rule status to be succeeded but the platform_engineer does not have access to all the indexes, so instead the final status result will be warning so this method will timeout.

Originally that method was created in order to make sure that some alerts are going to be displayed but, after it, we are calling waitForAlertsToPopulate that makes sure that we have alerts.

Some tests have been skipped from serverless executions

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@MadameSheema
Copy link
Member Author

/ci

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@MadameSheema MadameSheema requested a review from nikitaindik May 24, 2024 14:42
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-explore (Team:Threat Hunting:Explore)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-engine (Team:Detection Engine)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@banderror banderror requested a review from a team May 24, 2024 15:26
…sponse/rule_management/maintenance_windows/maintenance_window_callout.cy.ts

Co-authored-by: Georgii Gorbachev <[email protected]>
@@ -49,7 +49,7 @@ describe('risk tab', { tags: ['@ess', '@serverless'] }, () => {
});
});

describe('with new risk score', () => {
Copy link
Contributor

@jaredburgettelastic jaredburgettelastic May 24, 2024

Choose a reason for hiding this comment

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

Great, thank you for enabling this one for entity analytics 👍

Copy link
Contributor

@jaredburgettelastic jaredburgettelastic left a comment

Choose a reason for hiding this comment

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

Entity Analytics changes LGTM

Copy link
Contributor

@kapral18 kapral18 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@nikitaindik nikitaindik left a comment

Choose a reason for hiding this comment

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

Thanks @MadameSheema! Rule Management changes LGTM!

I am curious about waitForTheRuleToBeExecuted(). Why do tests where it is not removed still pass? Is it because these tests are not ran with platform_engineer user?

@MadameSheema
Copy link
Member Author

I am curious about waitForTheRuleToBeExecuted(). Why do tests where it is not removed still pass? Is it because these tests are not ran with platform_engineer user?

@nikitaindik the platform_engineer is less privileged than the role we used before. In the tests where that method has been deleted, the rules the tests creates some rules where the user does not have access to all the indexes of it. In that case, when the rule is executed, instead of returning a succeed, returns a warning.

The other tests where it works is because the user has access to all the indexes.

Anyway, before merging I'll double check those indexes :)

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

Investigations area LGTM 🚀

@@ -61,13 +61,18 @@ import { getNewRule } from '../../../../objects/rule';
import { ALERTS_URL } from '../../../../urls/navigation';
import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
import { TOASTER } from '../../../../screens/alerts_detection_rules';
import { ELASTICSEARCH_USERNAME, IS_SERVERLESS } from '../../../../env_var_names_constants';

// We need to use the 'soc_manager' role in order to have the 'Respond' action displayed in serverless
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for making this change. Is there is list of serverless roles somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for making this change. Is there is list of serverless roles somewhere?

Yes @logeekal you can find the security-specific here.

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

Detection engine changes look good to me!

I noticed that waitForAlertsToPopulate doesn't care about which alerts are populated, so there's some small risk of acting on alerts that we didn't expect and it would be nice to e.g. allow a ruleId to be passed to that helper. However, the waitFor Rule helper wasn't really addressing this issue in the first place, so I'm happy to see an unnecessary step removed from these tests 👍

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @MadameSheema

@MadameSheema MadameSheema merged commit 9d84341 into elastic:main Jun 3, 2024
35 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 3, 2024
@MadameSheema MadameSheema deleted the cypress/changing-role branch June 3, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Entity Analytics Security Entity Analytics Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting:Investigations Security Solution Investigations Team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.