When `restrict_to_user_objects` is active, rejects access to system catalog objects. Functions and types are allowed through because they are needed for query execution. All other system items (tables, views, sources, sinks, etc.) are blocked. This is an allow-list — new catalog item types are blocked by default. See: doc/developer/design/20260508_restrict_to_user_objects.md
(
catalog: &impl SessionCatalog,
session: &dyn SessionMetadata,
resolved_ids: &ResolvedIds,
)
| 325 | /// |
| 326 | /// See: doc/developer/design/20260508_restrict_to_user_objects.md |
| 327 | fn check_restrict_to_user_objects( |
| 328 | catalog: &impl SessionCatalog, |
| 329 | session: &dyn SessionMetadata, |
| 330 | resolved_ids: &ResolvedIds, |
| 331 | ) -> Result<(), UnauthorizedError> { |
| 332 | if !session.restrict_to_user_objects() { |
| 333 | return Ok(()); |
| 334 | } |
| 335 | for item_id in resolved_ids.items() { |
| 336 | if item_id.is_system() { |
| 337 | if let Some(item) = catalog.try_get_item(item_id) { |
| 338 | match item.item_type() { |
| 339 | CatalogItemType::Func | CatalogItemType::Type => {} |
| 340 | _ => { |
| 341 | if RESTRICT_TO_USER_OBJECTS_ALLOWED_OIDS.contains(&item.oid()) { |
| 342 | continue; |
| 343 | } |
| 344 | return Err(UnauthorizedError::RestrictedSystemObject { |
| 345 | object_name: item.name().item.clone(), |
| 346 | }); |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | Ok(()) |
| 353 | } |
| 354 | |
| 355 | /// Checks if a `session` is authorized to use `resolved_ids`. If not, an error is returned. |
| 356 | pub fn check_usage( |
no test coverage detected