Search docs
Docs searchValidation rule
Back to Rule CatalogAP-DQR-002Data / Query RiskBroad SELECT * usage in query path
Flags broad SELECT * usage in paths where explicit projection is safer.
warningviolationNo auto-fix
How to fix
- Replace SELECT * with explicit columns.
- Keep sensitive columns out of read models unless required.
- Update tests or snapshots that assumed the broad result shape.
What the rule validates
A query returns every column instead of declaring the data it needs.
Why it matters
Broad projection increases data exposure, payload size, and accidental coupling to schema changes.
Common causes
- Temporary debugging SQL became permanent.
- Repository methods were copied from exploratory queries.
- A query grew without revisiting its projection.
Typical violation example
SELECT * FROM account_summaryTypical compliant example
SELECT account_id, balance_cents, status FROM account_summaryRelated rules
AP-DQR-001 - Missing tenant filter evidence in multi-tenant SQLAP-DQR-003 - Unbounded query risk without limit/pagination evidenceAP-DQR-004 - Cross-module direct database access bypasses module boundaryAP-DQR-005 - N+1 query evidence in collection loop
Adjacent categories
Related files/config
apps/api/srcdb/sql
Related CLI commands
archpilot validatearchpilot validate --ci
Related docs