Skip to content

Commit

Permalink
Merge branch 'page-template-3-2' of github.com:majagrubic/kibana into…
Browse files Browse the repository at this point in the history
… page-template-3-2

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
  • Loading branch information
cchaos committed Mar 24, 2022
2 parents 710e3a0 + ec00f9a commit a6edc84
Show file tree
Hide file tree
Showing 211 changed files with 6,686 additions and 1,416 deletions.
2 changes: 1 addition & 1 deletion dev_docs/contributing/standards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Every team should be collecting telemetry metrics on it’s public API usage. Th

### APM

Kibana server and client are instrumented with APM node and APM RUM clients respectively, tracking serveral types of transactions by default, such as `page-load`, `request`, etc.
Kibana server and client are instrumented with APM node and APM RUM clients respectively, tracking several types of transactions by default, such as `page-load`, `request`, etc.
You may introduce custom transactions. Please refer to the [APM documentation](https://www.elastic.co/guide/en/apm/get-started/current/index.html) and follow these guidelines when doing so:

- Use dashed syntax for transaction types and names: `my-transaction-type` and `my-transaction-name`
Expand Down
2 changes: 1 addition & 1 deletion dev_docs/key_concepts/kibana_platform_plugin_intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ plugins to customize the Kibana experience. Examples of extension points are:
- core.overlays.showModal
- embeddables.registerEmbeddableFactory
- uiActions.registerAction
- core.saedObjects.registerType
- core.savedObjects.registerType

## Follow up material

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,31 @@ describe('validateFilePathInput', () => {
describe('windows', () => {
const os = OperatingSystem.WINDOWS;

it('does not warn on valid filenames', () => {
expect(
validateFilePathInput({
os,
value: 'C:\\Windows\\*\\FILENAME.EXE-1231205124.gz',
})
).not.toBeDefined();
expect(
validateFilePathInput({
os,
value: "C:\\Windows\\*\\test$ as2@13---12!@#A,DS.#$^&$!#~ 'as'd.华语.txt",
})
).toEqual(undefined);
});

it('warns on wildcard in file name at the end of the path', () => {
expect(validateFilePathInput({ os, value: 'c:\\path*.exe' })).toEqual(
FILENAME_WILDCARD_WARNING
);
expect(
validateFilePathInput({
os,
value: 'C:\\Windows\\*\\FILENAME.EXE-*.gz',
})
).toEqual(FILENAME_WILDCARD_WARNING);
});

it('warns on unix paths or non-windows paths', () => {
Expand All @@ -34,6 +55,7 @@ describe('validateFilePathInput', () => {
expect(validateFilePathInput({ os, value: 'c:\\path/opt' })).toEqual(FILEPATH_WARNING);
expect(validateFilePathInput({ os, value: '1242' })).toEqual(FILEPATH_WARNING);
expect(validateFilePathInput({ os, value: 'w12efdfa' })).toEqual(FILEPATH_WARNING);
expect(validateFilePathInput({ os, value: 'c:\\folder\\' })).toEqual(FILEPATH_WARNING);
});
});
describe('unix paths', () => {
Expand All @@ -42,8 +64,22 @@ describe('validateFilePathInput', () => {
? OperatingSystem.MAC
: OperatingSystem.LINUX;

it('does not warn on valid filenames', () => {
expect(validateFilePathInput({ os, value: '/opt/*/FILENAME.EXE-1231205124.gz' })).not.toEqual(
FILENAME_WILDCARD_WARNING
);
expect(
validateFilePathInput({
os,
value: "/opt/*/test$ as2@13---12!@#A,DS.#$^&$!#~ 'as'd.华语.txt",
})
).not.toEqual(FILENAME_WILDCARD_WARNING);
});
it('warns on wildcard in file name at the end of the path', () => {
expect(validateFilePathInput({ os, value: '/opt/bin*' })).toEqual(FILENAME_WILDCARD_WARNING);
expect(validateFilePathInput({ os, value: '/opt/FILENAME.EXE-*.gz' })).toEqual(
FILENAME_WILDCARD_WARNING
);
});

it('warns on windows paths', () => {
Expand All @@ -54,6 +90,7 @@ describe('validateFilePathInput', () => {
expect(validateFilePathInput({ os, value: 'opt/bin\\file.exe' })).toEqual(FILEPATH_WARNING);
expect(validateFilePathInput({ os, value: '1242' })).toEqual(FILEPATH_WARNING);
expect(validateFilePathInput({ os, value: 'w12efdfa' })).toEqual(FILEPATH_WARNING);
expect(validateFilePathInput({ os, value: '/folder/' })).toEqual(FILEPATH_WARNING);
});
});
});
Expand Down Expand Up @@ -577,50 +614,82 @@ describe('Unacceptable Mac/Linux exact paths', () => {
});
});

describe('Executable filenames with wildcard PATHS', () => {
describe('hasSimpleExecutableName', () => {
it('should return TRUE when MAC/LINUX wildcard paths have an executable name', () => {
const os =
parseInt((Math.random() * 2).toString(), 10) === 1
? OperatingSystem.MAC
: OperatingSystem.LINUX;

expect(
hasSimpleExecutableName({
os: OperatingSystem.LINUX,
os,
type: 'wildcard',
value: '/opt/*/app',
})
).toEqual(true);
expect(
hasSimpleExecutableName({
os: OperatingSystem.MAC,
os,
type: 'wildcard',
value: '/op*/**/app.dmg',
})
).toEqual(true);
});

it('should return TRUE when WINDOWS wildcards paths have a executable name', () => {
expect(
hasSimpleExecutableName({
os: OperatingSystem.WINDOWS,
os,
type: 'wildcard',
value: 'c:\\**\\path.exe',
value: "/sy*/test$ as2@13---12!@#A,DS.#$^&$!#~ 'as'd.华语.txt",
})
).toEqual(true);
});

it('should return FALSE when MAC/LINUX wildcard paths have a wildcard in executable name', () => {
const os =
parseInt((Math.random() * 2).toString(), 10) === 1
? OperatingSystem.MAC
: OperatingSystem.LINUX;

expect(
hasSimpleExecutableName({
os: OperatingSystem.LINUX,
os,
type: 'wildcard',
value: '/op/*/*pp',
})
).toEqual(false);
expect(
hasSimpleExecutableName({
os: OperatingSystem.MAC,
os,
type: 'wildcard',
value: '/op*/b**/ap.m**',
})
).toEqual(false);
});

it('should return TRUE when WINDOWS wildcards paths have a executable name', () => {
expect(
hasSimpleExecutableName({
os: OperatingSystem.WINDOWS,
type: 'wildcard',
value: 'c:\\**\\path.exe',
})
).toEqual(true);
expect(
hasSimpleExecutableName({
os: OperatingSystem.WINDOWS,
type: 'wildcard',
value: 'C:\\*\\file-name.path华语 1234.txt',
})
).toEqual(true);
expect(
hasSimpleExecutableName({
os: OperatingSystem.WINDOWS,
type: 'wildcard',
value: "C:\\*\\test$ as2@13---12!@#A,DS.#$^&$!#~ 'as'd.华语.txt",
})
).toEqual(true);
});

it('should return FALSE when WINDOWS wildcards paths have a wildcard in executable name', () => {
expect(
hasSimpleExecutableName({
Expand Down
25 changes: 8 additions & 17 deletions packages/kbn-securitysolution-utils/src/path_validations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ export const enum OperatingSystem {
export type EntryTypes = 'match' | 'wildcard' | 'match_any';
export type TrustedAppEntryTypes = Extract<EntryTypes, 'match' | 'wildcard'>;

/*
* regex to match executable names
* starts matching from the eol of the path
* file names with a single or multiple spaces (for spaced names)
* and hyphens and combinations of these that produce complex names
* such as:
* c:\home\lib\dmp.dmp
* c:\home\lib\my-binary-app-+/ some/ x/ dmp.dmp
* /home/lib/dmp.dmp
* /home/lib/my-binary-app+-\ some\ x\ dmp.dmp
*/
export const WIN_EXEC_PATH = /(\\[-\w]+|\\[-\w]+[\.]+[\w]+)$/i;
export const UNIX_EXEC_PATH = /(\/[-\w]+|\/[-\w]+[\.]+[\w]+)$/i;

export const validateFilePathInput = ({
os,
value = '',
Expand All @@ -70,7 +56,7 @@ export const validateFilePathInput = ({
}

if (isValidFilePath) {
if (!hasSimpleFileName) {
if (hasSimpleFileName !== undefined && !hasSimpleFileName) {
return FILENAME_WILDCARD_WARNING;
}
} else {
Expand All @@ -86,9 +72,14 @@ export const hasSimpleExecutableName = ({
os: OperatingSystem;
type: EntryTypes;
value: string;
}): boolean => {
}): boolean | undefined => {
const separator = os === OperatingSystem.WINDOWS ? '\\' : '/';
const lastString = value.split(separator).pop();
if (!lastString) {
return;
}
if (type === 'wildcard') {
return os === OperatingSystem.WINDOWS ? WIN_EXEC_PATH.test(value) : UNIX_EXEC_PATH.test(value);
return (lastString.split('*').length || lastString.split('?').length) === 1;
}
return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
line-height: 100px;
border-radius: 100px;
display: inline-block;
background: $euiColorEmptyShade url('assets/texture.svg') no-repeat;
background: $euiColorEmptyShade url('/assets/texture.svg') no-repeat;
background-size: cover, 125%;
text-align: center;
}
Expand Down
15 changes: 12 additions & 3 deletions x-pack/plugins/cases/public/common/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,22 @@ export const LINK_APPROPRIATE_LICENSE = i18n.translate('xpack.cases.common.appro

export const CASE_SUCCESS_TOAST = (title: string) =>
i18n.translate('xpack.cases.actions.caseSuccessToast', {
values: { title },
defaultMessage: '{title} has been updated',
});

export const CASE_ALERT_SUCCESS_TOAST = (title: string) =>
i18n.translate('xpack.cases.actions.caseAlertSuccessToast', {
values: { title },
defaultMessage: 'An alert has been added to "{title}"',
});

export const CASE_SUCCESS_SYNC_TEXT = i18n.translate('xpack.cases.actions.caseSuccessSyncText', {
defaultMessage: 'Alerts in this case have their status synched with the case status',
});
export const CASE_ALERT_SUCCESS_SYNC_TEXT = i18n.translate(
'xpack.cases.actions.caseAlertSuccessSyncText',
{
defaultMessage: 'Alerts in this case have their status synched with the case status',
}
);

export const VIEW_CASE = i18n.translate('xpack.cases.actions.viewCase', {
defaultMessage: 'View Case',
Expand Down
Loading

0 comments on commit a6edc84

Please sign in to comment.