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

[Backport 2.x] Backporting #581 and #594 #606

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 9 additions & 14 deletions cypress/integration/2_rules.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ const SAMPLE_RULE = {
name: `Cypress test rule ${uniqueId}`,
logType: 'windows',
description: 'This is a rule used to test the rule creation workflow.',
detection:
"condition: selection\nselection:\n Provider_Name|contains:\n- Service Control Manager\nEventID|contains:\n- '7045'\nServiceName|contains:\n- ZzNetSvc\n{backspace}{backspace}condition: selection",
detectionLine: [
'condition: selection',
'selection:',
'condition: Selection_1',
'Selection_1:',
'Provider_Name|contains:',
'- Service Control Manager',
'EventID|contains:',
Expand Down Expand Up @@ -48,7 +46,7 @@ const YAML_RULE_LINES = [
`- '${SAMPLE_RULE.references}'`,
`author: ${SAMPLE_RULE.author}`,
`detection:`,
...SAMPLE_RULE.detection.replaceAll(' ', '').replaceAll('{backspace}', '').split('\n'),
...SAMPLE_RULE.detectionLine,
];

const checkRulesFlyout = () => {
Expand Down Expand Up @@ -145,7 +143,7 @@ describe('Rules', () => {
});
});

xit('...can be created', () => {
it('...can be created', () => {
// Click "create new rule" button
cy.get('[data-test-subj="create_rule_button"]').click({
force: true,
Expand Down Expand Up @@ -184,7 +182,6 @@ describe('Rules', () => {
cy.get('[data-test-subj="rule_author_field"]').type(`${SAMPLE_RULE.author}{enter}`);

cy.get('[data-test-subj="detection-visual-editor-0"]').within(() => {
cy.getFieldByLabel('Name').type('selection');
cy.getFieldByLabel('Key').type('Provider_Name');
cy.getInputByPlaceholder('Value').type('Service Control Manager');

Expand All @@ -200,11 +197,9 @@ describe('Rules', () => {
cy.getInputByPlaceholder('Value').type('ZzNetSvc');
});
});
cy.get('[data-test-subj="rule_detection_field"] textarea')
.type('selection', {
force: true,
})
.blur();
cy.get('[data-test-subj="rule_detection_field"] textarea').type('Selection_1', {
force: true,
});

// Switch to YAML editor
cy.get('[data-test-subj="change-editor-type"] label:nth-child(2)').click({
Expand All @@ -231,7 +226,7 @@ describe('Rules', () => {
checkRulesFlyout();
});

xit('...can be edited', () => {
it('...can be edited', () => {
cy.waitForPageLoad('rules', {
contains: 'Rules',
});
Expand Down Expand Up @@ -291,7 +286,7 @@ describe('Rules', () => {
checkRulesFlyout();
});

xit('...can be deleted', () => {
it('...can be deleted', () => {
cy.intercept({
url: '/rules',
}).as('deleteRule');
Expand Down
1 change: 1 addition & 0 deletions public/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $euiTextColor: $euiColorDarkestShade !default;
@import "./pages/Correlations/Correlations.scss";
@import "./pages/Correlations/components/FindingCard.scss";
@import "./pages/Findings/components/CorrelationsTable/CorrelationsTable.scss";
@import "./pages/Rules/components/RuleEditor/DetectionVisualEditor.scss";

.selected-radio-panel {
background-color: tintOrShade($euiColorPrimary, 90%, 70%);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

.detection-visual-editor {
.euiAccordionForm:nth-of-type(1) {
border-top: 1px solid #D3DAE6;
}

.euiAccordionForm {
border-top: 0 !important;
}

.detection-visual-editor-accordion-wrapper {
width: 100%;
.detection-visual-editor-form-row {
max-width: 100%;
.detection-visual-editor-textarea {
max-width: 100%;
padding: 0;
min-height: 100px;
}
}

.detection-visual-editor-textarea-clear-btn {
align-items: flex-end;
}

.detection-visual-editor-accordion {
.euiAccordion__childWrapper {
height: auto !important;
}
}
}

.detection-visual-editor-name {
box-shadow: none;
background-color: transparent;
padding: 0;
}

.detection-visual-editor-delete-selection {
margin-top: 0 !important;
}

.euiButtonIcon--danger {
color: $ouiTextSubduedColor !important;

&:hover {
color: $ouiColorDanger !important;
background-color: transparent !important;
}
}
}
Loading