Skip to content
tempkey ← Back to blog

Tempkey Blog

Securing Your Data Warehouse: How to Manage Contractor Access to Snowflake

Discover actionable frameworks to provision, monitor, and revoke external contractor access to Snowflake without risking sensitive production data or failing compliance audits.

Knowing how to manage contractor access to snowflake requires enforcing strict role-based access control, ephemeral credentials, column-level masking, and automated offboarding so external contributors only touch the data required for their deliverables. Implementing structured snowflake user provisioning and automated revocation workflows eliminates orphaned credentials and safeguards analytical environments containing sensitive business intelligence.

Modern data teams frequently engage freelance data engineers, external analytics consultants, and outsourced business intelligence specialists to accelerate projects. However, granting external parties direct access to your centralized cloud data warehouse introduces acute third party data access security challenges. Without strict boundaries, temporary users can accidentally expose personally identifiable information (PII), consume unchecked computing credits, or retain access long after their engagement concludes.

---

The Hidden Vulnerabilities of External Snowflake Access

Standard software-as-a-service (SaaS) onboarding practices do not protect modern cloud data warehouses. While traditional business applications isolate users through UI-level permissions, a data warehouse exposes structured, raw datasets directly to query execution engines. When external contractors connect via SQL clients, business intelligence platforms, or Python connectors, they interact with the foundational storage layers of your business.

Three primary structural risks emerge when external workers interact with Snowflake environments:

  • Over-Privileged Functional Roles: Teams often assign contractors broad default roles such as SYSADMIN or existing analyst roles that inherit unmasked access to production tables. This violates the principle of least privilege and exposes financial metrics, customer PII, and trade secrets.
  • Orphaned Accounts and Dormant Credentials: When freelance engagements end, infrastructure teams frequently forget to disable Snowflake users, drop public key assignments, or revoke role grants. These dormant accounts remain accessible entry points.
  • Unmonitored Data Exfiltration: Unlike web applications with fixed export buttons, any user with SELECT permissions on an unmasked table can stage data, execute unload queries (COPY INTO @stage), or stream gigabytes of raw records to a local workstation.

Mitigating these threats requires treating contractor access as inherently temporary, strictly isolated, and cryptographically verified from the first query to the final revocation.

---

Designing Role-Based Access Control (RBAC) for Temporary Data Workers

According to the Snowflake Documentation on Access Control, Snowflake utilizes a hybrid model of role-based access control (RBAC) and discretionary access control to govern database object privileges. Building a robust security boundary for contractors begins with establishing a dedicated role hierarchy that decouples external workers from internal operational roles.

1. Implementing Dedicated Contractor Roles

Avoid assigning a freelancer to standard internal roles (such as INTERNAL_ANALYST or DATA_ENGINEER). Instead, build custom functional roles specifically scoped to the contractor's project scope.

-- Step 1: Create a scoped contractor role
CREATE ROLE IF NOT EXISTS contractor_marketing_analytics;

-- Step 2: Ensure proper role hierarchy under SYSADMIN
GRANT ROLE contractor_marketing_analytics TO ROLE sysadmin;

2. Restricting Virtual Warehouse Execution and Costs

External developers can inadvertently run unoptimized queries—such as Cartesian cross-joins on multi-billion-row tables—leading to runaway warehouse credit consumption. Assign contractor roles to dedicated, cost-capped virtual warehouses with aggressive auto-suspend timers.

-- Step 3: Create a constrained virtual warehouse for external workers
CREATE WAREHOUSE IF NOT EXISTS contractor_wh
  WITH WAREHOUSE_SIZE = 'XSMALL'
  AUTO_SUSPEND = 60
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE
  STATEMENT_TIMEOUT_IN_SECONDS = 1800
  COMMENT = 'Dedicated warehouse for external data contractors with 30-minute query timeout';

GRANT USAGE ON WAREHOUSE contractor_wh TO ROLE contractor_marketing_analytics;

3. Granting Granular, Scoped Schema Privileges

Apply least-privilege principles by granting access only to specific databases, schemas, and analytical views rather than raw source tables.

-- Step 4: Grant minimal database and schema usage
GRANT USAGE ON DATABASE analytics_prod TO ROLE contractor_marketing_analytics;
GRANT USAGE ON SCHEMA analytics_prod.marketing_reporting TO ROLE contractor_marketing_analytics;

