Skip to content

v3.0.0 - Secure Code Mode, Auth Scopes & Audit Subsystem#103

Merged
neverinfamous merged 782 commits intomainfrom
release/v3.0.0
Apr 5, 2026
Merged

v3.0.0 - Secure Code Mode, Auth Scopes & Audit Subsystem#103
neverinfamous merged 782 commits intomainfrom
release/v3.0.0

Conversation

@neverinfamous
Copy link
Copy Markdown
Owner

v3.0.0 - Secure Code Mode, Auth Scopes & Audit Subsystem

⚠️ Breaking Changes

  • OAuth Scope Requirements: Core write tools now require the write OAuth scope; destructive tools require admin. Clients using HTTP/OAuth transport must update their scope configurations.

Highlights

  • 🔒 Auth Module: Transport-agnostic auth with SCOPE_PATTERNS, BASE_SCOPES, and RFC 6750 enforcement across all tool groups.
  • 🏗️ Worker-Thread Code Mode: True V8 isolate sandbox with resource limits, RPC bridge, and configurable timeouts.
  • 📋 Audit Subsystem: Session token estimation, JSONL logging with rotation, redaction, pre-mutation DDL snapshots, and dedicated pg_audit_* tools.
  • 📉 30–41% Payload Reduction: Reduced default row limits (10–20), capped max limits (50–100), and eliminated null/empty sections across all major tool groups.
  • 🛡️ Security Hardening: Replaced raw exceptions with PostgresMcpError, SLSA Build L3 via --provenance, Docker vulnerability patches, and secrets scanning on push.

Added

  • Worker-thread Code Mode sandbox with resource limits, RPC bridge, and configurable timeouts.
  • Transport-agnostic Auth module supporting SCOPE_PATTERNS, BASE_SCOPES, and RFC 6750.
  • Audit subsystem with session token estimates, JSONL logging, redaction, and pg_audit_* tools.
  • 13 new statistics and admin tools (including pg_stats_outliers, pg_append_insight, and pg_jsonb_pretty).
  • 22 group-specific help resources accessible via postgres://help.
  • Playwright E2E test coverage for Code Mode, authentication, and backups.
  • Parameter extensions and aliases for core tools (e.g., toType, indexName).
  • Agent-optimized documentation and Code Mode integration guides.

Changed

  • BREAKING: Core write tools require write scope; destructive tools require admin.
  • Modularized source files using strict kebab-case convention.
  • Optimized payload sizes (~30–41% reduction) by reducing default limits, capping max limits, and omitting null/empty sections across Performance, Stats, Monitoring, and Introspection tools.
  • Configurable safety limits (default 100, max 500) for pg_schema_snapshot and pg_dependency_graph.
  • Applied openWorldHint: false to all tools.
  • Centralized default connection pool timeout to 30,000ms.
  • Switched to SWC compilation for Vitest and reduced npm package size by excluding test/source map artifacts.

Removed

  • Obsolete META_GROUPS shortcut bundles.
  • Unused hono router dependency.
  • Duplicate validation logic across performance handlers.

Fixed

  • Corrected the static totalResources count reported by postgres://capabilities to 23.
  • Standardized P154 error structures and double-quote formatting across all 230+ tools.
  • Resolved Split Schema Pattern violations across Search, JSONB, Vector, Stats, Performance, and Admin groups.
  • Improved reliability for Performance tools (pg_stat_statements, pg_diagnose_database_performance, pg_cache_hit_ratio).
  • Implemented strict numeric type coercion (coerceNumber) and Zod validation for performance tools.
  • Partitioning tools: Fixed membership checks, added ifNotExists parameters, and implemented pagination limits.
  • Transaction tools: Fixed isolation_level alias mapping and improved transaction error hints.
  • Improved resilience in Admin and Monitoring tools when handling missing tables or extensions.
  • Bypassed Docker Hub rate-limit blocks in CI using authenticated pulls.
  • Resolved logic regressions in cascade simulators, progress logging, and snake_case alias parsing.

Security

  • Patched prototype pollution vulnerabilities in hono.
  • Replaced raw exceptions with PostgresMcpError to prevent SQL syntax leaks.
  • Enforced SLSA Build L3 compliance via --provenance in publishing workflows.
  • Patched vulnerabilities in Docker builds.
  • Added push trigger to secrets-scanning.yml for early leak detection on feature branches.
  • Cleaned .trivyignore to contain only CVE IDs (removed inert path entries).

Full Compare

Install

npm install -g @neverinfamous/postgres-mcp@3.0.0

Docker

docker pull writenotenow/postgres-mcp:v3.0.0
# or
docker pull writenotenow/postgres-mcp:latest

Chris & Mike added 30 commits April 2, 2026 06:44
…pping

This commit officially certifies the Vector tool group.

Changes:
- Added VectorCreateExtensionSchemaBase and mapped schema property.
- Fixed pg_vector_create_index method alias fallthrough natively intercepting Zod requirements.
- Standardized textQuery schema mapping to include query alias in hybridSearch.
Removes redundant unreleased entries maintained in UNRELEASED.md, fixes non-standard categories (e.g. Performance -> Changed), and enforces consistent header ordering throughout the file.
Synchronized jsonb, vector, citext, monitoring, admin and gotchas instructions with UNRELEASED.md.
Chris & Mike added 17 commits April 4, 2026 19:57
…dards

- Added configurable 'limit' parameters (default 100, max 500) to pg_schema_snapshot and pg_dependency_graph.
- Implemented truncation hints for large schemas to prevent context window exhaustion.
- Fixed performance monitoring lint errors for redundant string conversions.
- Normalized performance index-analysis tools to P507 resiliency standards (coerceNumber).
- Updated performance test expectations to align with resilient parameter validation.
- Regenerated server instructions bundle and updated UNRELEASED.md.
Copilot AI review requested due to automatic review settings April 5, 2026 03:25

This comment was marked as resolved.

Copy link
Copy Markdown

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

- logger.ts: eliminate TOCTOU race — open() first, then stat() on guaranteed-existing file
- backup-manager.ts: atomic write-then-rename (tmp → final) for snapshot files
- backup-manager.test.ts: use mkdtemp() instead of path.join(tmpdir(), ...) construction
- audit-logger.test.ts: use mkdtemp() instead of path.join(tmpdir(), ...) construction
- security.ts: CORS credentials only sent for specific allowlist matches, never wildcard
- fixtures.ts: sanitize POSTGRES_PASSWORD env var before shell interpolation
- capabilities.ts: correct totalResources from 23 to 21 (matches getPostgresResources())
- .prettierignore: fix generated file path to kebab-case
- Remove unused imports across 7 test files (CodeQL Note findings)
@neverinfamous neverinfamous reopened this Apr 5, 2026
…tion-for-credentials

Split setCorsHeaders into two explicit paths:
- CREDENTIAL PATH: only exact allowlist matches accepted; Access-Control-Allow-Origin
  is set to �llowlistedOrigin (sourced from config array, not req.headers.origin),
  severing the user-input → header taint chain CodeQL tracks
- NO-CREDENTIAL PATH: wildcards/subdomain patterns permitted; no ACAC header emitted
- e2e.yml: remove pull_request trigger; keep workflow_dispatch + workflow_call for manual use
- gatekeeper.yml: remove e2e from publish needs/condition

E2E infrastructure issues (Docker exec fixtures) will be resolved in v3.0.1 patch.
@neverinfamous neverinfamous merged commit 9749ac6 into main Apr 5, 2026
10 checks passed
@neverinfamous neverinfamous deleted the release/v3.0.0 branch April 5, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants