-
Notifications
You must be signed in to change notification settings - Fork 4
Add config.hosts configuration to production #1002
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
base: main
Are you sure you want to change the base?
Conversation
46a1c63 to
4359582
Compare
lib/host_patterns.rb
Outdated
| module HostPatterns | ||
| DEFAULT_HOST_PATTERNS = [ | ||
| /forms\.service\.gov\.uk/, | ||
| /www.forms\.service\.gov\.uk/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /www.forms\.service\.gov\.uk/, | |
| /www\.forms\.service\.gov\.uk/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Better than the regex checker I used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh and I think we need a regex for environments other than prod:
| /www.forms\.service\.gov\.uk/, | |
| /www\.forms\.service\.gov\.uk/, | |
| /www\.[^.*]*\.forms\.service\.gov\.uk/, |
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-1002.www.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
* Add config.hosts configuration to production and a HostPatterns module * Add an allowed hosts list based on the `forms.service.gov.uk` domain (there are fewer items on this list because the configuration for `forms-product-page differs slightly from `forms-runner` and `forms-admin`; this list should be sense-checked by another developer) * This aligns `forms-product-page` with how config.hosts is configured in `forms-admin` and `forms-runner`
4359582 to
901af8b
Compare
* It looks like forms.service.gov.uk always redirects to www.forms.service.gov.uk * We don't want requests going to the app from a host header that's just forms.service.gov.uk
What problem does this pull request solve?
Secure forms-runner from potential unwanted vulnerability scanning by enforcing a list of allowed hosts. Very similar to PR#1803 in
forms-runner(see link).This aligns
forms-product-pagewith howforms-adminandforms-runnerconfigures its config.hosts (see this link).Note: The list of default host patterns is based on my understanding of how we use the
www.forms.service.gov.ukdomain. I may be missing some context so do have a look to make sure I've not missed a variation on that domain or added anything which isn't necessary. I've also put the regex patterns through a regex checker just in case.