Repository navigation
fix(core): own-property lookups for CodeMode fetch response headers (#805) - #808
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Fixes #805
The CodeMode fetch shim built response headers with
Object.fromEntries(a plainObject.prototype-backed record) and read them with[]and theinoperator, so absent headers whose lowercased names collide with all-lowercase prototype members read as present:get('constructor')returned the Object function,get('__proto__')returnedObject.prototype, andhas()returned true for both.Fix (
packages/core/src/codemode/web.ts): own-property lookups only, following the #792/#793 precedent —get/hasnow guard withObject.hasOwn.entries()is unchanged, and a header actually sent under a prototype name (e.g. a literalconstructorheader) still resolves to its string value, becauseObject.fromEntriesdefines it as an own property.Regression test (
packages/core/test/codemode/web.test.ts): serves a real response viaBun.servecarrying onlycontent-typeandx-real, and pinsconstructor/__proto__tonull/false, ordinary present/absent headers to their previous behavior, and a genuinely sentconstructorheader to its value.Verification:
~/git/fleet/2969-805-codemode-headers): new test fails on pre-fix code (1 fail), passes with the fix (2/2); full codemode suite 26/26 pass.Queue: task 2969 (
repo-health-opencode-pilot), lane B worker shift.Need help on this PR? Tag
@codesmith-botwith what you need.