Skip to content

Commit d73e725

Browse files
[8.18] [ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038) (elastic#224204)
# Backport This will backport the following commits from `main` to `8.18`: - [[ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038)](elastic#219038) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Georgiana-Andreea Onoleață","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-29T07:27:18Z","message":"[ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038)\n\nCloses https://github.com/elastic/kibana/issues/218946\n\n## Summary\n\n- changed the GENERIC_REGEX to allow `-` \n\n<img width=\"488\" alt=\"Screenshot 2025-04-24 at 10 31 00\"\nsrc=\"https://github.com/user-attachments/assets/57841c74-9e6c-4600-81f4-8b454d1ddec1\"\n/>","sha":"d0d08b0bdb8f178e88063e0a05467f78d4d8b99f","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","backport:version","v9.1.0","v8.19.0","v9.0.3","v8.18.3"],"title":"[ResponseOps][Cases]Allow dashes in host names in Observables","number":219038,"url":"https://github.com/elastic/kibana/pull/219038","mergeCommit":{"message":"[ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038)\n\nCloses https://github.com/elastic/kibana/issues/218946\n\n## Summary\n\n- changed the GENERIC_REGEX to allow `-` \n\n<img width=\"488\" alt=\"Screenshot 2025-04-24 at 10 31 00\"\nsrc=\"https://github.com/user-attachments/assets/57841c74-9e6c-4600-81f4-8b454d1ddec1\"\n/>","sha":"d0d08b0bdb8f178e88063e0a05467f78d4d8b99f"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219038","number":219038,"mergeCommit":{"message":"[ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038)\n\nCloses https://github.com/elastic/kibana/issues/218946\n\n## Summary\n\n- changed the GENERIC_REGEX to allow `-` \n\n<img width=\"488\" alt=\"Screenshot 2025-04-24 at 10 31 00\"\nsrc=\"https://github.com/user-attachments/assets/57841c74-9e6c-4600-81f4-8b454d1ddec1\"\n/>","sha":"d0d08b0bdb8f178e88063e0a05467f78d4d8b99f"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/219489","number":219489,"state":"MERGED","mergeCommit":{"sha":"078e45f32cc56d76fbeb5ecffbf46d8262cc23bb","message":"[8.19] [ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038) (elastic#219489)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.19`:\n- [[ResponseOps][Cases]Allow dashes in host names in Observables\n(elastic#219038)](https://github.com/elastic/kibana/pull/219038)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Georgiana-Andreea Onoleață <[email protected]>"}},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
1 parent 541654f commit d73e725

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

x-pack/platform/plugins/shared/cases/public/components/observables/fields_config.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ describe('genericValidator', () => {
7575
} as Parameters<ValidationFunc>[0]);
7676
expect(result).toBeUndefined();
7777
});
78+
79+
it('should return undefined if the value contains dashes', () => {
80+
const result = genericValidator({
81+
value: 'valid-value',
82+
path: 'generic',
83+
} as Parameters<ValidationFunc>[0]);
84+
expect(result).toBeUndefined();
85+
});
7886
});
7987

8088
describe('domainValidator', () => {

x-pack/platform/plugins/shared/cases/public/components/observables/fields_config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const normalizeValueType = (value: string): keyof typeof fieldsConfig.val
2828
};
2929

3030
const DOMAIN_REGEX = /^(?!-)[A-Za-z0-9-]{1,63}(?<!-)\.[A-Za-z]{2,}$/;
31-
const GENERIC_REGEX = /^[a-zA-Z0-9._:/\\]+$/;
31+
const GENERIC_REGEX = /^[a-zA-Z0-9._:/\\-]+$/;
3232

3333
const notStringError = (path: string) => ({
3434
code: 'ERR_NOT_STRING',

0 commit comments

Comments
 (0)