fix: swap hasOwnProperty args in _addMatch/_removeMatch#130
Open
poodle64 wants to merge 1 commit intodbusjs:masterfrom
Open
fix: swap hasOwnProperty args in _addMatch/_removeMatch#130poodle64 wants to merge 1 commit intodbusjs:masterfrom
poodle64 wants to merge 1 commit intodbusjs:masterfrom
Conversation
The arguments to Object.prototype.hasOwnProperty.call() were inverted, causing match rules to never be refcounted or cleaned up. Long-running processes accumulate D-Bus match rules without limit. Also update xml2js to 0.6.x to resolve prototype pollution CVE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_addMatchand_removeMatchinlib/bus.jshave the arguments toObject.prototype.hasOwnProperty.call()inverted. The first argument should be the object to check, and the second the property name, but they are swapped:Because the check always fails, match rules are never refcounted. Every
_addMatchcall sends anAddMatchD-Bus message and creates a new entry, and_removeMatchnever decrements or removes entries. In long-running processes, this causes unbounded accumulation of D-Bus match rules.Also bumps
xml2jsfrom^0.4.17to^0.6.2to resolve the prototype pollution CVE (CVE-2023-0842).How to verify
this._matchRulesgrows without bound andRemoveMatchis never called._addMatchcalls increment the count,_removeMatchdecrements it, andRemoveMatchis sent when the count reaches zero.Changes
lib/bus.js: Swap arguments in bothhasOwnProperty.call()invocationspackage.json: Bumpxml2jsto^0.6.2