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

Validate textarea against FQDN #41

Merged
merged 11 commits into from
Apr 9, 2024
Merged

Validate textarea against FQDN #41

merged 11 commits into from
Apr 9, 2024

Conversation

stephdl
Copy link
Collaborator

@stephdl stephdl commented Apr 9, 2024

see https://community.nethserver.org/t/ns8-crowdsec-limited-domain-levels-in-allow-list/23301

the regex seems to validate at least 3 strings for a fqdn, we need to validate more than foo.joe.com. Furthermore @DavidePrincipi asked to validate everything in the json schema rather in the UI

Refs NethServer/dev#6900

what I learn:

  • idn-email json schema accepts really fun email address : https://en.wikipedia.org/wiki/Email_address#Internationalization
  • hostname accepts 1.2.3.450 as a valid hostname, hard to validate ipv4, I needed to make a regex to validate hostname
  • format ipv4 does not validate cidr ipv4 (I did a regex to validate a cidr ipv4)
  • format ipv6 does not validate cidr ipv6 (I did a regex to validate both)
  • empty array must be validated to :p

now we have a full json schema validation, nothing more in UI

Capture d’écran du 2024-04-09 13-01-29
Capture d’écran du 2024-04-09 13-01-44
Capture d’écran du 2024-04-09 13-01-58
image

the test data

10.10.10.0/24
2002::1234:abcd:ffff:c0a8:101/64
2002:0000:0000:1234:ffff:ffff:ffff:ffff
1.2.3.44
foo.org
foo.foo.org
12123564.org

@stephdl stephdl changed the title Validate textarea Validate textarea against FQDN Apr 9, 2024
@stephdl stephdl force-pushed the ValidateTextarea branch from 6f8820d to ff355ca Compare April 9, 2024 10:53
ui/public/i18n/en/translation.json Outdated Show resolved Hide resolved
ui/public/i18n/en/translation.json Outdated Show resolved Hide resolved
ui/public/i18n/en/translation.json Outdated Show resolved Hide resolved
ui/public/i18n/en/translation.json Outdated Show resolved Hide resolved
ui/public/i18n/en/translation.json Outdated Show resolved Hide resolved
Co-authored-by: Andrea Leardini <[email protected]>
@stephdl stephdl requested a review from andre8244 April 9, 2024 13:56
Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wise choice

@DavidePrincipi DavidePrincipi merged commit c403740 into main Apr 9, 2024
2 checks passed
@DavidePrincipi DavidePrincipi deleted the ValidateTextarea branch April 9, 2024 16:08
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 this pull request may close these issues.

3 participants