An external stage or integration was created in Snowflake: what to check

VERICTO-092 Critical In CI (offline CLI): BLOCKED

CREATE STAGE ext_stage URL = 's3://example-bucket/exports/'; connects the account to an external bucket. Nothing is lost yet, but any role that can use the stage can now unload data to that location. Storage, API and external access integrations, external functions and egress network rules open similar paths out. If it was not part of a reviewed change, find out who created it and whether it was used.

How to recover the data

  • If the stage or integration was not expected, drop it (DROP STAGE ext_stage;) or revoke USAGE on it from every role.
  • If the statement had inline CREDENTIALS, rotate those cloud keys: they are now in the query history.
  • Check SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY for unloads to the stage, and the bucket itself for files written there.

Why it happens

Stages and integrations are set up while building a pipeline, often with whatever role is at hand and, for speed, with keys pasted into the statement. A role that can create them can connect the account to storage or endpoints nobody reviewed.

How to fix it

Create stages and integrations through infrastructure-as-code, using a storage integration instead of inline credentials, and grant USAGE only to the roles that need it. Snowflake can enforce this with account parameters such as REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION, and egress from code is limited to the hosts listed in network rules attached to an external access integration.

How to stop it from happening again

VERICTO-092 · External stage or integration (Snowflake) · Severity: Critical · AST node: CreateStageStmt > external location (URL / CREDENTIALS)

The statement the rule reports

-- stage.sql
CREATE STAGE ext_stage URL = 's3://example-bucket/exports/';

Real CLI output

$ npx @vericto/vericto-cli@2.3.0 check --offline --dialect snowflake stage.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.
✖ stage.sql  BLOCKED  VERICTO-092 critical
    CreateStageStmt > external location (URL / CREDENTIALS)
    fix: Create stages and integrations through infrastructure-as-code, never with inline credentials
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))
  ✖ stage.sql  BLOCKED  VERICTO-092 critical
      CreateStageStmt > external location (URL / CREDENTIALS)
      fix: Create stages and integrations through infrastructure-as-code, never with inline credentials

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-092] <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