-- Step 5: Grant SELECT only on specific curated views
GRANT SELECT ON ALL VIEWS IN SCHEMA analytics_prod.marketing_reporting TO ROLE contractor_marketing_analytics;
GRANT SELECT ON FUTURE VIEWS IN SCHEMA analytics_prod.marketing_reporting TO ROLE contractor_marketing_analytics;

Using granular grants prevents accidental discovery of adjacent schemas containing payroll, customer authentication, or proprietary machine learning models.

---

Network Restrictions, MFA, and Authentication Policies for Vendors

Authentication security is the first line of defense in managing contractor access. Permitting contractors to connect from arbitrary IP addresses using standard password authentication exposes your warehouse to credential stuffing and session hijacking.

Enforcing Strict Network Policies

As detailed in the Snowflake Documentation on Network Policies, network policies allow administrators to restrict account or user-level access to explicit allowlists of IP addresses. By attaching user-level network policies directly to contractor accounts, you ensure that external workers can only query Snowflake from verified corporate VPN gateways or fixed static IPs.

-- Create an isolated network policy for the contractor
CREATE NETWORK POLICY contractor_ip_policy
  ALLOWED_IP_LIST = ('203.0.113.45/32', '198.51.100.12/32')
  BLOCKED_IP_LIST = ('0.0.0.0/0')
  COMMENT = 'Restricts external vendor to verified client VPN and static home IP';

-- Attach the policy directly to the contractor user
ALTER USER contractor_jane_doe SET NETWORK_POLICY = contractor_ip_policy;

Mandatory Multi-Factor Authentication (MFA) and Key-Pair Security

Every interactive user account assigned to a third party must enforce MFA. When contractors use automated scripts, ETL tools, or IDEs (like VS Code or DataGrip), mandate key-pair authentication over basic passwords. Rotating RSA key pairs on a scheduled basis prevents credential leakage across project handoffs.

-- Configure a contractor user for key-pair authentication with strict session parameters
CREATE USER contractor_jane_doe
  PASSWORD = ''
  RSA_PUBLIC_KEY = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...'
  DEFAULT_ROLE = contractor_marketing_analytics
  DEFAULT_WAREHOUSE = contractor_wh
  MUST_CHANGE_PASSWORD = FALSE
  MINS_TO_UNLOCK = 30
  COMMENT = 'Contractor account for Q3 Marketing Optimization Project';

GRANT ROLE contractor_marketing_analytics TO USER contractor_jane_doe;

Enforcing key-pair authentication ensures that contractors cannot reuse corporate credentials across unmonitored local environments, directly strengthening your third party data access security posture.

---

Safeguarding PII: Dynamic Data Masking and Row-Level Security

Freelancers frequently need to optimize queries or build visualization models without ever needing to inspect raw customer identities, credit card numbers, or email addresses. As explained in the Snowflake Dynamic Data Masking documentation, Snowflake provides native column-level security through Dynamic Data Masking policies alongside row-level security through Row Access Policies.

1. Column-Level Dynamic Data Masking

Masking policies dynamically redact sensitive values at query execution time based on the querying user's active role. While internal data officers see real records, contractors see obfuscated tokens.

-- Define a reusable string masking policy
CREATE OR REPLACE MASKING POLICY mask_pii_string AS (val STRING) 
RETURNS STRING ->
  CASE
    WHEN CURRENT_ROLE() IN ('ACCOUNTADMIN', 'COMPLIANCE_OFFICER', 'PROD_DBA') THEN val
    WHEN CURRENT_ROLE() = 'CONTRACTOR_MARKETING_ANALYTICS' THEN REGEXP_REPLACE(val, '.*', '***MASKED_PII***')
    ELSE '***UNAUTHORIZED***'
  END;

-- Apply the masking policy to sensitive customer fields
ALTER TABLE analytics_prod.marketing_reporting.customer_conversions 
  MODIFY COLUMN email SET MASKING POLICY mask_pii_string;

ALTER TABLE analytics_prod.marketing_reporting.customer_conversions 
  MODIFY COLUMN phone_number SET MASKING POLICY mask_pii_string;

2. Row Access Policies for Regional or Tenant Isolation

If an external team is hired to analyze marketing performance exclusively in the European region, a Row Access Policy prevents their queries from scanning North American customer records.

-- Create a row-level access policy
CREATE OR REPLACE ROW ACCESS POLICY regional_contractor_policy AS (region_code STRING) 
RETURNS BOOLEAN ->
  CURRENT_ROLE() = 'ACCOUNTADMIN'
  OR (CURRENT_ROLE() = 'CONTRACTOR_MARKETING_ANALYTICS' AND region_code = 'EU');

