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 value of domain property #227

Merged
merged 2 commits into from
Nov 21, 2023
Merged

Validate value of domain property #227

merged 2 commits into from
Nov 21, 2023

Conversation

ppawlowski
Copy link
Contributor

@ppawlowski ppawlowski commented Nov 21, 2023

Description

This PR assures, that forge.domain value contains a valid domain name.
In result, installation without proper domain set will fail with:

Error: UPGRADE FAILED: values don't meet the specifications of the schema(s) in the following chart(s):
flowforge:
- forge.domain: Does not match pattern '^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,6}$'

Related Issue(s)

#226

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Backport needed? -> add the backport label
  • Includes a DB migration? -> add the area:migration label

@@ -8,7 +8,8 @@
"type": "string"
},
"domain": {
"type": "string"
"type": "string",
"pattern": "^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,6}$"
Copy link
Contributor

Choose a reason for hiding this comment

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

is the \\ because we need to escape the escape char in the sting?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see you've limited top level domains to between 2-6 chars

This is the current list which already has longer version (e.g. 11 for ACCOUNTANTS, or 15 for AMERICANEXPRESS )
https://data.iana.org/TLD/tlds-alpha-by-domain.txt

https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_domain_name

TLDs can contain special as well as latin characters. A TLD's maximum length is 63 characters, although most are around 2–3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is the \ because we need to escape the escape char in the sting?
Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied a change which allows TLD to be 25 characters - the longest from the IANA list at the time of writing.

Copy link
Contributor

@hardillb hardillb left a comment

Choose a reason for hiding this comment

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

This would mean people can't run forge on a top level domain, but I'm happy with that for now...

@hardillb hardillb merged commit e6de219 into main Nov 21, 2023
26 checks passed
@hardillb hardillb deleted the feat-domain-validation branch November 21, 2023 13:53
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.

2 participants