mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 08:45:58 +03:00
[PR #5991] fix(rest): handle malformed JSON in shared URL parameters #5454
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5454
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5991
Author: @mahmoodhamdi
Created: 3/13/2026
Status: 🔄 Open
Base:
main← Head:fix/rest-ext-url-json-parse📝 Commits (1)
18c877afix(rest): handle malformed JSON in shared URL parameters📊 Changes
1 file changed (+14 additions, -6 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/RESTExtURLParams.ts(+14 -6)📄 Description
Description
translateExtURLParamsinRESTExtURLParams.tscallsJSON.parse()on URL parameters from shared links without any error handling. If a shared URL is truncated, corrupted, or manually edited with invalid JSON, the entire request loader crashes with an unhandled exception.This affects both the V0 and V1 shared URL formats — headers, params, body, and bodyParams are all parsed without protection.
Changes
safeJSONParsehelper that wrapsJSON.parsein a try-catch and returns a fallback value on failureJSON.parsecalls withsafeJSONParse, falling back to the request's existing defaultsHow to reproduce the original issue
https://hopp.sh/r/...with a truncated or invalidheadersorparamsquery param (e.g.?v=1&headers=%7B%22broken)Test plan
Summary by cubic
Safely parse shared REST URL parameters to prevent crashes from malformed JSON. V0 and V1 URLs now fall back to request defaults when
headers,params,body, orbodyParamsare invalid.safeJSONParseto wrapJSON.parsewith a fallback.Written for commit
18c877a709. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.