SQLite VACUUM INTO wrote a full copy of the database to a file

VERICTO-101 High In CI (offline CLI): BLOCKED

VACUUM INTO '/tmp/backup.db'; writes a complete, consistent copy of the database to /tmp/backup.db, every table and row included. Nothing in the original changes, but the copy now sits wherever the path pointed, with that directory's permissions. It is a legitimate backup method when your own job runs it; from SQL you did not write, it is a way to copy the whole database out. Plain VACUUM only rebuilds the file in place.

How to recover the data

  • Delete the copy if nothing should have it: /tmp/backup.db in this example.
  • Check who could read that path while it existed, and whether it was copied off the host.
  • Find the source of the statement and close it; if the copy left the host, handle it as a data exposure.

Why it happens

VACUUM INTO (available since SQLite 3.27.0) is ordinary SQL that writes to any path the application process can write. When an agent or user-supplied SQL reaches the database, the statement that takes a backup is the same one that exfiltrates it.

How to fix it

Take backups from code you control: the online backup API (sqlite3_backup_init() and its bindings), the sqlite3 shell's .backup, or VACUUM INTO in a scheduled job with a fixed destination. Do not let SQL from outside the application run VACUUM INTO; an authorizer callback can deny it.

How to stop it from happening again

VERICTO-101 · VACUUM INTO (SQLite) · Severity: High · AST node: VacuumStmt > INTO '/tmp/backup.db' (a full copy of the database)

The statement the rule reports

-- backup.sql
VACUUM INTO '/tmp/backup.db';

Real CLI output

$ npx @vericto/vericto-cli@2.3.0 check --offline --dialect sqlite backup.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
✖ backup.sql  BLOCKED  VERICTO-101 high
    VacuumStmt > INTO '/tmp/backup.db' (a full copy of the database)
    fix: Back up through the backup API or a reviewed job, not from SQL it receives
1 blocked · 0 allowed · 0 flagged · 0 monitored   (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))

✖ Vericto blocked 1 statement  (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
  ✖ backup.sql  BLOCKED  VERICTO-101 high
      VacuumStmt > INTO '/tmp/backup.db' (a full copy of the database)
      fix: Back up through the backup API or a reviewed job, not from SQL it receives

This is Vericto enforcing a rule — the exit code is intentional, not a crash.
To allow a finding on purpose, add an inline comment on the statement:
    -- vericto:ignore[VERICTO-101] <reason>   (a reason is required)

The CLI blocks it and exits with code 1, so the CI job fails before the merge.

The corrected version

-- backup.sql
VACUUM;
$ npx @vericto/vericto-cli@2.3.0 check --offline --dialect sqlite backup.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
0 blocked · 1 allowed · 0 flagged · 0 monitored   (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))

Try it free, no account

The CLI checks your .sql files on your machine with the 42 standard rules: no sign-up, no API key, and no SQL leaves your computer. It is open source (AGPL-3.0-only).

npx @vericto/vericto-cli@2.3.0 check --offline --dialect sqlite migrations/

On every pull request

The vericto/check-sql GitHub Action (Apache-2.0) runs the same offline check on the .sql files a PR changes and annotates the findings on the PR. Save it as .github/workflows/vericto.yml:

on: pull_request
jobs:
  vericto:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with: { fetch-depth: 0 }
      - uses: vericto/check-sql@v1
        with: { offline: true, upload-sarif: false, dialect: sqlite }

At runtime, for AI agents

The SQL an AI agent writes never goes through a PR. The Vericto TCP proxy checks each statement between the application or agent and the database, and the MCP check_sql tool lets the agent check SQL before it runs it. Both use the runtime profile, which also blocks schema changes.

The AST condition in the engine

The rule is evaluated by the dialect's classifier; its full definition is in the open source engine's README (AGPL-3.0-only), at this page's commit.

Frequently asked questions