-- Apply the policy to the dataset
ALTER TABLE analytics_prod.marketing_reporting.customer_conversions
  ADD ROW ACCESS POLICY regional_contractor_policy ON (region_code);

3. Monitoring Execution with Audit Views

Snowflake captures every warehouse query in account-level metadata views. Security teams must periodically audit contractor operations to verify that masking policies are functioning and that external queries do not perform unauthorized full-table scans.

-- Query contractor activity across the last 7 days
SELECT 
  query_id,
  user_name,
  role_name,
  warehouse_name,
  execution_status,
  total_elapsed_time / 1000 AS execution_seconds,
  query_text
FROM snowflake.account_usage.query_history
WHERE user_name ILIKE 'contractor_%'
  AND start_time >= DATEADD(day, -7, CURRENT_TIMESTAMP())
ORDER BY start_time DESC;
---

How to Manage Contractor Access to Snowflake via Automated Provisioning Workflows

Executing manual SQL scripts to create users, assign roles, and grant permissions introduces human error and operational bottlenecks. Understanding how to manage contractor access to snowflake effectively requires moving away from ad-hoc administrative intervention toward automated lifecycle provisioning.

When engineering teams rely on manual provisioning, contractors often wait days for access credentials, or administrators cut corners by reusing shared service accounts. A modern provisioning architecture decouples the approval and scheduling workflow from underlying SQL scripts.

To establish an automated access pipeline:

  1. Standardize Role Templates: Pre-configure Snowflake functional roles, network policies, and virtual warehouses using infrastructure-as-code (Terraform, Pulumi) or version-controlled migration scripts.
  2. Time-Bound Access Grants: When a contractor begins an engagement, specify an explicit expiration timestamp at the moment access is granted rather than attempting to remember to revoke it manually weeks later.
  3. Orchestrate Across Surrounding Tools: External contractors rarely work solely inside Snowflake. They often require simultaneous, time-boxed access to GitHub repositories, Google Workspace documentation, AWS IAM roles, and communication channels.

Using centralized contractor access platforms simplifies this coordination. Teams using Tempkey can manage time-limited contractor lifecycles across their tooling footprint. For organizations building custom internal developer portals, Tempkey has a public REST API covering grants, extension, revocation with read-back verification, integrations, the audit trail, and API-key management. Keys are bearer tokens with read/write scopes; an OpenAPI 3 spec is published at api.tempkey.io/openapi.json and human docs at tempkey.io/docs/api. This allows data platform teams to programmatically schedule grants and trigger coordinated warehouse offboarding workflows automatically.

---

How to Manage Contractor Access to Snowflake Offboarding Without Audit Gaps

The single greatest risk in vendor access governance is incomplete offboarding. When contracts expire, accounts frequently remain enabled in Snowflake, creating a substantial attack surface. Learning how to manage contractor access to snowflake securely requires treating offboarding as a deterministic, verified event.

1. Setting Native User Expiration in Snowflake

Snowflake allows administrators to configure automated user expiration natively by setting the DAYS_TO_EXPIRY property in CREATE USER statements. When the expiration timestamp passes, Snowflake immediately blocks further authentication attempts.

-- Set an explicit user expiration date for a contractor
ALTER USER contractor_jane_doe SET DAYS_TO_EXPIRY = 30;

-- Alternatively, set a specific termination timestamp via ALTER USER
ALTER USER contractor_jane_doe SET MINS_TO_BYPASS_NETWORK_POLICY = 0;
ALTER USER contractor_jane_doe SET EXPIRATION_DATE = '2026-09-30 23:59:59 -0000';

2. The Multi-Step Manual Revocation Routine

If you manage user lifecycles manually, offboarding requires a sequential teardown to ensure no lingering credentials, object ownerships, or cached sessions remain:

-- Step 1: Revoke active functional roles
REVOKE ROLE contractor_marketing_analytics FROM USER contractor_jane_doe;

-- Step 2: Clear authentication credentials (passwords and public keys)
ALTER USER contractor_jane_doe UNSET RSA_PUBLIC_KEY;
ALTER USER contractor_jane_doe UNSET PASSWORD;

-- Step 3: Disable the user account immediately
ALTER USER contractor_jane_doe SET DISABLED = TRUE;

-- Step 4: Abort any currently running queries executed by the contractor
SELECT SYSTEM$ABORT_SESSION(session_id)
FROM snowflake.account_usage.sessions
WHERE user_name = 'CONTRACTOR_JANE_DOE'
  AND closed_on IS NULL;

