Skip to content

[Security Solution][Endpoint] Adds new integration tests for Endpoint Artifacts API RBAC#143273

Merged
dasansol92 merged 7 commits intoelastic:mainfrom
dasansol92:feat/olm-API_trusted_applications_RBAC_integration_tests-4921
Dec 22, 2022
Merged

[Security Solution][Endpoint] Adds new integration tests for Endpoint Artifacts API RBAC#143273
dasansol92 merged 7 commits intoelastic:mainfrom
dasansol92:feat/olm-API_trusted_applications_RBAC_integration_tests-4921

Conversation

@dasansol92
Copy link
Contributor

@dasansol92 dasansol92 commented Oct 13, 2022

Summary

  • Add new test cases checking RBAC privileges for all artifacts integration tests

For maintainers

@dasansol92 dasansol92 changed the title [Security Solution][Endpoint] Adds new integration tests for Trusted Apps API RBAC [Security Solution][Endpoint] Adds new integration tests for Endpoint Artifacts API RBAC Dec 21, 2022
@dasansol92 dasansol92 marked this pull request as ready for review December 21, 2022 14:12
@dasansol92 dasansol92 requested review from a team as code owners December 21, 2022 14:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

@dasansol92
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you.

I did notice something that did not appear right to me - some tests are checking for a expect(400) error. 400 errors are normally due to user input, and I would not have expected any of these tests to return a 400. Do you know why that is?

@dasansol92
Copy link
Contributor Author

I did notice something that did not appear right to me - some tests are checking for a expect(400) error. 400 errors are normally due to user input, and I would not have expected any of these tests to return a 400. Do you know why that is?

@paul-tavares Yes, I think all expect(400) are related to user input:

  • no values
  • invalid OS for signer field
  • more than one OS
  • invalid hash
  • etc.

Does that makes sense to you?

@paul-tavares
Copy link
Contributor

@dasansol92 ,

Ok... Cool. thanks for that and yes, that makes sense. Did not realize we were doing schema type of validation from FTR.

👍

@kibana-ci
Copy link

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Tests #2 / Import rules Imports a custom rule with exceptions

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 61 67 +6
osquery 109 115 +6
securitySolution 439 445 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 70 76 +6
osquery 110 117 +7
securitySolution 515 521 +6
total +21

History

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

Copy link
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

Thanks for all the detailed tests 🔥 I have a minor suggestion but this is good to 🚢

'item_id' | 'namespace_type' | 'os_types' | 'tags' | 'entries'
>;
type HostIsolationExceptionApiCallsInterface<BodyGetter = UnknownBodyGetter> = Array<{
method: keyof Pick<typeof supertest, 'post' | 'put' | 'get' | 'delete' | 'patch'>;
Copy link
Member

Choose a reason for hiding this comment

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

Don't have to change but you could use RouteMethod here instead that is imported as

import type { RouteMethod } from '@kbn/core-http-server';

body.entries[0].field = 'some.invalid.field';
await supertest[blocklistApiCall.method](blocklistApiCall.path)
await supertestWithoutAuth[blocklistApiCall.method](blocklistApiCall.path)
.auth(ROLE.analyst_hunter, 'changeme')
Copy link
Member

Choose a reason for hiding this comment

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

Consider updating this role to have a username and the default password so you don't have to duplicate the default password in every test. So it can be used as:

.auth(ROLE.analyst_hunter.username, ROLE.analyst_hunter.password)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, we can work on this on a subsequent pr! Thanks for the suggestion!

Copy link
Member

@ashokaditya ashokaditya Dec 22, 2022

Choose a reason for hiding this comment

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

The fleet side does something similar as I learned recently.

@dasansol92 dasansol92 merged commit 8d7f570 into elastic:main Dec 22, 2022
simianhacker pushed a commit to simianhacker/kibana that referenced this pull request Dec 22, 2022
… Artifacts API RBAC (elastic#143273)

## Summary

- Add new test cases checking RBAC privileges for all artifacts
integration tests

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants