How to Configure Snowflake Policy Management

Published
Length
3 min read

Luis Felipe Dias

All posts

Good snowflake policy management controls which roles can read or change your cloud data. You set it up by linking rules to tables, columns, and network paths. Data teams need clear boundaries to keep sensitive records safe during daily work. Without good rules, one broad role can read every row in a warehouse by default. Setting up native rules lets you limit what each person or app can do. How snowflake policy management works for roles and data In Snowflake, a policy is an object that hol

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Good snowflake policy management controls which roles can read or change your cloud data. You set it up by linking rules to tables, columns, and network paths.

Data teams need clear boundaries to keep sensitive records safe during daily work. Without good rules, one broad role can read every row in a warehouse by default. Setting up native rules lets you limit what each person or app can do.

How snowflake policy management works for roles and data

In Snowflake, a policy is an object that holds a specific rule. You build the rule once and attach it to many tables or views. This saves time because you do not write the same check twice.

These rules apply to human users, service accounts, and reporting apps. When a session runs a query, the warehouse checks the active role first. Then the engine runs the attached rule before returning any rows or columns.

Four main rule types handle most data security needs inside the warehouse. Network rules check the IP address of the person or app logging in. Session rules set idle timeouts and control how long a login stays active.

Row rules filter which specific records a role can read in a table. Masking rules rewrite matched fields in results, like emails or card numbers. If a role lacks permissions, the query returns masked text for phone numbers.

Safe defaults start with denying broad permissions to new roles by default. Give a central security role the power to create and attach all rules. Do not let standard database owners drop or change rules on their own tables.

Assigning and testing rules across your data warehouse

Start by mapping which columns hold sensitive items like national IDs or emails. Tagging these columns helps you attach one masking rule across many schemas at once. When a new table gets that tag, the masking rule applies right away.

Application-to-Application Password Management + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Always test new rules in a sandbox account with sample data first. Log in using a test role with low permissions and run a select query. Check that the output hides restricted rows and rewrites sensitive columns as expected.

Next, switch to a higher role that should see the clear values. Run the exact same query and confirm the raw values appear in the results. Testing both paths stops you from breaking dashboards or scheduled data jobs.

Auditing rules and handling active session gaps

You should check which rules are active across your warehouse every week. Built-in usage views show every rule and the tables where it is attached. Security teams can query these views to find tables missing required tags.

Query history logs also show which roles ran queries against protected tables. Reviewing these logs helps you spot service accounts that ask for too much data. You can then tighten permissions or split one broad role into smaller ones.

Still, static warehouse rules have clear limits once a session is active. Native rules only apply inside the cloud warehouse you configure them on. If your team also uses Postgres or MySQL, you must rebuild rules from scratch.

Static role checks also cannot ask a manager to approve a single risky query. Once a user logs in with a high role, every query runs right away. Also, shared service roles often hide which specific engineer ran an ad-hoc update.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What happens when two rules apply to the same table?

The warehouse evaluates both the row rule and the column rule during the query. It filters the permitted rows first and then rewrites any matched columns.

Can a table owner remove a masking rule from a column?

A table owner cannot remove a rule unless their role holds permission to unset rules. Keep rule permissions in a separate security role to prevent unauthorized changes.

Do masking rules change the data stored on disk?

No, masking rules only rewrite matched fields in results when a query runs. The raw values stay unchanged on disk for authorized roles to read.

The query runs. The emails stay hidden.