3. Verifying Offboarding and Maintaining Compliance Trails

Manually dropping users leaves security teams vulnerable to missed steps. For instance, dropping a user without revoking their public API tokens in external ETL orchestration tools leaves downstream pipelines exposed.

Automated offboarding tools solve this by orchestrating state checks. Tempkey executes revocation and reads provider state back to confirm it. Because revocation depends on third-party provider APIs, Tempkey does not guarantee removal within any specific time and surfaces failed or unenforceable revokes in the audit log. Furthermore, to satisfy internal governance reviews, Tempkey gives you an exportable, append-only audit trail to support your own compliance and offboarding records. Tempkey does not hold SOC 2, ISO 27001, HIPAA, or PCI certification.

You can review available tiers on the Tempkey pricing page to evaluate active grant limits and extended audit retention features suitable for your team's operational volume.

---

A Step-by-Step Governance Checklist for Managing External Snowflake Users

Use this operational checklist across every stage of an external contractor's engagement to maintain warehouse integrity.

Phase 1: Pre-Onboarding Architecture

  • [ ] Define Concrete Deliverables: Document the exact schemas, tables, and views required for the project. Prohibit arbitrary database browsing.
  • [ ] Create Scoped Custom Roles: Generate a role specific to the contractor (e.g., CONTRACTOR_<PROJECT>) and establish inheritance under SYSADMIN.
  • [ ] Configure Dedicated Compute: Provision a separate virtual warehouse (Size: X-Small) with an aggressive 60-second auto-suspend and a 30-minute statement timeout.
  • [ ] Implement Masking and Row Policies: Attach Dynamic Data Masking policies to all columns containing PII, financial identifiers, or intellectual property.
  • [ ] Establish Allowlisted Network Access: Obtain verified static IP addresses or internal VPN gateway ranges and create a Snowflake Network Policy.

Phase 2: Active Engagement Monitoring

  • [ ] Enforce Key-Pair or MFA Authentication: Disable standard password logins for external programmatic users.
  • [ ] Configure Credit and Spend Quotas: Set up Snowflake Resource Monitors on the contractor's dedicated virtual warehouse to trigger email alerts at many quota and suspend compute at many.
  • [ ] Weekly Access History Auditing: Inspect SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY to verify contractors are querying only expected database objects.
  • [ ] Track Multi-Tool Lifecycles: Ensure external credentials in surrounding tools (such as GitHub or AWS) share the same expiration timeline as Snowflake. Check out how to coordinate external tools on the Tempkey integrations directory.

Phase 3: Offboarding and Teardown

  • [ ] Disable the User Record: Set DISABLED = TRUE and remove public RSA keys.
  • [ ] Revoke Warehouse and Role Grants: Detach functional and warehouse roles from the user.
  • [ ] Terminate Active Sessions: Run SYSTEM$ABORT_SESSION for any active query connections.
  • [ ] Export Audit Records: Archive the complete query history and access logs to long-term storage to preserve proof of proper offboarding.
---

Frequently Asked Questions

What is the recommended approach to handle temporary contractor accounts in Snowflake?

The recommended method is to create dedicated functional roles that follow the principle of least privilege, enforce user-level network IP policies, attach dynamic data masking to sensitive columns, and mandate key-pair authentication. Connecting these accounts to automated lifecycle tooling ensures that access automatically expires at the end of the contract without requiring manual intervention.

Can you automatically set an expiration date for a Snowflake user?

Yes. Snowflake provides native parameters such as DAYS_TO_EXPIRY and EXPIRATION_DATE via the CREATE USER and ALTER USER commands. Once the specified timestamp is reached, the user is automatically prevented from authenticating. However, downstream external API keys and surrounding operational access must still be coordinated through lifecycle management workflows.

How does dynamic data masking help secure third-party contractor access in Snowflake?

Dynamic Data Masking applies schema-level policies that evaluate the executing user's active role at query run time. If an external contractor queries a table containing PII, Snowflake replaces the raw data with masked values (such as hashing strings or returning constant placeholder text), preventing contractors from seeing production secrets while allowing them to build and test queries.

What Snowflake audit views track contractor query history and data access?

Security teams can monitor contractor actions using SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY (which details SQL text, execution duration, and warehouse consumption) and SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY (which tracks specific columns, tables, and views accessed during query execution, including through masking policies).

---

Ready to eliminate orphaned warehouse credentials? Try Tempkey to automate contractor access grants, schedule automatic revocations, and keep an append-only audit trail across your stack.