Skip to content

Commit

Permalink
Merge branch 'main' into feature-fleet-agent-cypress-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed May 1, 2023
2 parents a0b94ec + ba4d187 commit 1337ab7
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 62 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.6.0-canary.3",
"@elastic/ems-client": "8.4.0",
"@elastic/eui": "77.1.1",
"@elastic/eui": "77.1.2",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down
9 changes: 0 additions & 9 deletions src/core/public/styles/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,3 @@
.euiPageHeader--bottomBorder:not(.euiPageHeader--tabsAtBottom):not([class*='euiPageHeader--padding']) {
padding-bottom: $euiSizeL;
}

// Kibana's body ignores the `margin-right !important` set by react-remove-scroll-bar
// (used by EUI's focus trap component & prevents page width jumps on full-screen overlays)
// due to the 100% width/min-width CSS set by Kibana in other places. To work around this, we
// grab the `--removed-body-scroll-bar-size` var added by the library & manually set `padding`
// TODO: Use `gapMode` instead once https://github.com/theKashey/react-focus-on/issues/65 is fixed
.kbnBody {
padding-right: var(--removed-body-scroll-bar-size, 0);
}
2 changes: 1 addition & 1 deletion src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/ems-client@8.4.0': ['Elastic License 2.0'],
'@elastic/eui@77.1.1': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@77.1.2': ['SSPL-1.0 OR Elastic License 2.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
};
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const EditExtractionRule: React.FC<EditExtractionRuleProps> = ({
saveRule,
}) => {
const { closeEditRuleFlyout, openEditRuleFlyout } = useActions(ExtractionRulesLogic);
const { fieldRuleFlyoutVisible, fieldRuleToEdit, fieldRuleToEditIndex, fieldRuleToEditIsNew } =
const { fieldRuleFlyoutVisible, fieldRuleToEdit, fieldRuleToEditIsNew } =
useValues(ExtractionRulesLogic);
const [urlToggle, setUrlToggle] = useState<UrlState>(UrlState.ALL);
const { control, formState, getValues, handleSubmit, reset, setValue } =
Expand Down Expand Up @@ -437,6 +437,7 @@ export const EditExtractionRule: React.FC<EditExtractionRuleProps> = ({
if (fieldRuleToEditIsNew) {
appendRule(fieldRule);
} else {
const fieldRuleToEditIndex = rulesFields.findIndex(({ id: ruleId }) => ruleId === id);
updateRule(fieldRuleToEditIndex ?? 0, fieldRule);
}
closeEditRuleFlyout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ interface ExtractionRulesActions {
hideDeleteModal: () => void;
openEditRuleFlyout({
fieldRule,
fieldRuleIndex,
isNewRule,
}: {
fieldRule?: ExtractionRuleFieldRule;
fieldRuleIndex?: number;
isNewRule: boolean;
}): {
fieldRule: ExtractionRuleFieldRule;
fieldRuleIndex?: number;
isNewRule: boolean;
};
fetchDomainData: CrawlerDomainDetailActions['fetchDomainData'];
Expand Down Expand Up @@ -101,7 +98,6 @@ interface ExtractionRulesValues {
fieldRuleFlyoutVisible: boolean;
fieldRuleToDelete: { extractionRuleId?: string; fieldRuleIndex?: number };
fieldRuleToEdit: ExtractionRuleFieldRule | null;
fieldRuleToEditIndex: number | null;
fieldRuleToEditIsNew: boolean;
indexName: string;
isLoading: boolean;
Expand Down Expand Up @@ -289,13 +285,6 @@ export const ExtractionRulesLogic = kea<
openEditRuleFlyout: (_, { fieldRule }) => fieldRule ?? null,
},
],
fieldRuleToEditIndex: [
null,
{
closeEditRuleFlyout: () => null,
openEditRuleFlyout: (_, { fieldRuleIndex }) => fieldRuleIndex ?? null,
},
],
fieldRuleToEditIsNew: [
true,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const ExtractionRulesTable: React.FC = () => {
if (rule) {
openEditRuleFlyout({
fieldRule: rule,
fieldRuleIndex: rule.index,
isNewRule: false,
});
}
Expand Down
15 changes: 15 additions & 0 deletions x-pack/plugins/security_solution/common/endpoint/generate_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ export class EndpointDocGenerator extends BaseDataGenerator {
},
},
dll: this.getAlertsDefaultDll(),
user: {
domain: this.randomString(10),
name: this.randomString(10),
},
};
}

Expand Down Expand Up @@ -663,6 +667,10 @@ export class EndpointDocGenerator extends BaseDataGenerator {
},
},
dll: this.getAlertsDefaultDll(),
user: {
domain: this.randomString(10),
name: this.randomString(10),
},
};

