Secure objects: Redaction of information in error messages¶
Error messages related to secure objects behave as follows:
- Before the change:
Error messages related to secure objects show the full message.
- After the change:
Error messages related to secure objects might be redacted.
The change applies to error messages related to the following types of objects:
Secure functions (including secure table functions)
For more information about secure objects, see Use secure objects to control data access.
When an error is detected during the expansion or evaluation of a secure object, the error message is considered for redaction. When an error message is redacted, the error code remains unchanged.
Two types of changes to error messages are possible: redaction during execution and redaction in metadata after execution. These types of changes are described in the following sections.
Redaction during execution¶
A whole error message or a part of an error message can be redacted when the error is returned during an operation. Generally, this type of error message redaction occurs when a user tries to use a secure object without having the OWNERSHIP privilege on the secure object.
Redaction in metadata after execution¶
Users can view metadata about errors after they occur, including the error messages. For example, users can view this metadata in the Query History page in Snowsight, or by querying views and calling functions in the Snowflake Information Schema. When an error message is redacted during execution, the error message is always redacted in the metadata after execution for all users.
When an error message isn’t redacted during execution, the message appears unchanged in the metadata for some users and is redacted for other users. The error message is unchanged in the metadata in either of the following cases:
The user viewing the metadata has the AUDIT privilege.
The user viewing the metadata has the ENABLE_UNREDACTED_SECURE_OBJECT_ERROR user parameter set to
TRUE. A user with the AUDIT privilege can set this parameter for a user.The user viewing the metadata executed the statement that caused the error.
In all other cases, the error message is redacted in the metadata. Redacted error messages include the text:
Error in secure object.
Examples of error message redaction¶
The following examples show error messages that are redacted. The redaction can occur during execution or in metadata after execution.
Example 1: Querying a secure view¶
In the following example, a user with the SELECT privilege on a secure view executes a query on the view that returns an error.
Create the secure view:
Drop the table used in the view query:
Execute a query on the view:
Error message displayed to all users before the change¶
Redacted error message displayed to some users after the change¶
Example 2: Running a query that calls a secure function¶
In the following examples, a user with the USAGE privilege on a secure function executes a query that calls the secure function, but the secure function returns an error.
Example 2a: The function arguments result in an error¶
Create the secure function:
Execute a query that calls the secure function:
Error message displayed to all users before the change¶
Redacted error message displayed to some users after the change¶
Example 2b: An object the function depends on is deleted¶
Create the secure function:
Drop the table used in the function:
Execute a query that calls the secure function:
Error message displayed to all users before the change¶
Redacted error message displayed to some users after the change¶
Example 3: A masking policy returns an error¶
In the following example, a user runs a query on a view with a masking policy that encounters an error.
Create a masking policy:
Create a view and set the masking policy on a column in the view:
Drop the table used in the masking policy:
Execute a query on the view as a user that doesn’t have ownership privileges on the masking policy:
Error message displayed to all users before the change¶
Redacted error message displayed to some users after the change¶
Example 4: A row access policy returns an error¶
In the following example, a user runs a query on a view with a row access policy and encounters an error.
Create a row access policy:
Create a view and add the row access policy on the view:
Drop the table used in the row access policy:
Query the view as a user that doesn’t have OWNERSHIP privileges on the row access policy:
Error message displayed to all users before the change¶
Redacted error message displayed to some users after the change¶
Ref: 1858