fix: use Object.create(null) when parsing query, headers, and params - #5161
Merged
Conversation
Bundle size check
Compiler Diagnostics (tsc)
Compiler Diagnostics (typescript-go)
Reported by octocov |
HTTP Performance Benchmark
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5161 +/- ##
=======================================
Coverage 79.04% 79.04%
=======================================
Files 154 154
Lines 10779 10779
Branches 2256 2256
=======================================
Hits 8520 8520
Misses 2259 2259 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
Hey @usualoma ! Can you review this? As I wrote in the description, this should not be a security fix. |
Member
|
@yusukebe |
Member
Author
|
@usualoma Thank you! Merging. |
MadaBurns
pushed a commit
to MadaBurns/bv-mcp
that referenced
this pull request
Jul 26, 2026
Production framework bump, patch-level. Reviewed against actual usage:
- SSE fixes do not apply: our MCP SSE transport is a hand-rolled
ReadableStream in src/lib/sse.ts, not hono/streaming's streamSSE.
- secure-headers CSP fix does not apply: middleware not used.
- parseBody/multipart fixes do not apply: only the native
c.req.formData() is used, in the OAuth authorize/token routes.
- Object.create(null) for query/header/param parsing (honojs/hono#5161)
is the one change with real blast radius, since c.req.query() and
c.req.param() are used throughout. Both hasOwnProperty call sites in
src/ use the safe Object.prototype.hasOwnProperty.call() form and
neither operates on a hono-derived object, so this is safe — and it
is a prototype-pollution hardening improvement.
Hono imports in src/ are limited to Hono, Context, and hono/cors.
12 tasks
1 task
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.
A
__proto__key in a request could change the prototype of the returned object. I useObject.create(null)to keep__proto__as a normal key. This is limited to that single object and does not touchObject.prototype, so it is not prototype pollution. This is a code-quality fix, not a security fix.By the way, I am planning to create a utility function to do
Object.create(null)to reduce the bundle size.The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the code