Skip to content

fix: avoid prototype-chain bypass in hasExplicitProviderAccountConfig#34959

Closed
aerelune wants to merge 2 commits intoopenclaw:mainfrom
aerelune:fix/issue-34926
Closed

fix: avoid prototype-chain bypass in hasExplicitProviderAccountConfig#34959
aerelune wants to merge 2 commits intoopenclaw:mainfrom
aerelune:fix/issue-34926

Conversation

@aerelune
Copy link
Copy Markdown
Contributor

@aerelune aerelune commented Mar 4, 2026

Summary

  • replace in operator account checks with Object.prototype.hasOwnProperty.call in channel security audit
  • prevent prototype properties like constructor/__proto__ from being treated as explicitly configured accounts
  • add regression test to ensure prototype-chain keys do not trigger explicit account-path behavior

Testing

  • pnpm vitest run src/security/audit.test.ts -t "prototype properties"

Fixes #34926

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: S labels Mar 4, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 4, 2026

Greptile Summary

Summary

This PR correctly fixes a prototype-chain bypass vulnerability in hasExplicitProviderAccountConfig (src/security/audit-channel.ts).

The Fix

The function previously used the in operator to check whether an account ID exists in the configured accounts object. Since in traverses the prototype chain, well-known object properties like constructor, toString, or hasOwnProperty would always evaluate as present — causing the security audit to incorrectly annotate findings with (account: <proto-key>) for any channel plugin reporting such an account ID.

The fix correctly replaces accountId in accounts with Object.prototype.hasOwnProperty.call(accounts, accountId), which is the idiomatic guard that removes prototype-chain ambiguity entirely.

Testing

The regression test is well-designed: it verifies both that the security finding is still correctly emitted (the fix doesn't suppress legitimate warnings) and that the misleading (account: constructor) suffix is absent. The test uses accountId = "constructor" — a canonical prototype property — to validate the behavior.

Assessment

  • Minimal and correct — the fix is a single line that uses the standard JavaScript guard for own-property checks
  • Well-tested — regression test covers the exact scenario that was previously broken
  • Safe to merge — no risk of regression; the change only affects how the property existence check is performed, with no impact on legitimate account configurations

Confidence Score: 5/5

  • Safe to merge. The security fix is correct, minimal, and properly tested with a focused regression test.
  • The PR contains a straightforward, correct fix to a prototype-chain bypass vulnerability. The change from the in operator to Object.prototype.hasOwnProperty.call is the idiomatic JavaScript guard for this use case. The regression test validates the exact scenario that was previously broken (prototype properties being treated as explicitly configured accounts). No logic errors, no side effects, and no risk of regression.
  • No files require special attention

Last reviewed commit: 827292c

@benediktjohannes
Copy link
Copy Markdown
Contributor

Hello @aerelune,

thank you very much for your contribution. I really appreciate your work. Since we already have another pull request that was opened earlier (#34929) addressing this issue, I recommend commenting on the other pull request if you would like to suggest any changes. Thank you very much nevertheless.

cc @shakkernerd, could you please close this so that we don’t run into confusion with multiple PRs? Thanks!

@dvrshil
Copy link
Copy Markdown
Contributor

dvrshil commented Mar 5, 2026

Thanks for the work, @aerelune. This issue has been addressed by maintainer-selected PR #34982 (tracking issue #34926).\n\nTo keep the queue clean, I’m closing this as a duplicate.

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

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security]: Use of in operator in hasExplicitProviderAccountConfig can lead to prototype pollution bypass

3 participants