codex deleted my database
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Title: Critical safety failure: Codex ran destructive test setup against production database
Severity: Critical - production data loss
Summary:
Codex executed a test file from a production deployment directory. The test setup invoked
Base.metadata.drop_all(engine). Because the environment loaded the production database
configuration, the command connected to the production PostgreSQL instance and dropped
and recreated tables.
Expected behavior:
Codex must not run tests with destructive database setup against a production-configured
environment. It should detect production connection settings and refuse, require explicit
confirmation, or enforce an isolated temporary test database.
Actual behavior:
The destructive test was run without such protection, causing production tables to be
emptied/recreated.
Reproduction condition:
A test fixture uses SQLAlchemy Base.metadata.drop_all(engine), and the process inherits
a deployment .env containing production database settings.
Impact:
Production service data became unavailable. Services were stopped immediately and data
recovery is in progress.
Requested remediation:
- Guardrails preventing destructive test commands when production database settings are detected.
- Explicit approval before executing schema-drop operations outside isolated test environments.
- Clearer command-level warning showing the resolved database target before destructive actions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the test file and fixture that invoke Base.metadata.drop_all(engine), then inspect how the deployment .env supplies the database configuration. Reproduce only against an isolated temporary database and trace how the resolved PostgreSQL target reaches the test command. Done means destructive setup is blocked or explicitly approved for production-configured environments, with a clear target warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust, sqlalchemy
- Domain
- databases, devtools, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100