Repository navigation
fix(config): ignore inherited keys when restoring env refs - #109463
Conversation
f072447 to
da5c4fd
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 5:30 AM ET / 09:30 UTC. Summary PR surface: Source 0, Tests +12. Total +12 across 2 files. Reproducibility: yes. source-reproducible with high confidence: a custom-prototype Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Merge the narrow own-property correction after the exact-head hosted checks complete, retaining the regression that protects custom-prototype inputs without changing normal JSON or JSON5 configuration semantics. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: a custom-prototype Is this the best way to solve the issue? Yes. Replacing only the membership predicate at the restoration boundary is the narrowest maintainable fix; parser normalization or changing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5057fd9e597e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +12. Total +12 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (8 earlier review cycles)
|
da5c4fd to
b8b83b8
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
…e pollution When key comes from Object.entries(incoming) on user config data, 'key in parsed' traverses the prototype chain. If a config key collides with an Object.prototype property (e.g. 'toString'), the check incorrectly returns true and calls restoreEnvVarRefs with a prototype function instead of a config value. Replace with Object.hasOwn(parsed, key) to check only own properties.
79d233c to
79996ef
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(config): ignore inherited keys when restoring env refs This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
@clawsweeper automerge |
|
🦞🔧
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
|
|
Merged via squash.
|
Summary
Use
Object.hasOwn(parsed, key)when restoring environment references so inherited properties are not treated as authored configuration.What Problem This Solves
restoreEnvVarRefsaccepts plain-object values whose prototype may be customized. Its object branch iterates ownincomingentries, but the previouskey in parsedcheck also admitted inheritedparsedproperties. An inherited environment-reference template could therefore replace an incoming own value even though that template was never authored on the parsed object.Root Cause
intraverses the prototype chain.Object.hasOwnmatches the authored-key semantics used by adjacent config helpers.isPlainObjectintentionally accepts custom prototypes, so narrowing the membership check is the correct local owner-boundary fix.Why This Fix
isPlainObjectcontract change.User Impact
Normal JSON and JSON5 config behavior is unchanged. Internal or custom callers that pass plain objects with custom prototypes no longer restore inherited environment-reference templates.
Evidence
key in parsed, the focused suite fails because the inherited template is restored.Object.hasOwn, the incoming value is preserved.Tests and Validation
src/config/env-preserve.test.tspassed, 72/72 tests.oxfmt --checkpassed.Changelog
Not required: internal hardening with no documented JSON or JSON5 behavior change.