feat(forward): apply DDL/migration to a database — SECURITY REVIEW REQUIRED#458
Closed
seonghobae wants to merge 1 commit into
Closed
feat(forward): apply DDL/migration to a database — SECURITY REVIEW REQUIRED#458seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
…ult)
Forward engineering (model -> DB), the missing half of the round-trip. POST /api/connections/{uuid}/apply-sql runs DDL in ONE transaction; dry_run=True (default) rolls back as a pre-flight, dry_run=False commits. Editor role, IDOR-safe (non-member 404, member-without-editor 403), SSRF-guarded via validate_postgres_dsn_target + pinned IP (apply_postgres_sql mirrors probe_postgres), DSN-redacted errors, ok=false on failure. PostgreSQL only for now. +7 tests, backend suite 265. SECURITY REVIEW REQUIRED before merge (writes to a live DB).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AxU2xaupAjp912oDNFuWyd
Collaborator
Author
|
Superseded by a standalone PR against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on
adhesive-piper(PR #440). Adds P0b — Forward engineering fromdocs/valuation-gap-analysis.md: the tool was reverse-only (DB → model); this makes it possible to go model → database.This endpoint writes DDL to a live database. It is built defensively but must be reviewed:
POST /api/connections/{uuid}/apply-sql, body{ sql, dry_run=true }.dry_run=falseto persist.apply_postgres_sqlreusesvalidate_postgres_dsn_targetand connects to the pinned IP, exactly like introspection.ok=false, not an error status.Open questions for review
Verification
backend
pytest265 passed (+7: IDOR/editor gates, dry-run success/failure, dialect dispatch, DSN redaction); mypy clean.Next: down-migration generation, framework-formatted migrations, and a guarded deploy UX (explicit confirm + dry-run preview) — as separate PRs.
🤖 Generated with Claude Code