Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Add validation to input packages dataset field #181044

Closed
juliaElastic opened this issue Apr 17, 2024 · 1 comment · Fixed by #182925
Closed

[Fleet] Add validation to input packages dataset field #181044

juliaElastic opened this issue Apr 17, 2024 · 1 comment · Fixed by #182925
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@juliaElastic
Copy link
Contributor

juliaElastic commented Apr 17, 2024

Currently in input packages, the dataset name is not validated for invalid characters, there is only a description text to use characters that can be used as elasticsearch index name.

This issue was partially fixed in #180877 which uses the dataset name lowercase in index name, but it doesn't solve for using other special characters like *.
Currently the input type integration can't be added with dataset containing special chars, but there is an issue with rolling back an unsuccessful creation: #181032

I think it would be the clearest to add validation on UI and API, to disallow special characters in dataset name.
I think we should allow only a-z0-9_ characters.
Full criteria for valid index names: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

image
@juliaElastic juliaElastic added bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team labels Apr 17, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic juliaElastic self-assigned this May 7, 2024
juliaElastic added a commit that referenced this issue May 14, 2024
… special characters (#182925)

## Summary

Closes #181044

Added validation to allow only valid index names as dataset name in
input packages. Allowing lowercase letters, numbers, dot and underscore
(except in the beginning).

To verify:
- add Custom Logs integration
- modfiy dataset to add invalid characters e.g. *
- verify that the field shows a validation error
- verify that the save button is disabled
- verify that valid dataset names can be used

<img width="968" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/e9cd17f1-6f5b-464c-bc8d-83d2ec42bada">



### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue May 14, 2024
… special characters (elastic#182925)

## Summary

Closes elastic#181044

Added validation to allow only valid index names as dataset name in
input packages. Allowing lowercase letters, numbers, dot and underscore
(except in the beginning).

To verify:
- add Custom Logs integration
- modfiy dataset to add invalid characters e.g. *
- verify that the field shows a validation error
- verify that the save button is disabled
- verify that valid dataset names can be used

<img width="968" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/e9cd17f1-6f5b-464c-bc8d-83d2ec42bada">

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit be9b46d)
kibanamachine added a commit that referenced this issue May 14, 2024
…isallow special characters (#182925) (#183367)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Fleet] add validation to dataset field in input packages to disallow
special characters
(#182925)](#182925)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-05-14T08:45:54Z","message":"[Fleet]
add validation to dataset field in input packages to disallow special
characters (#182925)\n\n## Summary\r\n\r\nCloses
#181044 validation
to allow only valid index names as dataset name in\r\ninput packages.
Allowing lowercase letters, numbers, dot and underscore\r\n(except in
the beginning).\r\n\r\nTo verify:\r\n- add Custom Logs integration\r\n-
modfiy dataset to add invalid characters e.g. *\r\n- verify that the
field shows a validation error\r\n- verify that the save button is
disabled\r\n- verify that valid dataset names can be used\r\n\r\n<img
width=\"968\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/e9cd17f1-6f5b-464c-bc8d-83d2ec42bada\">\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"be9b46d911f8648203a4c1d5fe4ccea848020ef7","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","v8.15.0"],"title":"[Fleet]
add validation to dataset field in input packages to disallow special
characters","number":182925,"url":"#182925
add validation to dataset field in input packages to disallow special
characters (#182925)\n\n## Summary\r\n\r\nCloses
#181044 validation
to allow only valid index names as dataset name in\r\ninput packages.
Allowing lowercase letters, numbers, dot and underscore\r\n(except in
the beginning).\r\n\r\nTo verify:\r\n- add Custom Logs integration\r\n-
modfiy dataset to add invalid characters e.g. *\r\n- verify that the
field shows a validation error\r\n- verify that the save button is
disabled\r\n- verify that valid dataset names can be used\r\n\r\n<img
width=\"968\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/e9cd17f1-6f5b-464c-bc8d-83d2ec42bada\">\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"be9b46d911f8648203a4c1d5fe4ccea848020ef7"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#182925
add validation to dataset field in input packages to disallow special
characters (#182925)\n\n## Summary\r\n\r\nCloses
#181044 validation
to allow only valid index names as dataset name in\r\ninput packages.
Allowing lowercase letters, numbers, dot and underscore\r\n(except in
the beginning).\r\n\r\nTo verify:\r\n- add Custom Logs integration\r\n-
modfiy dataset to add invalid characters e.g. *\r\n- verify that the
field shows a validation error\r\n- verify that the save button is
disabled\r\n- verify that valid dataset names can be used\r\n\r\n<img
width=\"968\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/e9cd17f1-6f5b-464c-bc8d-83d2ec42bada\">\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"be9b46d911f8648203a4c1d5fe4ccea848020ef7"}}]}]
BACKPORT-->

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
2 participants