Skip to content

fix(observations): keep a JSON field named __proto__ - #10

Draft
pjeweb wants to merge 2 commits into
osb/pr/fuzz-property-testsfrom
osb/pr/json-record-proto-key
Draft

pjeweb wants to merge 2 commits into
osb/pr/fuzz-property-testsfrom
osb/pr/json-record-proto-key

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 22, 2026 •

Copy link
Copy Markdown

parseJsonRecord (and the UFI envelope flattening) built its record with plain assignment, so a field named __proto__ replaced the record's prototype instead of becoming a field. It vanished from the record's keys and the vendor-supplied value became inherited state. No device I know of sends that name, but the record is built from a router's response body.

  • The record is now built with Object.fromEntries, which keeps __proto__ as an ordinary field. The UFI parser (flattenUfiEnvelope) had the same assignment and gets the same fix.
  • Regression tests for both parsers plus properties that every field of a JSON object or UFI reply survives as a field, including __proto__ and constructor.

The new tests fail on main. Sits on the property test PR.

parseJsonRecord assigned each field with plain property assignment, so a vendor field named __proto__ replaced the record's prototype and disappeared from its keys. The record is now built with Object.fromEntries, which keeps it as an ordinary field.
@pjeweb pjeweb added upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. stacked Depends on another pull request; review and integrate parents first. labels Nov 22, 2026
flattenUfiEnvelope had the same plain assignment as parseJsonRecord, so a params field or envelope key named __proto__ replaced the record's prototype and was dropped. It now builds the record with Object.fromEntries. A regression test and a property cover UFI bodies.
@pjeweb pjeweb added the parked Parked or held for now; not planned for a train until picked up again. label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parked Parked or held for now; not planned for a train until picked up again. stacked Depends on another pull request; review and integrate parents first. upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant