Snowflake Tag Based Masking

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up snowflake tag based masking by linking a masking rule to a schema tag. Every table column that gets that tag then runs the masking rule during a query. Data teams use this method so they do not have to attach rules to columns one by one. Still, when a user logs in with a broad role, the database still returns unmasked rows. How snowflake tag based masking works In a standard setup, an admin creates a schema tag first. That tag represents a data class like sensitive contact data or

Snowflake Access Control + Data Masking (Static): the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up snowflake tag based masking by linking a masking rule to a schema tag. Every table column that gets that tag then runs the masking rule during a query. Data teams use this method so they do not have to attach rules to columns one by one. Still, when a user logs in with a broad role, the database still returns unmasked rows.

How snowflake tag based masking works

In a standard setup, an admin creates a schema tag first. That tag represents a data class like sensitive contact data or payment info. Next, the admin writes a masking rule for a specific data type, such as text or numbers. The rule checks the active role of the user running the query.

After both objects exist, the admin binds the masking rule to the tag. When an engineer applies that tag to a table, schema, or column, the rule takes effect. If a column has a matching data type, the tag rule rewrites matched fields in results. Teams use this setup to redact emails, phone numbers, card numbers, and national IDs.

If a column already has a direct masking rule, that direct rule wins over the tag rule. Tags applied to a whole table or schema also pass down to new columns with matching types. This design cuts down manual work when schemas change often.

What native tag rules solve and what they miss

Native tag rules help data teams manage column rules at scale inside one warehouse. Admins can update one tag rule and change how hundreds of columns return sensitive text. This keeps role rules inside the warehouse clean and easy to read during a review.

Yet this native setup only checks the active warehouse role during the session. It decides what a role can read on tagged columns, not what queries do in flight. If an engineer or script uses a high-privilege role to fix an issue, the rule allows raw values.

Snowflake Access Control + Data Masking (Static): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Tag rules also fail when someone forgets to tag a new table or uses semi-structured text fields. Unstructured text columns or JSON blobs might hold emails or card numbers that bypass column tags. Also, warehouse tags only work inside that single platform and do not cover other databases.

Managing tag policies across big data teams

To keep tag rules working well, teams must separate the admin roles that manage tags. One role should create tags, while a different security role should write the masking logic. This split stops table owners from turning off masking rules on their own data.

Teams should also audit untagged columns on a regular schedule. When a new data pipeline loads fresh tables, columns sit open until a tag job runs. Checking query logs alongside tag assignments helps teams spot gaps before broad roles pull sensitive records.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What happens when a table tag and a column tag conflict?

A tag placed on a specific column overrides a tag inherited from the table or schema. Direct masking rules placed straight on a column also override any tag-based rule.

Do tag masking rules work on mismatching data types?

No, a masking rule bound to a tag only applies to columns with the exact same data type. You can attach one rule per data type to a single tag to cover text and numbers.

Can tag rules redact sensitive fields inside raw text or JSON columns?

Column tags apply to the whole column value based on its data type and active role. They do not scan inside free-text strings to redact individual emails or phone numbers on the fly.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.