Fix medium-severity audit issues in core query and React bindings#4
Merged
ConsoleTVs merged 2 commits intomainfrom Apr 12, 2026
Merged
Fix medium-severity audit issues in core query and React bindings#4ConsoleTVs merged 2 commits intomainfrom
ConsoleTVs merged 2 commits intomainfrom
Conversation
…dings - Wrap BroadcastChannel.postMessage() in try-catch to prevent DataCloneError crashes - Add abort signal support to once() to fix event listener leaks in stream()/sequence() generators - Guard against abort race condition in trigger() by checking signal.aborted before cache write - Capture broadcast reference in subscribeBroadcast() to prevent stale closure after configure() - Handle rejected promises in forget() to prevent hanging or throwing on pending cache items - Add BroadcastChannel availability guard in QueryProvider for edge runtime compatibility - Fix tautological test assertions comparing variables to themselves in cache access test
…detected The abort guard in trigger() was returning without resolving or rejecting the outer promise, which would leave callers hanging indefinitely. Now properly rejects with the abort reason.
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
Resolves 7 medium-severity issues identified during the codebase audit. These fixes address event listener leaks, race conditions, error handling gaps, and cross-environment compatibility.
Core Query Engine (
query.ts)BroadcastChannel.postMessage()in try-catch to preventDataCloneErrorcrashes when emitting non-cloneable dataAbortSignalsupport toonce(), enablingstream()andsequence()generators to clean up event listeners when consumers break out of iterationtrigger()— checkscontroller.signal.abortedafter fetch resolves to prevent writing stale data to cache after anabort()callsubscribeBroadcast()to prevent stale closure ifconfigure()replaces the broadcast channelawait item.iteminforget()with try-catch so rejected promises don't prevent remaining keys from being forgottenType Definitions (
options.ts)OnceFunctiontype to accept optionalAbortSignalparameter (non-breaking — parameter is optional)React Bindings (
QueryProvider.tsx)typeof BroadcastChannelguard inuseEffectfor edge runtime compatibilityTests (
query.test.ts)itemsto itself instead ofitemsCache