// shellcode_thread memory alert have an additional process field
Expand Down Expand Up @@ -865,6 +873,10 @@ export class EndpointDocGenerator extends BaseDataGenerator {
},
},
dll: this.getAlertsDefaultDll(),
user: {
domain: this.randomString(10),
name: this.randomString(10),
},
};
return newAlert;
}
Expand Down Expand Up @@ -951,6 +963,9 @@ export class EndpointDocGenerator extends BaseDataGenerator {
...detailRecordForEventType,
event: {
category: options.eventCategory ? options.eventCategory : ['process'],
outcome: options.eventCategory?.includes('authentication')
? this.randomChoice(['success', 'failure'])
: '',
kind: 'event',
type: options.eventType ? options.eventType : ['start'],
id: this.seededUUIDv4(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ export type SafeEndpointEvent = Partial<{
}>;
event: Partial<{
category: ECSField<string>;
outcome: ECSField<string>;
type: ECSField<string>;
id: ECSField<string>;
kind: ECSField<string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { login, visit, visitWithoutDateRange } from '../../tasks/login';
import { getUnmappedRule } from '../../objects/rule';
import { ALERTS_URL } from '../../urls/navigation';
import { tablePageSelector } from '../../screens/table_pagination';
import { ALERTS_COUNT } from '../../screens/alerts';

describe('Alert details flyout', () => {
describe('With unmapped fields', { testIsolation: false }, () => {
Expand Down Expand Up @@ -96,59 +95,40 @@ describe('Alert details flyout', () => {
login();
visit(ALERTS_URL);
waitForAlertsToPopulate();
});

beforeEach(() => {
expandFirstAlert();
});

it('should store the flyout state in the url when it is opened', () => {
expandFirstAlert();
cy.get(OVERVIEW_RULE).should('be.visible');
cy.url().should('include', 'eventFlyout=');
});

it('should remove the flyout state from the url when it is closed', () => {
expandFirstAlert();
cy.get(OVERVIEW_RULE).should('be.visible');
closeAlertFlyout();
cy.url().should('not.include', 'eventFlyout=');
});

it('should open the alert flyout when the page is refreshed', () => {
expandFirstAlert();
cy.get(OVERVIEW_RULE).should('be.visible');
cy.reload();
cy.get(OVERVIEW_RULE).should('be.visible');
cy.get(OVERVIEW_RULE).then((field) => {
expect(field).to.contain('Endpoint Security');
});
cy.get(OVERVIEW_RULE).should('contain', 'Endpoint Security');
});

it('should show the copy link button for the flyout', () => {
expandFirstAlert();
cy.get(COPY_ALERT_FLYOUT_LINK).should('be.visible');
});

it('should open the flyout given the custom url', () => {
expandFirstAlert();
openTable();
filterBy('_id');
cy.get('[data-test-subj="event-field-_id"]')
.invoke('text')
.then((alertId) => {
cy.visit(`http://localhost:5620/app/security/alerts/redirect/${alertId}`);
cy.get('[data-test-subj="unifiedQueryInput"]').should('have.text', `_id: ${alertId}`);
cy.get(ALERTS_COUNT).should('have.text', '1 alert');
cy.get(OVERVIEW_RULE).should('be.visible');
});
});

it('should have the `kibana.alert.url` field set', () => {
expandFirstAlert();
const alertUrl =
'http://localhost:5601/app/security/alerts/redirect/eabbdefc23da981f2b74ab58b82622a97bb9878caa11bc914e2adfacc94780f1?index=.alerts-security.alerts-default&timestamp=2023-04-27T11:03:57.906Z';
openTable();
filterBy('kibana.alert.url');
cy.get('[data-test-subj="formatted-field-kibana.alert.url"]').should(
'have.text',
'http://localhost:5601/app/security/alerts/redirect/eabbdefc23da981f2b74ab58b82622a97bb9878caa11bc914e2adfacc94780f1?index=.alerts-security.alerts-default&timestamp=2023-04-27T11:03:57.906Z'
);
cy.get('[data-test-subj="formatted-field-kibana.alert.url"]').should('have.text', alertUrl);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ describe('Isolate command', () => {
beforeEach(() => {
login();
});
it('should allow filtering endpoint by Isolated status', () => {
// FLAKY: https://github.com/elastic/security-team/issues/6518
it.skip('should allow filtering endpoint by Isolated status', () => {
cy.visit(APP_PATH + getEndpointListPath({ name: 'endpointList' }));
closeAllToasts();
filterOutIsolatedHosts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('Response actions', () => {
cleanupRule(ruleId);
});

// flaky
// FLAKY: https://github.com/elastic/security-team/issues/6518
it.skip('All response action controls are disabled', () => {
visitRuleActions(ruleId);
cy.getByTestSubj('response-actions-wrapper').within(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,14 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
full_name: 'test user',
});

// Navigate home before attempting to login or we may get redirected to
// Discover with a forbidden error, which hides the chrome and causes
// PageObjects.security.login to fail when checking for the logout button
await PageObjects.common.navigateToUrl('home', '', {
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});

await PageObjects.security.login(
'no_discover_privileges_user',
'no_discover_privileges_user-password',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,27 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
'Actions',
],
[
'Host-9qenwrl9ko',
'Host-bhdpuumusb',
'x',
'x',
'Unsupported',
'Windows',
'10.20.160.71, 10.67.81.87',
'x',
'x',
'',
],
[
'Host-okyc8te0ki',
'x',
'x',
'Warning',
'Linux',
'10.56.228.101, 10.201.120.140,10.236.180.146',
'Windows',
'10.244.187.97, 10.45.118.67',
'x',
'x',
'',
],
['Host-qw2bti801m', 'x', 'x', 'Failure', 'macOS', '10.244.59.227', 'x', 'x', ''],
[
'Host-u5jy6j0pwb',
'x',
Expand Down
11 changes: 6 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1543,10 +1543,10 @@
resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314"
integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ==

"@elastic/eui@77.1.1":
version "77.1.1"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-77.1.1.tgz#82f4294bf3239d5d825c1d939c49d125bfdbeb72"
integrity sha512-guJmHoGDbvKh/738taKDZGSdNk+OXMse513oPaPf4NoXpQUeYvl3gLT50mX5J4nwILS1LFKNGrbU2Es77HM1cQ==
"@elastic/eui@77.1.2":
version "77.1.2"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-77.1.2.tgz#85c20c682058ada1a9478af2894c290cc20c1678"
integrity sha512-cq7TI/rOomifh/KXU1V+wGirClomkMcQ166K9/7eMyqJb50AAuweu5JkjiDRNvB06uX1lDP6GjSb+oGvf8885A==
dependencies:
"@types/chroma-js" "^2.0.0"
"@types/lodash" "^4.14.160"
Expand All @@ -1570,6 +1570,7 @@
react-focus-on "^3.7.0"
react-input-autosize "^3.0.0"
react-is "^17.0.2"
react-remove-scroll-bar "^2.3.4"
react-virtualized-auto-sizer "^1.0.6"
react-window "^1.8.6"
refractor "^3.5.0"
Expand Down Expand Up @@ -24264,7 +24265,7 @@ react-refresh@^0.11.0:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==

react-remove-scroll-bar@^2.3.3:
react-remove-scroll-bar@^2.3.3, react-remove-scroll-bar@^2.3.4:
version "2.3.4"
resolved "https://registry.yarnpkg.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.4.tgz#53e272d7a5cb8242990c7f144c44d8bd8ab5afd9"
integrity sha512-63C4YQBUt0m6ALadE9XV56hV8BgJWDmmTPY758iIJjfQKt2nYwoUrPk0LXRXcB/yIj82T1/Ixfdpdk68LwIB0A==
Expand Down

0 comments on commit 1337ab7

Please sign in to comment.