From 378026a88b6f2014973dc171558b78c41ec569a8 Mon Sep 17 00:00:00 2001 From: Devin Hurley Date: Tue, 22 Jun 2021 10:26:05 -0400 Subject: [PATCH] squashed commit WIP - trying to fix integration tests, broken authz for observer user / role updates authz feature builder to what ying had before we messed it up in our branch fixes integration tests add rac api access to apm adds getIndex functionality which requires the asset name to be passed in, same style as in the rule registry data client, adds update integration tests fix small merge conflict and update shell script fix merge conflict in alerting test file fix most type errors fix the rest of the type failures fix integration tests fix integration tests fix type error with feature registration in apm fix integration tests in apm and security solution fix type checker fix jest tests for apm remove console.error statements for eslint fix type check update security solution jest tests cleaning up PR and adding basic unit tests still need to clean up types in tests and update one test file fixes snapshot for signals template fix tests fix type check failures update cypress test undo changes in alert authz class, updates alert privilege in apm feature to 'read', utilizes the 'rule' object available in executor params over querying for the rule SO directly remove verbose logging from detection api integration tests fix type fix jest tests, adds missing mocked rule object to alert executor params [RAC] [RBAC] adds function to get alerts-as-data index name (#6) * WIP - test script and route in rule registry to pull index name. I need to test out adding this route within the APM and sec sol plugins specifically and see if they spit back the same .alerts index but with the appropriate asset name despite not providing one. WIP - DO NOT DELETE THIS CODE minor cleanup updates client to require passing in index name, which is now available through the alerts as data client function getAlertsIndex fix types * remove outdated comment update README, adds integration test (skipped) for testing authz with search strategy (#8) * WIP * update README, adds integration test (skipped) for testing authz with search strategy * fix rebase issues * adds typedoc docs * adds SKIPPED integration test for timeline search strategy to be unskipped once authorization is added to search strategy * removes unused references to the rule data client within the rule registry squashed commit (#11) * clean up commented out code, update PR per initial comments * introduce index param to get route again, allowing user to specify index to search * updating feature privileges UI to allow user to have all, read, none on alerts Co-authored-by: Yara Tercero update tests WIP - updated shell scripts fixes scripts fix update route indexName -> index Merge pull request #12 from yctercero/rbac_update_tests Updates tests that were previously failing and addresses some feedback. --- .../server/routes/update_alert_by_id.test.ts | 8 ++++++++ .../security_and_spaces/tests/basic/update_alert.ts | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/rule_registry/server/routes/update_alert_by_id.test.ts b/x-pack/plugins/rule_registry/server/routes/update_alert_by_id.test.ts index 0ab2abf138e487..8e1b4fe34164a6 100644 --- a/x-pack/plugins/rule_registry/server/routes/update_alert_by_id.test.ts +++ b/x-pack/plugins/rule_registry/server/routes/update_alert_by_id.test.ts @@ -60,7 +60,11 @@ describe('updateAlertByIdRoute', () => { body: { status: 'closed', ids: 'alert-1', +<<<<<<< HEAD index: '.alerts-observability-apm*', +======= + indexName: '.alerts-observability-apm*', +>>>>>>> squashed commit }, }), context @@ -79,7 +83,11 @@ describe('updateAlertByIdRoute', () => { body: { notStatus: 'closed', ids: ['alert-1'], +<<<<<<< HEAD index: '.alerts-observability-apm*', +======= + indexName: '.alerts-observability-apm*', +>>>>>>> squashed commit }, }), context diff --git a/x-pack/test/rule_registry/security_and_spaces/tests/basic/update_alert.ts b/x-pack/test/rule_registry/security_and_spaces/tests/basic/update_alert.ts index b8d8b78aaf45e8..5091b54051253d 100644 --- a/x-pack/test/rule_registry/security_and_spaces/tests/basic/update_alert.ts +++ b/x-pack/test/rule_registry/security_and_spaces/tests/basic/update_alert.ts @@ -59,7 +59,6 @@ export default ({ getService }: FtrProviderContext) => { .send({ ids: ['NoxgpHkBqbdrfX07MqXV'], status: 'closed', index: apmIndex }) .expect(200); }); - it(`${obsOnlySpacesAll.username} should be able to update the APM alert in ${SPACE1}`, async () => { const apmIndex = await getAPMIndexName(superUser); const res = await supertestWithoutAuth