Skip to content

Commit 16b6c03

Browse files
[Security analytics][2.x] Updated tests 2.13 release (#1159) (#1160)
* updated tests to match repo Signed-off-by: Amardeepsingh Siglani <[email protected]> * updated tests to match repo Signed-off-by: Amardeepsingh Siglani <[email protected]> * fixed findings tests Signed-off-by: Amardeepsingh Siglani <[email protected]> --------- Signed-off-by: Amardeepsingh Siglani <[email protected]> (cherry picked from commit 55f08ef) Co-authored-by: Amardeepsingh Siglani <[email protected]>
1 parent 1348ec1 commit 16b6c03

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
title: Moriya Rootkit
2+
id: 25b9c01c-350d-4b95-bed1-836d04a4f324
3+
description: Detects the use of Moriya rootkit as described in the securelist Operation TunnelSnake report
4+
status: experimental
5+
author: Bhabesh Raj
6+
date: 2021/05/06
7+
modified: 2021/11/30
8+
references:
9+
- https://securelist.com/operation-tunnelsnake-and-moriya-rootkit/101831
10+
tags:
11+
- attack.persistence
12+
- attack.privilege_escalation
13+
- attack.t1543.003
14+
logsource:
15+
product: d3
16+
category: s3
17+
service: azure
18+
detection:
19+
selection:
20+
Provider_Name: 'Service Control Manager'
21+
EventID: 2100
22+
ServiceName: ZzNetSvc
23+
condition: selection
24+
level: critical
25+
falsepositives:
26+
- Unknown

cypress/integration/plugins/security-analytics-dashboards-plugin/1_detectors.spec.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,48 @@ describe('Detectors', () => {
549549
validateFieldMappingsTable('rules are changed');
550550
});
551551

552+
it('...can be stopped and started back from detectors list action menu', () => {
553+
cy.wait(1000);
554+
cy.get('tbody > tr')
555+
.first()
556+
.within(() => {
557+
cy.get('[class="euiCheckbox__input"]').click({ force: true });
558+
});
559+
560+
// Waiting for Actions menu button to be enabled
561+
cy.wait(1000);
562+
563+
setupIntercept(
564+
cy,
565+
`${NODE_API.DETECTORS_BASE}/_search`,
566+
'detectorsSearch'
567+
);
568+
569+
cy.get('[data-test-subj="detectorsActionsButton').click({ force: true });
570+
cy.get('[data-test-subj="toggleDetectorButton').contains('Stop');
571+
cy.get('[data-test-subj="toggleDetectorButton').click({ force: true });
572+
573+
cy.wait('@detectorsSearch').should('have.property', 'state', 'Complete');
574+
// Need this extra wait time for the Actions button to become enabled again
575+
cy.wait(2000);
576+
577+
setupIntercept(
578+
cy,
579+
`${NODE_API.DETECTORS_BASE}/_search`,
580+
'detectorsSearch'
581+
);
582+
cy.get('[data-test-subj="detectorsActionsButton').click({ force: true });
583+
cy.get('[data-test-subj="toggleDetectorButton').contains('Start');
584+
cy.get('[data-test-subj="toggleDetectorButton').click({ force: true });
585+
586+
cy.wait('@detectorsSearch').should('have.property', 'state', 'Complete');
587+
// Need this extra wait time for the Actions button to become enabled again
588+
cy.wait(2000);
589+
590+
cy.get('[data-test-subj="detectorsActionsButton').click({ force: true });
591+
cy.get('[data-test-subj="toggleDetectorButton').contains('Stop');
592+
});
593+
552594
it('...can be deleted', () => {
553595
setupIntercept(cy, `${NODE_API.RULES_BASE}/_search`, 'getSigmaRules');
554596
openDetectorDetails(detectorName);

cypress/integration/plugins/security-analytics-dashboards-plugin/2_rules.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ const checkRulesFlyout = () => {
155155
};
156156

157157
const getCreateButton = () => cy.get('[data-test-subj="create_rule_button"]');
158+
const getImportButton = () => cy.get('[data-test-subj="import_rule_button"]');
159+
const getImportRuleFilePicker = () =>
160+
cy.get('[data-test-subj="import_rule_file_picker"]');
158161
const getNameField = () => cy.sa_getFieldByLabel('Rule name');
159162
const getRuleStatusField = () => cy.sa_getFieldByLabel('Rule Status');
160163
const getDescriptionField = () =>
@@ -631,6 +634,15 @@ describe('Rules', () => {
631634
checkRulesFlyout();
632635
});
633636

637+
it('...can be imported with log type', () => {
638+
getImportButton().click({ force: true });
639+
getImportRuleFilePicker().selectFile(
640+
'./cypress/fixtures/plugins/security-analytics-dashboards-plugin/sample_aws_s3_rule_to_import.yml'
641+
);
642+
// Check that AWS S3 log type is set.
643+
cy.contains('AWS S3');
644+
});
645+
634646
it('...can be deleted', () => {
635647
setupIntercept(cy, `${NODE_API.RULES_BASE}/_search`, 'getRules', 'POST');
636648

cypress/integration/plugins/security-analytics-dashboards-plugin/4_findings.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,28 @@ describe('Findings', () => {
152152
});
153153
});
154154

155+
it('shows document not found warning when the document is empty', () => {
156+
cy.deleteIndex(indexName);
157+
cy.reload();
158+
159+
// Wait for page to load
160+
cy.sa_waitForPageLoad('findings', {
161+
contains: 'Findings',
162+
});
163+
164+
// filter table to show only sample_detector findings
165+
cy.get(`input[placeholder="Search findings"]`).sa_ospSearch(indexName);
166+
167+
// open Finding details flyout via finding id link. cy.wait essential, timeout insufficient.
168+
cy.sa_getTableFirstRow('[data-test-subj="view-details-icon"]').then(
169+
($el) => {
170+
cy.get($el).click({ force: true });
171+
}
172+
);
173+
174+
// Flyout should show 'Document not found' warning
175+
cy.contains('Document not found');
176+
});
177+
155178
after(() => cy.sa_cleanUpTests());
156179
});

0 commit comments

Comments
 (0)