Restricted Caller’s Rights
Restricted Caller’s Rights (RCR) keeps Snowflake traffic from Posit Workbench and Posit Connect on the Snowflake internal network. With RCR, you can:
- Skip the AWS PrivateLink and Azure Private Link configurations, which Posit plans to deprecate.
- Stop updating network policies when the outbound SPCS egress public IP addresses change.
- Remove most Workbench and Connect egress rules. See Reduce egress rules.
RCR is a Snowflake feature that runs SQL as the signed-in user (the caller), limited by restrictions you place on the Posit Team application. RCR is generally available in Snowflake, and Posit Team support for RCR is in public preview. RCR works with customer-provided credentials in Snowpark Container Services (SPCS).
How RCR routes traffic
Without RCR, Posit Team reaches your Snowflake account at https://org-account.snowflakecomputing.com or https://org-account.privatelink.snowflakecomputing.com, over the public internet or your cloud virtual network. Inside SPCS, Snowflake provides a SNOWFLAKE_HOST environment variable with an endpoint similar to https://account-identifier.az.region.cloud.snowflakecomputing.com that is routable only within SPCS. With RCR, queries use this internal endpoint. Large query results that Snowflake downloads in batches from a stage also stay on the Snowflake internal network.
Traditional OAuth vs. RCR OAuth
RCR OAuth has a subset of the capabilities of traditional OAuth (caller’s rights). You control that subset through the caller grants you give the Posit Team application. In our experience, you can grant everything except the most sensitive security SQL operations. Snowflake documents both high-level and fine-grained caller grants.
We strongly recommend granting CALLER FULL MANAGEMENT ON ACCOUNT unless you have a specific need to restrict access. The effective privileges when running SQL in the Posit Team application are always a subset of the user’s normal Snowflake privileges.
Prerequisites
To configure RCR, you need the following:
- The
ACCOUNTADMINrole, or a role that can create network rules, alter your active network policy, and grant caller privileges to the application - The name of your Posit Team application
- The names of your active network policies, if your account or your users have any
To find the application name, run SHOW APPLICATIONS and use the name column. Your organization might use an account-level network policy, user-level network policies, or both. To find them, run the following and use the value column:
Snowsight UI
-- Account-level policy
SHOW PARAMETERS LIKE 'NETWORK_POLICY' IN ACCOUNT;
-- User-level policy for one user
SHOW PARAMETERS LIKE 'NETWORK_POLICY' FOR USER <username>;If the value column is empty for the account and for each Posit Team user, you have no active network policy.
Configure Snowflake
RCR is opt-in for all Posit Team applications. Complete the steps below in a Snowflake Worksheet, then enable RCR in each product.
If your account or your users have an active network policy, allow RCR connections from the Posit Team compute pools.
If you have no active network policy, skip to step 2. You do not need to create a network policy for RCR. A network rule has no effect until a network policy uses it.
When a Snowflake client in a Posit Team service signs in through
SNOWFLAKE_HOST, Snowflake checks your active network policy. Create aCOMPUTE_POOLingress network rule that lists the Posit Team compute pools, and add it to your active network policy. The rule allows sign-ins only from the compute pools it lists. It does not allow traffic from the internet.Posit Team uses the following compute pools for an application installed as
POSIT_TEAM:Compute pool Used by POSIT_TEAMPosit Team controller POSIT_TEAM_WORKBENCHWorkbench POSIT_TEAM_CONNECTConnect POSIT_TEAM_WB_SESSIONSWorkbench external sessions. Additional session compute pools are named POSIT_TEAM_WB_SESSIONS_2throughPOSIT_TEAM_WB_SESSIONS_10.Snowflake rejects a network rule that lists a compute pool that does not exist. To see which compute pools exist, run:
Snowsight UI
SHOW COMPUTE POOLS LIKE 'POSIT_TEAM%';Create the network rule with the compute pools that exist. Substitute your application name for
POSIT_TEAMand your policy name for<your-active-network-policy>. The following example is for an installation that runs Workbench and Connect without external sessions:Snowsight UI
CREATE OR REPLACE NETWORK RULE POSIT_TEAM_APP_DATA.CONFIGURATION.ALLOW_SPCS_RCR TYPE = COMPUTE_POOL MODE = INGRESS VALUE_LIST = ('POSIT_TEAM', 'POSIT_TEAM_WORKBENCH', 'POSIT_TEAM_CONNECT');Snowsight UI
ALTER NETWORK POLICY <your-active-network-policy> ADD ALLOWED_NETWORK_RULE_LIST = ('POSIT_TEAM_APP_DATA.CONFIGURATION.ALLOW_SPCS_RCR');If you use user-level network policies, run the same
ALTER NETWORK POLICYstatement for each user-level policy assigned to a Posit Team user.With RCR, you do not need to add the public IP addresses of Posit Team to a network policy, as described in Network policies.
When you later start another product or add a session compute pool, add its compute pool to the rule.
SET VALUE_LISTreplaces the whole list, so include every compute pool:Snowsight UI
ALTER NETWORK RULE POSIT_TEAM_APP_DATA.CONFIGURATION.ALLOW_SPCS_RCR SET VALUE_LIST = ('POSIT_TEAM', 'POSIT_TEAM_WORKBENCH', 'POSIT_TEAM_CONNECT', 'POSIT_TEAM_WB_SESSIONS');For details, see the Snowflake CREATE NETWORK RULE and SPCS customer-provided credentials documentation.
Grant the
FULL MANAGEMENTcaller privilege to the application.Snowsight UI
GRANT CALLER FULL MANAGEMENT ON ACCOUNT TO APPLICATION POSIT_TEAM;For details, see the Snowflake FULL MANAGEMENT documentation.
The grant does not give the application privileges of its own, and it does not let the application manage your account. It sets the most the application can do while it runs a query as a signed-in user. Each query runs with only the privileges that the user’s role, the caller grant, and the application’s own privileges all allow. Users cannot do anything in Posit Team that their Snowflake role does not already allow. To limit what users can do through Posit Team, grant narrower caller privileges instead. See the Snowflake high-level caller privileges documentation for the options.
Enable RCR in Workbench
On the Workbench management page, turn on Enable RCR under Restricted Caller’s Rights, then click Upgrade to activate RCR on Workbench.
Users must start their Workbench sessions with managed credentials to query Snowflake through RCR.
RCR is in public preview and has known rough edges:
- To switch Snowflake roles, sign in again with the new role in managed credentials
- Code completions do not work in the Positron editor, including in notebook cells
- In Positron and Workbench sessions with RCR enabled, switching Snowflake roles between accounts does not work
Enable RCR in Connect
On the Connect management page, turn on Enable RCR under Restricted Caller’s Rights, then click Upgrade to activate RCR on Connect.
With RCR, Connect exchanges Snowflake OAuth tokens through SNOWFLAKE_HOST, not your account URL. Update the Snowflake OAuth integration in Connect to use it:
- On the Connect management page, click Snowflake OAuth. The page shows the token endpoint URL for your account, in the form
https://<SNOWFLAKE_HOST>/oauth/token-request. - In Connect, open System > Integrations and edit the Snowflake integration. Set Token Endpoint URL to the URL from step 1. Leave Authorization Endpoint URL empty, because users sign in through your account URL.
Without this change, the integration stops working after you remove the Snowflake account endpoint from the Connect egress.
With RCR enabled, Connect content must connect to Snowflake through SNOWFLAKE_HOST. Existing content that connects without SNOWFLAKE_HOST fails after you enable RCR. Update the code as shown below and republish it.
For Python, add host=os.environ['SNOWFLAKE_HOST'] to the connection in the Connect Snowflake Python cookbook:
con = snowflake.connector.connect(
...,
authenticator=auth.authenticator,
token=auth.token,
host=os.environ['SNOWFLAKE_HOST'],
)For R, add host = Sys.getenv("SNOWFLAKE_HOST") to the connection in the Connect Snowflake R cookbook:
DBI::dbConnect(odbc::snowflake(), "Snowflake",
authenticator="OAUTH",
token = token,
host = Sys.getenv("SNOWFLAKE_HOST"),
...
)Check caller’s rights
RCR restricts each user’s own Snowflake privileges, so it is not a single on or off setting. Posit Team checks specific capabilities when a user signs in. The Caller’s Rights row on the System page in the Posit Team UI lists each capability as Allowed or Not allowed for the signed-in user:
- Describe user: Posit Team can read the user’s Snowflake profile. Connect and Workbench need it to receive the user’s first name, last name, and email. See User names and email.
If a capability shows Not allowed, review the caller grant in Configure Snowflake. Posit Team checks again when the user next signs in, or right away when the user clicks Refresh in the Posit Team profile menu.
To confirm that RCR is on for a Workbench session, open a terminal in the session and run:
Terminal
env | grep SNOWFLAKEThe output includes SNOWFLAKE_RUNNING_INSIDE_SPCS=true when RCR is on for the session. If the variable is missing, check that Enable RCR is on in Workbench, then start a new session.
User names and email
With the caller grant from Configure Snowflake in place, Posit Team reads each user’s first name, last name, and email from their Snowflake user profile when they sign in. Posit Team passes these values to Connect and Workbench. Connect uses them for the user’s account, so users cannot edit their first and last name in Connect.
This does not depend on the Enable RCR toggle in each product. Only the caller grant is required.
Without the caller grant, first and last name are empty in Connect, and the email comes from the Sf-Context-Current-User-Email ingress header if Snowflake has enabled it for your account.
Posit Team reads only the values set in Snowflake. To set them, run ALTER USER:
Snowsight UI
ALTER USER <username> SET FIRST_NAME = '<first name>' LAST_NAME = '<last name>' EMAIL = '<email>';Posit Team reads the profile again at least once an hour, or right away when a user clicks Refresh in the Posit Team profile menu. Connect shows the new values the next time the user signs in to Connect.
Reduce egress rules
With RCR enabled, Snowflake queries no longer leave the Snowflake network, so you can remove the Snowflake account endpoint from the Workbench and Connect network rules. RCR does not change Package Manager egress.
See Egress for the endpoints to remove, the endpoints each product still needs, and how to change the network rules.