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 | bashWindows (PowerShell)
irm https://raw.githubusercontent.com/will2469/argus/main/install.ps1 | iexGo 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-A01— UNSAFE_SQL_CONCATENATION: Forbids raw string concatenation in queries; mandates$1, $2bind parameters.ARGUS-A05— AUDIT_LOG_IMMUTABILITY: Enforces append-only immutable audit logs (prohibitsUPDATE,DELETE,TRUNCATE,MERGE).ARGUS-A06— RUNTIME_DDL: Blocks DDL execution in application runtime code; runtime roles must be DML-only.ARGUS-A07— ERROR_LEAK: Prevents leaking raw internal database error strings or PII to external clients.ARGUS-A15— FORBIDDEN_DDL_APP_ROLE_GRANT: Blocks runtime application roles from receiving DDL privileges or table ownership.ARGUS-A18— MISSING_ROWS_ERR_CHECK: Mandatesrows.Err()check afterrows.Next()loops to catch silent network truncations.ARGUS-A24— TENANT_ISOLATION_LEAK: Mandates explicit tenant isolation filter checks on multi-tenant tables.ARGUS-A26— LIKE_WILDCARD_INJECTION: Enforces explicit escaping of SQL wildcards (%,_,\) in LIKE queries.
⚡ Resource & Connection Pool Lifecycle
ARGUS-A02— MISSING_DEFER_CLOSE: Mandatesdefer rows.Close()immediately after query execution to prevent pool leaks.ARGUS-A03— UNBOUNDED_CONTEXT: Prohibits rawcontext.Background()orcontext.TODO()in query calls.ARGUS-A08— TX_EXTERNAL_IO: Forbids blocking network/disk I/O (HTTP, gRPC, disk) inside active database transactions.ARGUS-A12— TIMEOUT_CONFIG: Mandates 4-tier timeout settings (statement_timeout,lock_timeout, idle timeouts).ARGUS-A16— MAX_CONNS_CONFIG: Enforces mathematically boundedMaxConnson connection pools to prevent process thrashing.ARGUS-A23— TRANSACTION_TIMEOUT_CONFIG: Enforcestransaction_timeoutcap on connection pools to prevent XID horizon freezing.ARGUS-A25— EXPENSIVE_CPU_IN_TRANSACTION: Prohibits CPU-heavy tasks (bcrypt,argon2, RSA keygen) inside transactions.
🚀 Performance & Concurrency
ARGUS-A04— UNSAFE_ORDER_BY: DynamicORDER BY/GROUP BYmust be validated against compile-time static allowlists.ARGUS-A09— ADVISORY_LOCK: Mandates transaction-level advisory locks; forbids session locks in pooled connections.ARGUS-A10— ISOLATION_LEVEL: Critical financial/inventory mutations must declare explicitSerializableorFOR UPDATE.ARGUS-A14— FORBIDDEN_SELECT_STAR: Prohibits wildcardSELECT *; mandates explicit column projection to avoid TOAST bloat.ARGUS-A17— FORBIDDEN_QUERY_IN_LOOP: Eliminates N+1 query patterns inside loops in favor ofWHERE id = ANY($1)orpgx.Batch.ARGUS-A19— UNBOUNDED_QUERY_LIMIT: Queries on high-cardinality tables must have an explicitLIMITor keyset pagination.ARGUS-A20— PARAM_LIMIT_65535: Prevents exceeding PostgreSQL's 65,535 wire parameter ceiling; recommendspgx.CopyFrom.ARGUS-A21— UNBOUNDED_ROW_LOCK_BLOCKING: Queue queries (SELECT ... FOR UPDATE) must useSKIP LOCKEDorNOWAIT.ARGUS-A22— SERIALIZATION_FAILURE_RETRY:Serializabletransactions must be wrapped in automated retry loops catching SQLSTATE40001.
🔄 Zero-Downtime Migration Hygiene
ARGUS-A11— DESTRUCTIVE_MIGRATION: Prohibits destructive DDL (DROP COLUMN,RENAME) in single releases without expand-contract.ARGUS-A13— MISSING_DOWN_MIGRATION: Every.up.sqlmigration must have a non-empty, deterministic symmetric.down.sql.ARGUS-A27— NON_CONCURRENT_INDEX_CREATION: Indexes on existing tables must useCREATE INDEX CONCURRENTLYto avoid write lockouts.ARGUS-A28— TABLE_LOCKING_CONSTRAINT_ADDITION: FK and CHECK constraints must use 2-phaseNOT VALIDfollowed byVALIDATE CONSTRAINT.ARGUS-A29— UNINDEXED_FOREIGN_KEY: Every foreign key on child tables must have a supporting B-tree index (anti-table scan).ARGUS-A30— TIMESTAMP_WITHOUT_TIMEZONE: Prohibits bareTIMESTAMP; mandatesTIMESTAMPTZ(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
- @dependabot[bot] made their first contribution in #1
Full Changelog: https://github.com/will2469/argus/commits/v1.0.0