Repository navigation
Conversation
Return HTTP 400 for invalid URL parsing without terminating the calculator or GPT Live server. Cover continued service and token authorization with offline regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Defect and impact
The cost calculator and GPT Live browser sample parsed HTTP request targets with
new URL(...)outside error handling. Invalid targets could cause an unhandled rejection in the asynchronous request callback, terminating the Node process before routing or token authorization. This is a local service denial of service: both servers bind to loopback by default, not the public Internet.Fix
ERR_INVALID_URLfrom request-target parsing and return HTTP 400 with a generic, non-cacheable response. Unrelated internal exceptions are not swallowed.This is one root issue across two local servers; no dependency changes or unrelated security fixes are included.
Validation
Reviewed baseline:
89e7e085bafe3754d0fc50a5315d33536af13dd6. Verified the expected origin, clean isolated worktree, and exact HEAD before edits.Before the fix, the new calculator subprocess test failed with a connection reset and the GPT Live offline regression independently failed with an unhandled
ERR_INVALID_URLin the actual HTTP callback.After the fix, on Windows with Node.js 26.13.0:
node --test tools\cost_calculator\calculator.test.mjs tools\cost_calculator\server.test.mjs— 27 passed.npm --prefix samples\gpt_live\js test— 38 passed (including browser bundle generation and same-origin token guards).node --checkfor both servers and the calculator app — passed.git diff --cached --check— passed.Dependencies were restored from the existing lockfile only after the initial test failed for a missing package, with installation/cache confined to the isolated worktree; the temporary cache was removed. No Azure credentials,
.envloading, deployments, or live-service calls were used. Browser/audio interaction and Linux execution were not tested locally. All six open PRs were reviewed, then refreshed before publication; none contained an equivalent malformed-target fix.