Skip to content

Releases: will2469/argus

Release list

Argus v1.0.0

Choose a tag to compare

@github-actions github-actions released this 29 Aug 20:32

Argus v1.0.0 — Production-Grade Go & PostgreSQL 18 Static Analyzer

We are proud to announce the first official public release of Argus (v1.0.0)!

Argus is an advanced compile-time static analyzer and pre-commit database safety linter for Go applications and PostgreSQL migrations. Built on top of the official Go analysis framework (go/analysis) and PostgreSQL's native C query parser (libpg_query via pg_query_go), Argus bridges the gap between Go application code and PostgreSQL engine internals.


📦 Quick Installation

Linux & macOS (One-Line Installer)

curl -fsSL https://raw.githubusercontent.com/will2469/argus/main/install.sh | bash

Windows (PowerShell)

irm https://raw.githubusercontent.com/will2469/argus/main/install.ps1 | iex

Go Toolchain

go install github.com/will2469/argus/cmd/argus@latest

🛡️ 30 Production-Grade Database Invariants

Every rule is thoroughly documented in the official Argus Wiki. Click on any rule below to open its dedicated specification, failure modes, and code fix examples:

🔒 Security & Data Integrity

  • ARGUS-A01UNSAFE_SQL_CONCATENATION: Forbids raw string concatenation in queries; mandates $1, $2 bind parameters.
  • ARGUS-A05AUDIT_LOG_IMMUTABILITY: Enforces append-only immutable audit logs (prohibits UPDATE, DELETE, TRUNCATE, MERGE).
  • ARGUS-A06RUNTIME_DDL: Blocks DDL execution in application runtime code; runtime roles must be DML-only.
  • ARGUS-A07ERROR_LEAK: Prevents leaking raw internal database error strings or PII to external clients.
  • ARGUS-A15FORBIDDEN_DDL_APP_ROLE_GRANT: Blocks runtime application roles from receiving DDL privileges or table ownership.
  • ARGUS-A18MISSING_ROWS_ERR_CHECK: Mandates rows.Err() check after rows.Next() loops to catch silent network truncations.
  • ARGUS-A24TENANT_ISOLATION_LEAK: Mandates explicit tenant isolation filter checks on multi-tenant tables.
  • ARGUS-A26LIKE_WILDCARD_INJECTION: Enforces explicit escaping of SQL wildcards (%, _, \) in LIKE queries.

⚡ Resource & Connection Pool Lifecycle

  • ARGUS-A02MISSING_DEFER_CLOSE: Mandates defer rows.Close() immediately after query execution to prevent pool leaks.
  • ARGUS-A03UNBOUNDED_CONTEXT: Prohibits raw context.Background() or context.TODO() in query calls.
  • ARGUS-A08TX_EXTERNAL_IO: Forbids blocking network/disk I/O (HTTP, gRPC, disk) inside active database transactions.
  • ARGUS-A12TIMEOUT_CONFIG: Mandates 4-tier timeout settings (statement_timeout, lock_timeout, idle timeouts).
  • ARGUS-A16MAX_CONNS_CONFIG: Enforces mathematically bounded MaxConns on connection pools to prevent process thrashing.
  • ARGUS-A23TRANSACTION_TIMEOUT_CONFIG: Enforces transaction_timeout cap on connection pools to prevent XID horizon freezing.
  • ARGUS-A25EXPENSIVE_CPU_IN_TRANSACTION: Prohibits CPU-heavy tasks (bcrypt, argon2, RSA keygen) inside transactions.

🚀 Performance & Concurrency

  • ARGUS-A04UNSAFE_ORDER_BY: Dynamic ORDER BY / GROUP BY must be validated against compile-time static allowlists.
  • ARGUS-A09ADVISORY_LOCK: Mandates transaction-level advisory locks; forbids session locks in pooled connections.
  • ARGUS-A10ISOLATION_LEVEL: Critical financial/inventory mutations must declare explicit Serializable or FOR UPDATE.
  • ARGUS-A14FORBIDDEN_SELECT_STAR: Prohibits wildcard SELECT *; mandates explicit column projection to avoid TOAST bloat.
  • ARGUS-A17FORBIDDEN_QUERY_IN_LOOP: Eliminates N+1 query patterns inside loops in favor of WHERE id = ANY($1) or pgx.Batch.
  • ARGUS-A19UNBOUNDED_QUERY_LIMIT: Queries on high-cardinality tables must have an explicit LIMIT or keyset pagination.
  • ARGUS-A20PARAM_LIMIT_65535: Prevents exceeding PostgreSQL's 65,535 wire parameter ceiling; recommends pgx.CopyFrom.
  • ARGUS-A21UNBOUNDED_ROW_LOCK_BLOCKING: Queue queries (SELECT ... FOR UPDATE) must use SKIP LOCKED or NOWAIT.
  • ARGUS-A22SERIALIZATION_FAILURE_RETRY: Serializable transactions must be wrapped in automated retry loops catching SQLSTATE 40001.

🔄 Zero-Downtime Migration Hygiene

  • ARGUS-A11DESTRUCTIVE_MIGRATION: Prohibits destructive DDL (DROP COLUMN, RENAME) in single releases without expand-contract.
  • ARGUS-A13MISSING_DOWN_MIGRATION: Every .up.sql migration must have a non-empty, deterministic symmetric .down.sql.
  • ARGUS-A27NON_CONCURRENT_INDEX_CREATION: Indexes on existing tables must use CREATE INDEX CONCURRENTLY to avoid write lockouts.
  • ARGUS-A28TABLE_LOCKING_CONSTRAINT_ADDITION: FK and CHECK constraints must use 2-phase NOT VALID followed by VALIDATE CONSTRAINT.
  • ARGUS-A29UNINDEXED_FOREIGN_KEY: Every foreign key on child tables must have a supporting B-tree index (anti-table scan).
  • ARGUS-A30TIMESTAMP_WITHOUT_TIMEZONE: Prohibits bare TIMESTAMP; mandates TIMESTAMPTZ (UTC-normalized) for temporal determinism.

💻 Basic Usage

# 1. Run static analysis across Go codebase and SQL migrations
argus --dirs=. --migrations=migrations

# 2. Generate comprehensive markdown audit report
argus --output=argus-report.md

# 3. Integrate directly with go vet
go vet -vettool=$(which argus) ./...

What's Changed

  • build(deps): bump actions/checkout from 4 to 7 by @dependabot[bot] in #1
  • build(deps): bump actions/setup-go from 5 to 7 by @dependabot[bot] in #2

New Contributors

Full Changelog: https://github.com/will2469/argus/commits/v1.0.0