Security & Protocol Hardening (16 Fixes + Adversarial Regression Tests)
Wire Protocol & Extended Query Hardening
- Block Legacy Fast-Path
FunctionCall ('F'): Closes wire-protocol bypass that could invoke server OID functions (pg_read_file, lo_export) without SQL AST inspection (SQLSTATE 0A000).
- Fix Pipelined Extended Query Multi-Statement Bypass: Evaluates every
Parse and Bind frame in a pipeline batch so a blocked statement can never hide behind a trailing SELECT 1.
- AST Column Alias Provenance:
SELECT full_name AS display_name now inherits explicit column_rules masking on both Wire Proxy and native MCP.
- Fix Multi-Frame Flush Relay &
hitl_mode: reject: Accurately relays all response frames on Flush-only batches and marks reject-mode HITL entries DENIED immediately.
PostgreSQL 17 AST Firewall & Side-Channel Oracle Guard
- Expanded Side-Channel Coverage: Blocks projection
LIKE/ILIKE/>/~ probes, COUNT(*) FILTER (WHERE tckn ...), ROW_NUMBER() OVER (ORDER BY tckn), DISTINCT ON (tckn), tckn::bytea hex exfiltration, and EXPLAIN SELECT ... WHERE tckn = ....
- Expanded Dangerous Functions & Catalogs: Walks
VALUES (...), PREPARE, MERGE, CALL, SELECT INTO; blocks table_to_xml, set_config, SET row_security = off, pg_stats (raw planner PII samples), and pg_stat_activity.
- Expanded Tautology Detection: Catches
2 > 1, 1 <> 2, id = id, NOT (1 = 2), and 1 IN (1, 2).
PII Engine, Control Plane API, MCP & Audit Worker
- Standalone AWS Key Fast-Path Fix: Uppercase-heavy AWS keys with <4 digits (
AKIAIOSFODNN7EXAMPLE) are never skipped; added Stripe (sk_live_) and Slack (xoxb-) detectors; UTF-8 rune-safe masking for non-ASCII emails.
- Control Plane Secret Redaction & Auth:
GET /api/v1/policies redacts passwords/keys/webhooks with __PGVEIL_REDACTED__ while preserving existing secrets across Policy Studio hot-reloads; added optional PGVEIL_ADMIN_TOKEN Bearer auth.
- MCP Hardening: Enforces
denied_tables/allowed_tables on schema-qualified describe_table("public.api_secrets"), blocks EXPLAIN ANALYZE in explain_query, and URL-encodes upstream credentials with UpstreamTLS support.
- Discovery & Audit Worker Reliability: Deterministic multi-entity strategy selection, 5s per-column timeouts, bounded rate-limiter fingerprint maps, and graceful
SIGTERM final-batch flush with a fresh context.
Install / Upgrade
brew update && brew upgrade pgveil
# or fresh install:
brew install duhanguler/tap/pgveil