Skip to content

fix: scope private RPC log scans#540

Merged
0xKitsune merged 1 commit into
mainfrom
mattsse/fix-private-rpc-log-scan-scoping
Jun 25, 2026
Merged

fix: scope private RPC log scans#540
0xKitsune merged 1 commit into
mainfrom
mattsse/fix-private-rpc-log-scan-scoping

Conversation

@mattsse

@mattsse mattsse commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Requires private RPC log filters to include the authenticated caller in an eligible indexed topic before the query reaches the backend.

Root Cause

Private log APIs previously scoped token addresses and whitelisted event topic0 before backend retrieval, but caller-specific topic eligibility was only enforced after logs were fetched. That allowed broad backend scans even though unrelated logs were filtered out of the response.

Impact

eth_getLogs, installed log filters, and websocket log subscriptions now reject underscoped private log filters with invalid params. Callers can still query sender/owner-style visibility with the caller in topic1, or recipient/spender-style visibility for two-party events with the caller in topic2, while the existing final visibility filter remains in place.

@mattsse mattsse requested a review from 0xKitsune as a code owner June 25, 2026 10:40
@mattsse mattsse closed this Jun 25, 2026
@mattsse mattsse reopened this Jun 25, 2026
@mattsse mattsse force-pushed the mattsse/fix-private-rpc-log-scan-scoping branch from bed8b22 to 63ee408 Compare June 25, 2026 10:57
Comment thread crates/rpc/src/filter.rs
Comment on lines +160 to +162
if filter.topics[0].len() == 1 && filter.topics[0].contains(&B256::ZERO) {
return Ok(());
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think this can just be:

if filter.topics[0] == FilterSet::from(B256::ZERO) {
    return Ok(());
}

@0xKitsune 0xKitsune added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit d78d482 Jun 25, 2026
14 checks passed
@0xKitsune 0xKitsune deleted the mattsse/fix-private-rpc-log-scan-scoping branch June 25, 2026 16:38
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.

2 participants