Skip to content

feat: run scripts on any PostgreSQL, and external databases - #3

Merged
CalebSargeant merged 2 commits into
mainfrom
feat/scripts/external-postgres
Oct 28, 2026
Merged

CalebSargeant merged 2 commits into
mainfrom
feat/scripts/external-postgres

Conversation

@CalebSargeant

Copy link
Copy Markdown
Contributor
  • Adds "Run a script": SQL as the database's owner in one transaction, either checked (run, then rolled back, with the output shown) or run (committed, optionally after a snapshot). A lock it can't get within 15s fails the script.
  • Refuses scripts that open or end their own transaction or hold psql backslash commands, naming the line, before any Job exists (sql.py).
  • Adds external databases: any PostgreSQL the catalog names (host, port, login, password Secret, TLS mode, CA). They get snapshots and scripts but no restores; the admission policy pins each one's host, port, TLS mode and Secret.
  • Production scripts wait for a second person with admin, who reads the exact script the Job holds. Their output shows statement tags and errors, never rows.
  • Unit tests for the guard, catalog, API and runner. The e2e now runs a plain PostgreSQL with its own CA and walks check, run, failure, lock timeout and production approval.

App teams need to run their manual migration scripts without a platform engineer at a psql prompt, and their databases are not all CloudNativePG ones. A script runs as the owner in one transaction, checked (rolled back) or run (committed, after a snapshot if asked); production waits for a second person who reads it.
@brimyr

brimyr Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Brimyr: Quality Assurance

Mode: pr · Gate: pass · Ecosystem: Python

Metric Value
Patch coverage 97.3%
Covered / changed executable lines 536 / 551
Total coverage (measured files) 95.7%
Covered / executable lines across 23 file(s) 2852 / 2981
Threshold 80.0%

✅ Patch coverage 97.3% meets the 80.0% threshold.

@chargate

chargate Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Chargate: Security Assurance

Mode: pr · Gate: ✅ pass

Net-new Pre-existing Suppressed Total in full SARIF
0 0 1 1

✅ No net-new findings introduced by this change.

Uploaded: SARIF in DefectDojo

Pre-existing findings never block; in-source suppressions (accepted risks) and secret false positives are reported but never gate. The full, unfiltered SARIF ships to the Security tab or as an artifact.

Comment thread src/databases_ui/catalog.py Resolved
Comment thread tests/e2e/run.py Resolved
@CalebSargeant
CalebSargeant merged commit 42826f5 into main Oct 28, 2026
11 checks passed
@CalebSargeant
CalebSargeant deleted the feat/scripts/external-postgres branch October 28, 2026 16:06
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.

1 participant