COPY INTO @my_stage/users/ FROM users; writes the whole users table as files in a stage. From there, GET downloads them to any client, and an unload to 's3://...', 'azure://...' or 'gcs://...' writes them straight to external storage. Nothing in the table changes, but the data now exists outside it. If you did not expect it, find the files and who ran it.
How to recover the data
- List what was written and remove it:
LIST @my_stage/users/;thenREMOVE @my_stage/users/; - Find who ran the unload and any
GETon that stage inSNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY(user, role, time, query text). - If files were downloaded or written to external storage, handle it as a data exposure: they can no longer be deleted from Snowflake.
Why it happens
Unloads are the normal way to export from Snowflake, so roles used by pipelines, notebooks and agents often have write access to some stage. Any such role can then unload any table it can read, and a query generated to "export the data" will do exactly that.
How to fix it
Return rows to the client with a bounded SELECT, and keep unloads in a reviewed pipeline with its own role. Do not grant stage READ/WRITE to roles used by applications or agents. Snowflake also has account parameters to narrow unloads, such as PREVENT_UNLOAD_TO_INLINE_URL (no unload to a URL written in the statement) and PREVENT_UNLOAD_TO_INTERNAL_STAGES.
How to stop it from happening again
VERICTO-091 · Stage unload or file transfer (Snowflake) · Severity: Critical · AST node: CopyIntoStmt > INTO @my_stage/users/ (unload of users)
The statement the rule reports
-- unload.sql
COPY INTO @my_stage/users/ FROM users;
Real CLI output
$ npx @vericto/vericto-cli@2.3.0 check --offline --dialect snowflake unload.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.
✖ unload.sql BLOCKED VERICTO-091 critical
CopyIntoStmt > INTO @my_stage/users/ (unload of users)
fix: Return rows to the client with a bounded SELECT; unload and file transfer belong in a reviewed pipeline
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))
✖ unload.sql BLOCKED VERICTO-091 critical
CopyIntoStmt > INTO @my_stage/users/ (unload of users)
fix: Return rows to the client with a bounded SELECT; unload and file transfer belong in a reviewed pipeline
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-091] <reason> (a reason is required)
The CLI blocks it and exits with code 1, so the CI job fails before the merge.
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 snowflake 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: snowflake }
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
Related rules
- VERICTO-092: External stage or integration (Snowflake)
- VERICTO-093: Share to another account (Snowflake)
- VERICTO-097: Role switch (Snowflake)