fix: validate ORIGIN env variable includes protocol in adapter-node#15261
Closed
FrankFMY wants to merge 2 commits intosveltejs:mainfrom
Closed
fix: validate ORIGIN env variable includes protocol in adapter-node#15261FrankFMY wants to merge 2 commits intosveltejs:mainfrom
FrankFMY wants to merge 2 commits intosveltejs:mainfrom
Conversation
Add early validation for the ORIGIN environment variable to check that it includes a protocol (http:// or https://). Previously, setting ORIGIN without a protocol (e.g. "localhost:3000") would cause a cryptic 400 Bad Request error at request time. Now it fails fast at startup with a descriptive error message. Closes sveltejs#14978
🦋 Changeset detectedLatest commit: 2565429 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
The CI failure is the |
Contributor
|
Closing in favor of #15045 |
Contributor
|
Please perform at least a cursory check to make sure there are not other open PRs fixing the same issue you're filing a PR for. This is a useless waste of time for us to review and it's obvious there's another open PR attached to the associated issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the
ORIGINenvironment variable is set without a protocol (e.g.ORIGIN=localhost:3000), the server responds with a generic400 Bad Requesterror at request time, which is misleading since the HTTP request itself is not malformed.This adds early validation at startup to check that
ORIGINincludes a protocol scheme (http://orhttps://), similar to howBODY_SIZE_LIMITis validated. The error message now clearly explains what's wrong and how to fix it.Closes #14978