[Index Management] Disallow special characters when creating new enrich policy (#169494)

This commit is contained in:
Ignacio Rivas 2023-10-24 11:22:57 +02:00 committed by GitHub
parent a1955d7fbe
commit 1bc5949fb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,6 +41,8 @@ interface Props {
onNext: () => void;
}
const DISALLOWED_CHARS = ['"', ' ', '\\', '/', ',', '|', '>', '?', '*', '<'];
export const configurationFormSchema: FormSchema = {
name: {
type: FIELD_TYPES.TEXT,
@ -58,6 +60,20 @@ export const configurationFormSchema: FormSchema = {
)
),
},
{
validator: fieldValidators.containsCharsField({
message: i18n.translate(
'xpack.idxMgmt.enrichPolicyCreate.configurationStep.invalidCharactersInNameError',
{
defaultMessage: `Should not contain any of the following characters: {notAllowedChars}`,
values: {
notAllowedChars: DISALLOWED_CHARS.join(', '),
},
}
),
chars: DISALLOWED_CHARS,
}),
},
],
},