Skip to content

fix(valve): prevent permission bypass on unparsable message data - #1147

Open
Matoo125 wants to merge 1 commit into
deepstreamIO:masterfrom
Matoo125:fix/valve-rule-parse-error-bypass
Open

Matoo125 wants to merge 1 commit into
deepstreamIO:masterfrom
Matoo125:fix/valve-rule-parse-error-bypass

Conversation

@Matoo125

Copy link
Copy Markdown

Description

When message data conversion fails (e.g. malformed JSON payload in RECORD UPDATE, PATCH, PATCH_MULTI, EVENT, or RPC), getCurrentData() called this.onRuleError() which correctly invoked callback(..., false) and destroyed the application state.

However, getCurrentData() did not return after calling this.onRuleError(), falling through and returning undefined. run() did not check this.isDestroyed after constructing arguments with getArguments(), and proceeded to evaluate the permission rule with data = undefined. If the rule evaluated to true, run() invoked this.params.callback(..., null, true) a second time, effectively granting permission despite the earlier parse failure.

Changes

  • Add missing return statements after calling onRuleError() in getCurrentData() and crossReference().
  • Add if (this.isDestroyed) return; guard checks in run().
  • Ensure isReady() returns false if this.isDestroyed is true.
  • Add regression test in config-permission-other.spec.ts asserting single-callback denial behavior when message data is unparsable.

When message data conversion fails, getCurrentData() invoked onRuleError()
which called callback(..., false) and destroy(), but did not return immediately.
This allowed run() to continue executing the permission rule with undefined
data and invoke callback(..., null, result) a second time, potentially
granting permission if the rule evaluated to true.

Add missing return statements after onRuleError() in getCurrentData() and
crossReference(), add isDestroyed guards in run(), and ensure isReady()
returns false once destroyed.

Reported-by: BS.ehlas.cz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant