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

[component] Restrict allowed characters for component.ID name #10673

Closed
mwear opened this issue Jul 19, 2024 · 0 comments · Fixed by #10674
Closed

[component] Restrict allowed characters for component.ID name #10673

mwear opened this issue Jul 19, 2024 · 0 comments · Fixed by #10674

Comments

@mwear
Copy link
Member

mwear commented Jul 19, 2024

#9208 added restrictions to the allowed characters for component.ID type. While working on #10495 we discovered that there are not any restrictions on the name field. This issue proposes that we add similar restrictions to name.

@mwear mwear changed the title Restrict allowed characters for component.ID name [component] Restrict allowed characters for component.ID name Jul 20, 2024
mx-psi pushed a commit that referenced this issue Jul 25, 2024
#### Description
While working on
#10495 we
discovered that there are not any restrictions on the `name` field of a
`component.ID`. There are restrictions on the `type` field introduced in
#9208. This PR adds similar restrictions to `name`.

A type must
- have at least one character,
- start with an ASCII alphabetic character and
- can only contain ASCII alphanumeric characters and '_'.

I found that we need a slightly different set of rules for name as some
tests use a digit and others use a uuid as a name. A name is still
optional, but if it's provided it must:
- have at least one character,
- start with an ASCII alphanumeric character and
- can only contain ASCII alphanumeric characters, '_', and '-'.

I'd be willing to adjust these restrictions if anyone has any opinions
on what should or should not be allowed.

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #10673

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests

<!--Describe the documentation added.-->
#### Documentation
Code comments

<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant