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

Force UrlGenerator's Root URL to be the base of APP_URL unless overriden #10528

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

uberbrady
Copy link
Collaborator

@uberbrady uberbrady commented Jan 18, 2022

Under certain circumstances attackers can forge a Host: header and phish users into visiting incorrect domains. Also adds a new .env var that permits overriding this new restriction.

This has not been fully tested yet. I don't have a subdirectory configuration working for Snipe-IT yet so I can't quite test that, but I'm pretty sure that the hostname part works, and the .env var is being correctly respected.

Tests -

  • Changing the APP_URL forces all generated URL's to follow the APP_URL
  • Adding subdirectories to the APP_URL at least doesn't double-up the subdirectory name (reported problem in the wild with this particular solution, which I fixed)
  • Turning on APP_ALLOW_INSECURE_HOSTS permits the old behavior
  • nonstandard ports (non-default ports)
  • subdirectories
  • Making sure http and https protocols both work (easy enough in Valet, luckily)

Marking this as [WIP] because not all tests are complete

@uberbrady
Copy link
Collaborator Author

(Whoops, yes, I meant subdirectory!)

@uberbrady uberbrady marked this pull request as ready for review January 25, 2022 02:26
@uberbrady uberbrady requested a review from snipe as a code owner January 25, 2022 02:26
@uberbrady uberbrady merged commit 48f1380 into snipe:develop Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant