What you will be able to do
- State how an app's stored procedure runs when no EXECUTE AS clause is given
- Create a restricted caller's rights executable and explain the consumer GRANT CALLER workflow
- Identify the limitations of restricted caller's rights inside an app
- Pick the access mechanism that fits a given access requirement
- Explain how execution rights and redaction protect provider code
1.Owner's rights: the default execution model
Execution rights decide whose privileges an app's code runs with. Two kinds of executable in an app can be configured this way: stored procedures owned by the app, and services in apps with containers. Each runs with either owner's rights or restricted caller's rights.
Owner's rights is the default. CREATE PROCEDURE with no EXECUTE AS clause produces a procedure that runs as the app. Consumers who have been granted the procedure through an application role can call it, and whatever the app is privileged to do, the procedure can do. This is what lets an app read data in the provider account and present the results to the consumer, while the consumer never gets direct access to that data. Providers also don't need to ask the consumer for anything to create or access objects the app owns.
Checkpoint 1 of 5· Check yourself
A provider's setup script creates a stored procedure that reads tables owned by the app and returns summary results to consumers. Consumers must never query the underlying data directly. What does the provider need to set up for this procedure to work?
Owner's rights is the default, and the owner is the app, so the procedure can use anything the app owns without asking the consumer for anything. Consumers only get the procedure through an application role, never the data behind it.
“Providers do not need to request access from the consumer to create or access objects owned by the app.”Source: docs.snowflake.com
Sources1
2.Restricted caller's rights and the GRANT CALLER workflow
Restricted caller's rights let an executable act with the caller's privileges, but only those the consumer has explicitly allowed. The provider opts in by adding EXECUTE AS RESTRICTED CALLER to the executable.
CREATE OR REPLACE PROCEDURE CORE.HELLO()
RETURNS STRING
LANGUAGE SQL
EXECUTE AS RESTRICTED CALLER
AS
BEGIN
RETURN 'Hello Snowflake!';
END;Snowflake recommends announcing this in the manifest. With enabled: true, Snowsight adds a Restricted caller's rights section to the app's listing, so consumers see it before they install.
restricted_callers_rights:
enabled: true
description: This app includes stored procedure that uses restricted caller's rights.On the consumer side, an administrator issues caller grants that name the app with TO APPLICATION. Each grant applies to one level of the hierarchy, and Snowflake recommends granting at a container level rather than object by object. The levels don't cascade downwards:
- Schema:
CALLER USAGEgrants only USAGE on the schema. Objects inside need an inherited grant, such asGRANT INHERITED CALLER USAGE ON ALL FUNCTIONS IN SCHEMA. - Database:
CALLER USAGEcovers the database and its schemas. Objects needGRANT INHERITED CALLER USAGE ON ALL FUNCTIONS IN DATABASE;. - Account:
CALLER USAGEgrants access to the account only. Operations need their own caller grant, such asGRANT CALLER CREATE DATABASE ON ACCOUNT TO my_app;.
GRANT CALLER USAGE ON DATABASE consumer_db TO APPLICATION hello_snowflake_app;Checkpoint 2 of 5· Fill the gap
A consumer has already run GRANT CALLER USAGE ON DATABASE for an app, but the app's restricted caller's rights procedure still can't use the functions in that database. Which keyword completes the grant that gives it access to those functions?
GRANT ? CALLER USAGE ON ALL FUNCTIONS IN DATABASE;A caller grant on a database covers only the database and its schemas. The levels don't cascade down, so the objects inside need an INHERITED CALLER grant. FUTURE and IMPORTED are ordinary grant keywords that don't create caller grants, and CASCADE doesn't exist for caller grants.
Source: docs.snowflake.comSources1
3.Limitations of restricted caller's rights
Native Apps never allow unrestricted caller's rights, because an executable that could use every privilege of whoever called it would undermine the app's security guarantees. Restricted caller's rights come with further limits:
- Persistent reference functions are not supported.
- Relative paths to objects on a stage are not supported.
- A restricted caller's rights executable cannot access the app's internal objects.
- An owner's rights executable can call a restricted caller's rights executable only if the app owns both. An app procedure can't call a consumer's restricted-caller procedure.
The internal-objects rule catches people when they design. Suppose a procedure needs to read consumer tables owned by another role and also write results into the app's own tables. Restricted caller's rights alone can't do both. Split the work: a restricted-caller executable handles the consumer side, and an owner's-rights executable owned by the app handles the app's internal objects.
Checkpoint 3 of 5· Check yourself
An app must read consumer tables that belong to another role in the consumer account, then write the results into tables the app owns. How should the provider design the executables?
Restricted caller's rights executables can't access the app's internal objects, so the consumer side and the app side need separate executables. Native Apps don't allow unrestricted EXECUTE AS CALLER, and an app's owner's-rights procedure can only call restricted-caller executables that the app also owns.
“Restricted caller’s rights executables cannot access the app’s internal objects.”Source: docs.snowflake.com
Sources1
4.Choosing the right access mechanism
The choice follows from who owns the thing the code needs. When the app owns it, owner's rights are enough. When the consumer owns it and the app knows exactly which object it needs, a reference is the narrowest option. Restricted caller's rights are for objects owned by other users or roles, and for account-level operations the consumer wants to authorise via caller grants.
| Access required | How to get access |
|---|---|
| Data or functions owned by the app | Owner's rights (default); no consumer request needed |
| Specific tables, views, or functions in the consumer account | Request references from the consumer |
| Tables, views, functions, and row policies owned by another user or role | Restricted caller's rights |
| Broad access to consumer-owned databases | Database role grants |
| Queries combining consumer and provider data | References and owner's rights together |
| Account-level operations such as creating databases or executing tasks | Restricted caller's rights |
Checkpoint 4 of 5· Match them up
Match each access requirement of a Native App to the mechanism Snowflake recommends for it.
Tap a term, then the definition that fits it.
Pick the mechanism by who owns what the code needs. If the app owns it, owner's rights are enough. If the consumer owns a known object, a reference is the narrowest option. Account-level operations need restricted caller's rights backed by the consumer's caller grants. Mixed queries pair a reference to the consumer data with owner's rights over the provider data.
“Queries that access a combination of consumer and provider data | Use references and owner’s rights together”Source: docs.snowflake.com
Sources1
5.How execution rights and redaction protect provider code
Provider intellectual property is protected by default, just as consumer data is. A consumer who installs the app can't view the objects inside the application object unless the provider grants access through application roles. That makes owner's rights the main IP tool. Granting USAGE on a procedure lets consumers run the logic without seeing the objects or data behind it.
The framework also redacts what a consumer would otherwise see in metadata. For queries run at install or upgrade, queries from a stored procedure the app owns, and queries involving a non-secure view or function the app owns, Snowsight collapses the query profile to a single empty node. In query history, query_text and error_message show blank for install and upgrade queries and for child jobs of app-owned procedures.
Checkpoint 5 of 5· Check yourself
To protect its IP, a provider wants consumers to run a proprietary scoring model, which the app keeps in its own procedure and lookup tables. Consumers must never see the logic or the lookup data. Which design does this?
An owner's-rights procedure runs as the app, so it can use the app's tables and return results. Consumers get only USAGE on the procedure, never access to the objects behind it. Restricted caller's rights executables can't reach the app's internal objects, so they don't protect app-held IP. Granting the tables exposes the data. Moving the logic into the consumer's account gives the code away, and an app can't call a consumer's procedure anyway.
“owner’s rights allow an executable to access data in the provider account and present that data to the consumer”Source: docs.snowflake.com
Sources
(3)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“they run with the privileges granted to the owner of the executable, which is the app itself.”
↩︎ Owner's rights: the default execution model“they do not allow the consumer to access the data directly.”
↩︎ Owner's rights: the default execution model“cannot run with a specific privilege unless an administrator in the consumer account explicitly allows it by using the GRANT CALLER command”
↩︎ Restricted caller's rights and the GRANT CALLER workflow“if it is present and enabled is set to true, Snowsight includes a section named Restricted caller’s rights in the app’s listing.”
↩︎ Restricted caller's rights and the GRANT CALLER workflow“Snowflake recommends that consumers grant caller grants at a container level and not on specific objects in their account.”
↩︎ Restricted caller's rights and the GRANT CALLER workflow“an app’s stored procedure with owner’s rights cannot call a consumer’s stored procedure with restricted caller’s rights.”
↩︎ Limitations of restricted caller's rights“Relative paths to objects on a stage are not supported.”
↩︎ Limitations of restricted caller's rights“Use restricted caller’s rights, which allow the consumer to enable access to perform these actions.”
↩︎ Choosing the right access mechanism“granting the CALLER USAGE caller grant on a schema only grants the USAGE privilege on the schema.”
↩︎ Exam trap 1“Restricted caller’s rights executables cannot access the app’s internal objects.”
↩︎ Exam trap 2“To guarantee that executables in an app are secure, Snowflake Native Apps do not support unrestricted caller’s rights.”
↩︎ Exam trap 3“Providers do not need to request access from the consumer to create or access objects owned by the app.”
↩︎ Checkpoint“Restricted caller’s rights executables cannot access the app’s internal objects.”
↩︎ Checkpoint“Queries that access a combination of consumer and provider data | Use references and owner’s rights together”
↩︎ Checkpoint“owner’s rights allow an executable to access data in the provider account and present that data to the consumer”
↩︎ Checkpoint - 2.
“they are not allowed to view the objects within the application object unless a provider grants permissions on the objects using application roles.”
↩︎ How execution rights and redaction protect provider code“Snowsight collapses the query profile data into a single empty node instead of displaying the full query profile tree.”
↩︎ How execution rights and redaction protect provider code - 3.https://docs.snowflake.com/en/developer-guide/native-apps/consumer-guide-responsibilityOfficial docs
“It does not provide any access to consumer data by default while also protecting the provider’s intellectual property (IP) by default.”
↩︎ How execution rights and redaction protect provider code