Repository navigation
fix: validate host headers and handle malformed editor URLs - #5771
Conversation
🦋 Changeset detectedLatest commit: 586fdb0 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughHost and Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5771 +/- ##
==========================================
+ Coverage 95.15% 95.36% +0.21%
==========================================
Files 6 6
Lines 5016 5029 +13
==========================================
+ Hits 4773 4796 +23
+ Misses 243 233 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Host and HTTP/2 authority headers currently share protocol exceptions intended for Origin, and malformed values can make open-editor URL parsing throw. Restrict those exceptions to Origin, validate Host syntax, and parse open-editor URLs with a fixed base, returning
400for malformed URLs.What kind of change does this PR introduce?
Fix.
Did you add tests for your changes?
Yes. Added regression coverage for malformed Host and authority headers, existing Origin behavior, and open-editor URL handling with
allowedHostsset to"auto", an explicit list, or"all".Does this PR introduce a breaking change?
No. The existing
isValidHost(headers, headerToCheck, validateHost)signature and calls are preserved. Malformed Host and authority headers are now rejected, including withallowedHosts: "all".If relevant, what needs to be documented once your changes are merged or what have you already documented?
Included a patch changeset describing Host and authority header validation and controlled handling of malformed open-editor URLs.
Use of AI
Yes. Codex assisted with the implementation, regression tests, debugging, and this PR description. The tests, lint, builds, and changeset validation listed above were executed locally.