CLI Cortex Framework apply security

uv run cortex-apply-security validates required target BigQuery and Data Catalog APIs and policy tags, patches column-level policyTags onto materialized BigQuery table schemas, and drops stale or disabled row access policies managed by Google Cloud Cortex Framework after Dataform workflow runs. The command works the same way for both type: dataform and type: git deployment workflows.

Synopsis

uv run cortex-apply-security [-h] \
    [-c CONFIG_PATH | --config CONFIG_PATH] \
    [--enable-apis] [--disable-telemetry] \
    [--dry-run]

Replace the following:

  • CONFIG_PATH: path to your global config.yaml file, for example: config/config.yaml.

Pre-flight and reconciliation behavior

When you run uv run cortex-apply-security, the tool performs the following steps for both type: dataform and type: git deployment targets:

  1. Loads and resolves config.yaml. If the data.security block is omitted entirely, the tool logs an informational message and exits with status 0 without modifying BigQuery, leaving any previously applied column policyTags and row access policies (including cortex_pipeline_sa_bypass) attached. To tear down security workspace-wide, keep data.security with enabled: false until reconciliation completes.
  2. Validates bigquery.googleapis.com on foundation and data product target dataset projects (including when data.security.enabled is false), while skipping dataform.googleapis.com and external BigLake Delta Sharing catalog project APIs (bigqueryreservation.googleapis.com, cloudresourcemanager.googleapis.com, and catalog bigquery.googleapis.com). When data.security.enabled is true and column policy tags are configured, the tool also validates datacatalog.googleapis.com on policy tag taxonomy projects and column-level security target projects, and verifies that every referenced policy tag exists, matches data.bigQueryLocation, and belongs to a taxonomy with Enforce access control (FINE_GRAINED_ACCESS_CONTROL) enabled.
  3. Reconciles TableFieldSchema.policyTags (tables.patch) and stale or disabled Cortex Framework row access policies (rowAccessPolicies.list) across enabled materialized foundation and data product tables. When data.security.enabled is false, reconciliation clears Cortex Framework-managed column policyTags and drops Cortex Framework-managed row access policies. If governed tables haven't been materialized by Dataform yet, the tool reconciles existing tables and logs a warning listing the unmaterialized tables.

Global flags

The following table describes all flags supported by uv run cortex-apply-security:

Flag Description Default
-h, --help Show the command help message and exit. None
-c, --config CONFIG_PATH Path to the global config.yaml configuration file. config/config.yaml
--enable-apis Enable missing required Google Cloud APIs (bigquery.googleapis.com and datacatalog.googleapis.com) automatically without interactive prompts. Can't be combined with --dry-run. false
--dry-run Run read-only pre-flight checks and log planned BigQuery column policy tag updates and row access policy drops ([DRY-RUN]) without modifying Google Cloud resources. Can't be combined with --enable-apis. false
--disable-telemetry Disable telemetry event logging and suppress the startup telemetry consent notice during execution (cortex-apply-security runs don't send telemetry requests). For details, see Cortex Framework telemetry. false

Examples

Preview planned column policy tag and row access policy changes without modifying BigQuery:

export CORTEX_CONFIG_FILE=config/config.yaml

uv run cortex-apply-security --config $CORTEX_CONFIG_FILE --dry-run

Apply column policy tags and clean up stale row access policies after a Dataform workflow run completes:

export CORTEX_CONFIG_FILE=config/config.yaml

uv run cortex-apply-security --config $CORTEX_CONFIG_FILE

What's next