forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into task-manager/schema-config
* master: Rename `/api/security/oidc` to `/api/security/oidc/callback`. (elastic#53886) Updating transitive dependencies to use handlebars@4.5.3 (elastic#53899) [Reporting/Tests] consolidate functional test configs (elastic#52671) [Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel (elastic#52833) [Test/Newsfeed] Re-enable test and add news item to be filtered (elastic#53905) cleanup server-log action (elastic#53326) [Uptime] Delete uptime eslint rule skip (elastic#50912) [skip-ci] Expression Lifecycle Docs (elastic#51494) [Endpoint] add react router to endpoint app (elastic#53808) [SIEM][Detection Engine] Silence 409 errors on signal creation (elastic#53859) [Maps] get max_result_window and max_inner_result_window from index settings (elastic#53500) [ML] New Platform server shim: update analytics routes to use new platform router (elastic#53521) fixes typo on engine detection page (elastic#53877)
- Loading branch information
Showing
92 changed files
with
9,032 additions
and
5,427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
x-pack/legacy/plugins/actions/server/builtin_action_types/lib/string_utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { withoutControlCharacters } from './string_utils'; | ||
|
||
describe('ensureSingleLineString()', () => { | ||
test('works with plain ole strings', () => { | ||
expect(withoutControlCharacters('')).toEqual(''); | ||
expect(withoutControlCharacters(' a b c ')).toEqual(' a b c '); | ||
}); | ||
|
||
test('works with multiple control characters', () => { | ||
expect(withoutControlCharacters(' \r \n ')).toEqual(' ; ; '); | ||
expect(withoutControlCharacters('\r \n ')).toEqual('; ; '); | ||
expect(withoutControlCharacters(' \r \n')).toEqual(' ; ;'); | ||
expect(withoutControlCharacters('\r \n')).toEqual('; ;'); | ||
}); | ||
|
||
test('works with /00-/1F, except tab', () => { | ||
for (let c = 0; c <= 0x1f; c++) { | ||
if (c === 0x09) { | ||
expect(withoutControlCharacters(String.fromCharCode(c))).toEqual('\t'); | ||
} else { | ||
expect(withoutControlCharacters(String.fromCharCode(c))).toEqual(';'); | ||
} | ||
} | ||
expect(withoutControlCharacters(String.fromCharCode(0x20))).toEqual(' '); | ||
}); | ||
|
||
test('works with /7F-/9F', () => { | ||
expect(withoutControlCharacters(String.fromCharCode(0x7e))).toEqual('~'); | ||
for (let c = 0x7f; c <= 0x9f; c++) { | ||
expect(withoutControlCharacters(String.fromCharCode(c))).toEqual(';'); | ||
} | ||
const nbsp = String.fromCharCode(0xa0); | ||
expect(withoutControlCharacters(nbsp)).toEqual(nbsp); | ||
}); | ||
|
||
test('works with UCS newlines', () => { | ||
expect(withoutControlCharacters('\u2027')).toEqual('\u2027'); | ||
expect(withoutControlCharacters('\u2028')).toEqual(';'); | ||
expect(withoutControlCharacters('\u2029')).toEqual(';'); | ||
expect(withoutControlCharacters('\u202A')).toEqual('\u202A'); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
x-pack/legacy/plugins/actions/server/builtin_action_types/lib/string_utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
// see: https://en.wikipedia.org/wiki/Unicode_control_characters | ||
// but don't include tabs (0x09), they're fine | ||
const CONTROL_CHAR_PATTERN = /[\x00-\x08]|[\x0A-\x1F]|[\x7F-\x9F]|[\u2028-\u2029]/g; | ||
|
||
// replaces control characters in string with ;, but leaves tabs | ||
export function withoutControlCharacters(s: string): string { | ||
return s.replace(CONTROL_CHAR_PATTERN, ';'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.