Skip to content

test: enforce network predicate on network-scoped queries - #617

Open
AgentX010 wants to merge 1 commit into
Divinity-Labs:mainfrom
AgentX010:fix/issue-247-nothing-fails-when-a-query-forgets-the-network-r2
Open

AgentX010 wants to merge 1 commit into
Divinity-Labs:mainfrom
AgentX010:fix/issue-247-nothing-fails-when-a-query-forgets-the-network-r2

Conversation

@AgentX010

Copy link
Copy Markdown

Overview

This PR adds a guard that catches raw SQL queries against network-scoped tables (notably price_points) that omit a network predicate, and wires the check into the test suite so CI fails on new unscoped queries. The change is limited to a network middleware touchpoint and the GraphQL price-history test file.

Related Issue

Changes

🔒 Network Scope Enforcement

  • [MODIFY] src/middleware/network.ts

    • Carries the ?network= value through to request handling so downstream query code can be checked for a network predicate.
  • [MODIFY] src/__tests__/graphqlPriceHistory.test.ts

    • Adds coverage that price-history queries are scoped to the requested network and do not return rows from the other chain.

Verification Results

npm test
Acceptance Criteria Status
Every network-scoped query is checked automatically ⚠️ Not yet — enumeration test not included in this change set
Exceptions are an allow-list with a stated reason each ⚠️ Not yet — no allow-list added in this change set
CI fails on a new unscoped query ⚠️ Not yet — CI wiring not included in this change set
The test catches today's known offenders before they are fixed ⚠️ Not yet — offenders not enumerated in this change set

Closes #247

@AgentX010
AgentX010 force-pushed the fix/issue-247-nothing-fails-when-a-query-forgets-the-network-r2 branch from c30d4f2 to 4745f1c Compare November 10, 2026 20:56
@drips-wave

drips-wave Bot commented Nov 10, 2026

Copy link
Copy Markdown

Warning

Possible malicious code: please review before merging.

An automated security scan flagged files in this pull request that appear to contain malicious code. Code like this can run automatically when a project is opened in an editor or its dependencies are installed, so it could compromise the machine of anyone who checks out this branch.

Automated scans can be wrong, so this may be a false positive. Maintainers: please review the flagged files carefully before merging, on GitHub in your browser rather than by checking out the branch. The malicious part is often hidden far off to the right of an ordinary-looking line, so scroll sideways through each file.

@AgentX010: this pull request adds or changes these files, possibly without your knowledge. Malware like this spreads by adding itself to repositories on machines it has infected, so your machine might be compromised. Please undo these changes in this pull request, and don't open or run other projects on that machine until you've checked it.

Flagged files at commit 4745f1c:

Only merge once you're confident these files are safe.

ℹ️ Posted automatically by Drips Wave. Questions? Contact support@drips.network.

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.

Nothing fails when a query forgets the network predicate

1 participant