Search docs

Docs search
Back to Rule Catalog
AP-DQR-002Data & Query Risk

Broad SELECT * usage in query path

Flags broad SELECT * usage in paths where explicit projection is safer.

warningviolationNo auto-fix

How to fix

  1. Replace SELECT * with explicit columns.
  2. Keep sensitive columns out of read models unless required.
  3. Update tests or snapshots that assumed the broad result shape.

What it means

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.

Example bad pattern

SELECT * FROM account_summary

Example good pattern

SELECT account_id, balance_cents, status FROM account_summary

Related files/config

  • apps/api/src
  • db/sql

Related CLI commands

  • archpilot validate
  • archpilot validate --ci
AP-DQR-002 - Broad SELECT * usage in query path | ArchPilot Docs