Skip to content

fix(config): ignore inherited keys when restoring env refs - #109463

Merged
steipete merged 6 commits into
openclaw:mainfrom
zenglingbiao:fix/bonjour-parse-tailscale-json
Jul 18, 2026
Merged

steipete merged 6 commits into
openclaw:mainfrom
zenglingbiao:fix/bonjour-parse-tailscale-json

Conversation

@zenglingbiao

@zenglingbiao zenglingbiao commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Use Object.hasOwn(parsed, key) when restoring environment references so inherited properties are not treated as authored configuration.

What Problem This Solves

restoreEnvVarRefs accepts plain-object values whose prototype may be customized. Its object branch iterates own incoming entries, but the previous key in parsed check also admitted inherited parsed properties. 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

  • in traverses the prototype chain.
  • Object.hasOwn matches the authored-key semantics used by adjacent config helpers.
  • isPlainObject intentionally accepts custom prototypes, so narrowing the membership check is the correct local owner-boundary fix.

Why This Fix

  • One canonical own-property check at the restoration decision.
  • No parser normalization, compatibility shim, or broader isPlainObject contract change.
  • Matches sibling config-path and merge-patch own-key handling.

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

  • The original submitted test also passed with the old implementation, so the maintainer fixup replaced it.
  • The repaired regression creates a custom prototype carrying an inherited template.
  • With key in parsed, the focused suite fails because the inherited template is restored.
  • With Object.hasOwn, the incoming value is preserved.

Tests and Validation

  • Blacksmith Testbox baseline: 1 focused regression failure with the old membership check.
  • Blacksmith Testbox fixed: src/config/env-preserve.test.ts passed, 72/72 tests.
  • Targeted oxfmt --check passed.
  • Maintainer autoreview passed with no findings.
  • Exact-head hosted CI is required before merge.

Changelog

Not required: internal hardening with no documented JSON or JSON5 behavior change.

@zenglingbiao
zenglingbiao force-pushed the fix/bonjour-parse-tailscale-json branch from f072447 to da5c4fd Compare July 17, 2026 00:40
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 5:30 AM ET / 09:30 UTC.

Summary
The PR replaces prototype-chain membership in restoreEnvVarRefs with an own-property check and adds a regression test for inherited parsed properties.

PR surface: Source 0, Tests +12. Total +12 across 2 files.

Reproducibility: yes. source-reproducible with high confidence: a custom-prototype parsed object containing an inherited environment-reference template reaches the prior key in parsed branch, while the added regression demonstrates the intended preserved incoming value.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • [P2] No concrete automated repair remains; retain this PR for ordinary maintainer approval once exact-head hosted checks finish.

Security
Cleared: The diff only narrows an object-property presence check and adds a regression test; it adds no dependency, CI, secret, permission, or execution-path surface.

Review details

Best 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 parsed object containing an inherited environment-reference template reaches the prior key in parsed branch, while the added regression demonstrates the intended preserved incoming value.

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 isPlainObject would broaden behavior beyond the demonstrated defect.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5057fd9e597e.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded configuration-correctness fix with limited blast radius and no reported user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides before/after Blacksmith Testbox evidence for the exact regression: the old predicate failed the focused case and the fixed focused suite passed 72/72 tests.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before/after Blacksmith Testbox evidence for the exact regression: the old predicate failed the focused case and the fixed focused suite passed 72/72 tests.
Evidence reviewed

PR surface:

Source 0, Tests +12. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 12 0 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 13 1 +12

What I checked:

  • Changed decision point: Against the current main base, the PR changes the restoration gate from key in parsed to Object.hasOwn(parsed, key), so only authored parsed keys can supply an environment-reference template. (src/config/env-preserve.ts:823, 9fda0b164865)
  • Regression coverage: The added test creates a custom prototype with an inherited ${TEST_VALUE} template and verifies that an incoming own toString value remains unchanged, directly covering the prior prototype-chain behavior. (src/config/env-preserve.test.ts:836, 9fda0b164865)
  • Feature history: Commit 465feebd77f9bfa05e7fba67bf0b503ca9ce8db7 added the targeted regression after the initial fix, and the subsequent branch updates were carried by the current assignee; this supports routing review to the recent configuration-path contributor. (src/config/env-preserve.test.ts:836, 465feebd77f9)
  • Behavior proof: The PR body records a Blacksmith Testbox baseline failure with the old membership check and a fixed focused run of src/config/env-preserve.test.ts passing 72/72 tests; this is relevant after-fix runtime evidence for the narrowly changed path. (src/config/env-preserve.test.ts:836, 9fda0b164865)

Likely related people:

  • steipete: Added the regression commit, carried the branch through subsequent main merges, and is assigned to the PR. (role: recent configuration-path contributor and regression-test author; confidence: high; commits: 465feebd77f9, 97ea5bff3587, 9fda0b164865; files: src/config/env-preserve.ts, src/config/env-preserve.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (8 earlier review cycles)
  • reviewed 2026-07-17T00:46:53.536Z sha da5c4fdae35f50bf848605c674c8773f65ed0098 :: needs real behavior proof before merge. :: [P1] Keep error handling at one boundary
  • reviewed 2026-07-17T01:50:07.805Z sha da5c4fdae35f50bf848605c674c8773f65ed0098 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T23:41:59.334Z sha b8b83b8c44d191181fbb2b4596a28ebd95d90fbd :: needs real behavior proof before merge. :: [P1] Keep malformed-output handling at the discovery boundary
  • reviewed 2026-07-18T06:45:26.850Z sha b8b83b8c44d191181fbb2b4596a28ebd95d90fbd :: needs real behavior proof before merge. :: [P1] Apply the config fix described by this PR | [P1] Handle malformed Tailscale output at the discovery boundary | [P2] Avoid exporting parser access through a test-only global
  • reviewed 2026-07-18T07:03:02.185Z sha 79996ef :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T07:45:51.915Z sha 79996ef :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T09:15:43.560Z sha 97ea5bf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T09:21:48.467Z sha 3d92f42 :: needs maintainer review before merge. :: none

@zenglingbiao
zenglingbiao force-pushed the fix/bonjour-parse-tailscale-json branch from da5c4fd to b8b83b8 Compare July 17, 2026 23:38
@zenglingbiao zenglingbiao changed the title fix(bonjour): guard parseTailscaleStatusIPv4s against malformed JSON fix(config): use Object.hasOwn in restoreEnvVarRefs to avoid prototype pollution Jul 18, 2026
@zenglingbiao
zenglingbiao requested review from a team as code owners July 18, 2026 06:57
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web labels Jul 18, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 18, 2026
@github-actions

github-actions Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh /allow-dependencies-change comment after the guard blocks that new head SHA.

  • Current SHA: 9fda0b164865757c5999bd263b1bf0410ccffafd

…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.
@zenglingbiao
zenglingbiao force-pushed the fix/bonjour-parse-tailscale-json branch from 79d233c to 79996ef Compare July 18, 2026 07:00
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

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.

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🔧
ClawSweeper automerge is enabled.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-07-18 09:39:04 UTC review queued 9fda0b164865 (queued)

@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants