You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
152532: unsafesql: report break glass usage of unsafe internals to the sql_exec log r=angles-n-daemons a=angles-n-daemons
The epic below outlines a set of work to prevent users from unauthorized access to what we deem unsafe internals. These unsafe internals lie mostly in the crdb_internal schema and the system database. This PR adds a log to SENSITIVE_ACCESS to audit each time the operator breaks glass and bypasses these access controls.
There is refactoring as part of this PR, specifically the transformation of a statement to a redactable string (`FormatAstAsRedactableString`) is pulled out of the sql package and into the tree package, so that it could be leveraged by the optbuilder package.
Fixes: #151488
Epic: CRDB-24527
Release note (ops change): A log will be emitted now when users override the unsafesql safety gate.
Co-authored-by: Brian Dillmann <[email protected]>
Copy file name to clipboardExpand all lines: docs/generated/eventlog.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -853,6 +853,56 @@ a table marked as audited.
853
853
|`BulkJobId`| The job id for bulk job (IMPORT/BACKUP/RESTORE). | no |
854
854
|`StmtPosInTxn`| The statement's index in the transaction, starting at 1. | no |
855
855
856
+
### `unsafe_internals_accessed`
857
+
858
+
UnsafeInternalsAccess is recorded when a query accesses unsafe internals
859
+
using the allow_unsafe_internals override.
860
+
861
+
862
+
| Field | Description | Sensitive |
863
+
|--|--|--|
864
+
|`Query`| The query that triggered the unsafe internals access. | partially |
865
+
866
+
867
+
#### Common fields
868
+
869
+
| Field | Description | Sensitive |
870
+
|--|--|--|
871
+
|`Timestamp`| The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no |
872
+
|`EventType`| The type of the event. | no |
873
+
|`Statement`| A normalized copy of the SQL statement that triggered the event. The statement string contains a mix of sensitive and non-sensitive details (it is redactable). | partially |
874
+
|`Tag`| The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no |
875
+
|`User`| The user account that triggered the event. The special usernames `root` and `node` are not considered sensitive. | depends |
876
+
|`DescriptorID`| The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no |
877
+
|`ApplicationName`| The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | no |
878
+
|`PlaceholderValues`| The mapping of SQL placeholders to their values, for prepared statements. | yes |
879
+
|`TxnReadTimestamp`| The current read timestamp of the transaction that triggered the event, if in a transaction. | no |
880
+
881
+
### `unsafe_internals_denied`
882
+
883
+
An event of type `unsafe_internals_denied` is recorded when a query attempts to access unsafe internals
884
+
but lacks the appropriate session variables.
885
+
886
+
887
+
| Field | Description | Sensitive |
888
+
|--|--|--|
889
+
|`Query`| The query that triggered the unsafe internals access. | partially |
890
+
891
+
892
+
#### Common fields
893
+
894
+
| Field | Description | Sensitive |
895
+
|--|--|--|
896
+
|`Timestamp`| The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no |
897
+
|`EventType`| The type of the event. | no |
898
+
|`Statement`| A normalized copy of the SQL statement that triggered the event. The statement string contains a mix of sensitive and non-sensitive details (it is redactable). | partially |
899
+
|`Tag`| The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no |
900
+
|`User`| The user account that triggered the event. The special usernames `root` and `node` are not considered sensitive. | depends |
901
+
|`DescriptorID`| The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no |
902
+
|`ApplicationName`| The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | no |
903
+
|`PlaceholderValues`| The mapping of SQL placeholders to their values, for prepared statements. | yes |
904
+
|`TxnReadTimestamp`| The current read timestamp of the transaction that triggered the event, if in a transaction. | no |
0 commit comments