CertSafari
    Snowflake SnowPro Advanced: Security Engineer (SEA-C01)· Lessons

    Domain 1 · Lesson 2/21

    Snowflake key pairs, PATs, session policies and threat protection

    Configure and monitor user authentication and session management.

    15 min read
    5.5% of exam
    8 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Assign and rotate RSA key pairs for service users without failed logins
    • Generate programmatic access tokens and control their network, method, expiry and role requirements
    • Set session policies for idle timeout and maximum lifespan, and monitor active sessions
    • Explain what leaked password protection and malicious IP protection do automatically, and how an administrator responds

    1.Key-pair authentication and rotation with no downtime

    Service users cannot complete MFA, so they usually authenticate with a key pair. The minimum is a 2048-bit RSA pair generated with OpenSSL. The private key stays with the client in PKCS#8 PEM format. Encrypt it with AES-256-CBC where the client supports encrypted keys, and know that the passphrase never leaves the client. The public key is registered on the user. To do that, a role needs OWNERSHIP on the user or the MODIFY PROGRAMMATIC AUTHENTICATION METHODS privilege on it. Granting that privilege lets a service team manage its own keys without owning the user.

    There are two ways to register the public key. The recommended one is a named key pair, ALTER USER ... ADD KEY PAIR my_key PUBLIC_KEY = '...', which supports role restriction and expiration. The older one sets the user's RSA_PUBLIC_KEY property, which supports neither. To confirm a key was registered correctly, compare RSA_PUBLIC_KEY_FP from DESC USER with the SHA-256 fingerprint OpenSSL computes for the local public key file. The fingerprint is something you read back from Snowflake, not something you set.

    The two ways to rotate a public key without dropping connections
    ApproachStepsHow the overlap works
    Named key pair (recommended)ALTER USER ... ROTATE KEY PAIR my_key PUBLIC_KEY = '<new>', then move clients to the new private keyThe previous key stays valid for 24 hours by default. EXPIRE_ROTATED_KEY_PAIR_AFTER_HOURS changes the grace period, and 0 expires it immediately
    Two property slotsSET RSA_PUBLIC_KEY_2 to the new key, move clients to the new private key, then UNSET RSA_PUBLIC_KEYBoth keys are active together. Snowflake picks the matching public key from the private key each client presents

    The order of steps is what avoids downtime. If you overwrite RSA_PUBLIC_KEY in place, every client still using the old private key fails until it is redeployed. If you unset the old key before the new one is in use, you open the same gap. With the two-slot method, nothing expires on a timer. The old key stays valid until you unset it, so retire it only after the last client has moved.

    Checkpoint 1 of 8· Put it in order

    A service user authenticates with a key registered in RSA_PUBLIC_KEY, and several pipelines use it. Put the steps of a two-slot rotation with no downtime in order.

    1. 1.ALTER USER ... UNSET RSA_PUBLIC_KEY to retire the old key
    2. 2.Generate a new 2048-bit RSA key pair with OpenSSL
    3. 3.Update every client to connect with the new private key
    4. 4.ALTER USER ... SET RSA_PUBLIC_KEY_2 to the new public key

    Checkpoint 2 of 8· Exam question

    A data-ingestion service signs JWTs with an RSA key pair assigned to a TYPE = SERVICE user. Policy requires rotating the key with no failed logins. The current public key sits in RSA_PUBLIC_KEY. Which sequence achieves this?

    Sources1

    2.Programmatic access tokens and the policy that governs them

    A programmatic access token (PAT) is a bearer secret that works in two ways. It authenticates directly to the Snowflake REST and SQL APIs, Snowpark Container Services endpoints, and SCIM API requests. It can also replace a password in drivers, Snowflake CLI, SnowSQL and BI tools such as Tableau. PATs can be issued to human users (TYPE=PERSON) and to service users.

    By default, PATs are tied to a network policy, and the exact rule depends on the user type. A SERVICE or LEGACY_SERVICE user can only generate or use a token while subject to a network policy, so a stolen token is useless from other addresses. A SERVICE_AGENT user has no such requirement. A PERSON user can generate a token without a network policy but needs one to authenticate with it. Network policies themselves are covered in network policies and rules. This behaviour is controlled by NETWORK_POLICY_EVALUATION in the PAT_POLICY clause of an authentication policy.

    NETWORK_POLICY_EVALUATION values in PAT_POLICY
    ValueNetwork policy required to generate and use a PAT?Is an existing network policy enforced?
    ENFORCED_REQUIRED (default)YesYes
    ENFORCED_NOT_REQUIREDNoYes
    NOT_ENFORCEDNoNo
    Relaxing the network-policy requirement, the weakest of the three settingssql
    ALTER AUTHENTICATION POLICY my_authentication_policy
      SET PAT_POLICY = (
        NETWORK_POLICY_EVALUATION = NOT_ENFORCED
      );

    Three more settings decide whether a token works. First, if an authentication policy limits AUTHENTICATION_METHODS, the list has to include 'PROGRAMMATIC_ACCESS_TOKEN'. A policy allowing only ('OAUTH', 'PASSWORD') blocks PATs silently. Second, tokens expire after 15 days by default, and users can request up to 365. DEFAULT_EXPIRY_IN_DAYS and MAX_EXPIRY_IN_DAYS change those limits. If you lower the maximum, existing tokens whose lifetime exceeds the new value stop authenticating, so check what is in use before you shorten it. Third, a token for a service user must name the role its sessions will run as. REQUIRE_ROLE_RESTRICTION_FOR_SERVICE_USERS = FALSE lifts that requirement, and setting it back to TRUE invalidates the tokens that were generated without a role.

    Checkpoint 3 of 8· Check yourself

    Your contractors use PATs from changing home networks. Security wants a user who has no network policy to still be able to generate and use a PAT. Any user who does have a network policy must still be held to it. Which NETWORK_POLICY_EVALUATION value do you set in PAT_POLICY?

    Checkpoint 4 of 8· Check yourself

    Troubleshooting: a pipeline's service user is subject to a network policy and holds a PAT that names its role. The PAT still cannot authenticate. The account's authentication policy has AUTHENTICATION_METHODS = ('OAUTH', 'PASSWORD'). What fixes it?

    Sources2

    3.Session policies: idle timeout, lifespan and monitoring

    A session policy decides how long an authenticated session lasts before the user has to sign in again. It has separate settings for Snowsight and for programmatic or client sessions, because the two are used very differently. The idle timer starts at successful authentication. Without a policy, client sessions time out after 240 idle minutes and Snowsight sessions after 1080. Idle timeout alone never ends a session that stays busy. To force reauthentication after a fixed period regardless of activity, set a maximum lifespan.

    Session policy properties
    PropertyApplies toRangeDefault
    SESSION_IDLE_TIMEOUT_MINSSnowflake and programmatic clients5–1440240
    SESSION_UI_IDLE_TIMEOUT_MINSSnowsight5–14401080
    SESSION_MAX_LIFESPAN_MINSSnowflake and programmatic clients0–432000 (no maximum)
    SESSION_UI_MAX_LIFESPAN_MINSSnowsight0–432000 (no maximum)

    You attach a session policy with ALTER ACCOUNT SET SESSION POLICY or ALTER USER jsmith SET SESSION POLICY. A policy on the user overrides the one on the account. To swap in a different policy, unset the current one first and then set the new one. Setting the policy needs APPLY SESSION POLICY on the account or user, and changing it needs OWNERSHIP of the policy. The same object can also carry ALLOWED_SECONDARY_ROLES. Setting it to () makes any USE SECONDARY ROLES command fail for the affected users. Secondary roles themselves are covered in role hierarchy and secondary roles.

    Session monitoring uses two places. Query SNOWFLAKE.ACCOUNT_USAGE.SESSIONS to see sessions across the account. In Snowsight, the Sessions tab under Governance & security » Network policies lists each session's user, start time, client driver, client address and authentication method. To check which users a policy is attached to, use POLICY_REFERENCES.

    Checkpoint 5 of 8· Check yourself

    A reporting client sets CLIENT_SESSION_KEEP_ALIVE to TRUE and queries constantly. Its session policy has SESSION_IDLE_TIMEOUT_MINS = 30 and SESSION_MAX_LIFESPAN_MINS = 480. What happens after eight hours?

    Sources34

    4.Leaked password protection

    Leaked password protection runs in the background. It is on by default and cannot be turned off. When Snowflake finds a leaked password, it first checks whether the password still authenticates. If it does, Snowflake unsets the password and will not accept that password from that user in the future. The user object is not disabled, so SSO and other methods keep working. The user does not get a chance to keep the old password until a later change. It stops working immediately. Every user type is scanned, so a service user that still has a password is affected as well.

    Snowflake sends email to the user and the administrators. Administrator notices go to the verified account-level security contacts if there are any, otherwise to organization-level contacts, and otherwise to users with admin roles. When the affected user next tries to sign in, a message tells them to ask an administrator for a reset link. The new password has to meet the account's password policy. If the leaked password belongs to an administrator and no other administrator can reset it, contact Snowflake Support.

    Checkpoint 6 of 8· Check yourself

    Leaked password protection has just unset the password of a nightly pipeline's service user, which was still signing in with a password. What is the right long-term fix for that user?

    Checkpoint 7 of 8· Exam question

    A security researcher publishes a breach dump, and Snowflake's leaked password protection matches the current password of a PERSON user in your account. What does Snowflake do on its own?

    Sources5

    5.Malicious IP protection

    Malicious IP protection blocks network access attempts from addresses on a list that Snowflake curates from third-party threat intelligence. It covers IPv4 and IPv6. Blocking applies to all four categories by default, so there is no parameter to switch it on: ANONYMOUS_VPN, ANONYMOUS_PROXIES, MALICIOUS_BEHAVIOR (such as automated brute-force attempts) and TOR_EXITS.

    Blocked attempts appear in the Account Usage LOGIN_HISTORY view. Their is_success value is NO, and their login_details contains malicious_ip_protection_info with a result of BLOCKED, a riskClassification of LOW or HIGH, and the matched categories. The source address is in the ip_address column.

    Finding failed sign-ins that carry login details, including malicious IP blockssql
    SELECT *
      FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY
      WHERE NOT is_success AND login_details IS NOT NULL
      ORDER BY event_timestamp DESC;

    If legitimate users are being blocked, you can relax the protection by category with SYSTEM$OPT_OUT_MALICIOUS_IP_PROTECTION_BY_CATEGORY. Only ACCOUNTADMIN can call it. Opting out works for low-risk classifications only, and high-risk ones stay blocked. An optional second argument limits the opt-out to one user, such as a contractor's account. Each call replaces the previous one. To opt out of two categories, pass both in a single string, as in 'ANONYMOUS_VPN,MALICIOUS_BEHAVIOR'. Passing '' restores blocking for everything. Attempts that are let through by an opt-out are recorded with a result of OPTED_OUT. Because of the overwrite behaviour, a later call that names only one category quietly re-enables blocking for any category it leaves out.

    Checkpoint 8 of 8· Exam question

    Your SOC wants evidence that Snowflake's malicious IP protection is blocking sign-in attempts from anonymizing infrastructure. You also want to relax blocking for one low-risk category used by contractors. Which statements are accurate? (Select all that apply.)(Select 3)

    0 of 3 selected

    Sources67

    Practise it for real

    Harden a session and audit the automatic threat protections in a test account

    1. 1.As a role with CREATE SESSION POLICY and APPLY SESSION POLICY, create a session policy with SESSION_IDLE_TIMEOUT_MINS = 30 and SESSION_MAX_LIFESPAN_MINS = 480, then run ALTER USER with your test user's name and SET SESSION POLICY naming the new policy.

      Why: A policy on the user overrides any policy on the account, so you can test on one user without affecting others.

      You should see: POLICY_REFERENCES for the policy returns a row for the test user.

    2. 2.Query SNOWFLAKE.ACCOUNT_USAGE.SESSIONS for the test user.

      Why: This is the SQL way to monitor sessions, alongside the Sessions tab in Snowsight.

      You should see: Rows for the user's sessions, each showing the authentication method used.

    3. 3.Run the LOGIN_HISTORY query filtered on NOT is_success AND login_details IS NOT NULL.

      Why: Malicious IP blocks are recorded as failed logins with details attached.

      You should see: Any blocked attempts show malicious_ip_protection_info with result BLOCKED and a riskClassification.

    4. 4.As ACCOUNTADMIN, call SYSTEM$OPT_OUT_MALICIOUS_IP_PROTECTION_BY_CATEGORY('MALICIOUS_BEHAVIOR', 'TEST_USER') with your test user's name in place of TEST_USER, then call it again with '' and the same user.

      Why: This shows a user-scoped opt-out and how a later call overwrites the earlier one.

      You should see: Each call returns a status message. After the second call, blocking is back in place for that user.

    Stuck? Get a nudge

    If an opt-out seems to have disappeared, check whether a later call to the function overwrote it.

    Sources

    (8)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “This authentication method requires, as a minimum, a 2048-bit RSA key pair.”
      ↩︎ Key-pair authentication and rotation with no downtime
      “This approach does not support role restriction or expiration.”
      ↩︎ Key-pair authentication and rotation with no downtime
      “By default, the prior key remains valid for 24 hours.”
      ↩︎ Key-pair authentication and rotation with no downtime
      “Snowflake verifies the correct active public key for authentication based on the private key submitted with your connection information.”
      ↩︎ Exam trap 1
      “Set the public key value to either RSA_PUBLIC_KEY or RSA_PUBLIC_KEY_2, whichever key value is not currently in use.”
      ↩︎ Checkpoint
    2. 2.
      “you can only generate or use a token if the user is subject to a network policy.”
      ↩︎ Programmatic access tokens and the policy that governs them
      “By default, a programmatic access token expires after 15 days.”
      ↩︎ Programmatic access tokens and the policy that governs them
      “you must specify the role that will be used during sessions authenticated with that token.”
      ↩︎ Programmatic access tokens and the policy that governs them
      “to create an authentication policy that removes the network policy requirement but enforces any network policy that the user is subject to”
      ↩︎ Checkpoint
      “the user cannot generate and use programmatic access tokens unless the AUTHENTICATION_METHODS list in that policy includes 'PROGRAMMATIC_ACCESS_TOKEN'”
      ↩︎ Checkpoint
    3. 3.
      “If a user is associated with both an account and user-level session policy, the user-level session policy takes precedence.”
      ↩︎ Session policies: idle timeout, lifespan and monitoring
      “Query the SESSIONS view in the ACCOUNT USAGE schema of the shared SNOWFLAKE database to monitor session usage.”
      ↩︎ Session policies: idle timeout, lifespan and monitoring
      “the session still ends when that lifespan is reached, regardless of activity”
      ↩︎ Checkpoint
    4. 4.
      “unset the session policy first and then set the new session policy for the account or user.”
      ↩︎ Session policies: idle timeout, lifespan and monitoring
    5. 5.
      “Leaked password protection is enabled by default, and you cannot disable leaked password protection.”
      ↩︎ Leaked password protection
      “Snowflake then notifies the administrator and user about the leaked password through email.”
      ↩︎ Leaked password protection
      “the user cannot authenticate using their password, but the user can use other methods of authentication, such as SSO, if available.”
      ↩︎ Exam trap 2
      “Snowflake disables the leaked password by unsetting the password for the user”
      ↩︎ Prediction
    6. 6.
      “NO appears in the is_success column for blocked network access attempts.”
      ↩︎ Malicious IP protection
      “You can manage Malicious IP Protection by opting out of blocking IP addresses that are categorized as low-risk.”
      ↩︎ Malicious IP protection
      “blocks network access attempts that originate from IP addresses in all categories on this curated list by default.”
      ↩︎ Exam trap 3

    Also cited

    Spotted a mistake, or was something unclear? Tell us.