Skip to content

API Reference parrot.tools.dataset_manager.sources.authorizing

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.dataset_manager.sources.authorizing

View source

AuthorizingDataSource — DataSource decorator for FEAT-228.

Wraps any :class:~parrot.tools.dataset_manager.sources.base.DataSource with the full data-plane authorization + RLS enforcement chain (Spec §2, Module 7).

This is the keystone of Option D (enforcement at source construction time). Its fetch() method runs the complete enforcement chain before delegating to the inner source:

  1. Sensitive-driver pre-check: if the driver is classed sensitive, reject any non-:class:~parrot.tools.dataset_manager.sources.query_slug.QuerySlugSource.
  2. Get PermissionContext from the provider. None → fail-open.
  3. Resolve physical resources from the inner source via resolve_physical_resources.
  4. Call guard.authorize_source(ctx, resources) (raises on denial).
  5. Collect RLS predicates from the guard.
  6. Inject RLS predicates into the inner source/query.
  7. Delegate to inner.fetch().

Transparent delegation:

  • describe() → delegates to inner.
  • cache_key → delegates to inner.
  • has_builtin_cache → delegates to inner.
  • prefetch_schema() → delegates to inner.

Class AuthorizingDataSource

Decorator that wraps a DataSource with authorization + RLS enforcement.

The fetch() method runs the full enforcement chain before delegating to the inner source's fetch(). All other :class:DataSource properties are transparently delegated.

Parameter Type Default Description
inner DataSource The wrapped :class:DataSource instance.
guard 'DataPlanePolicyGuard' :class:~parrot.auth.dataplane_guard.DataPlanePolicyGuard that performs PBAC evaluation and RLS predicate collection.
pctx_provider Callable[[], Optional['PermissionContext']] Callable with no arguments that returns the current :class:~parrot.auth.permission.PermissionContext (typically lambda: _pctx_var.get(None)). Called at fetch() time so the context is fresh for each invocation.

Attributes:

Attribute Type Description
has_builtin_cache bool Delegate to inner source.
cache_key str Delegate to inner source.

Method AuthorizingDataSource.fetch

Run the enforcement chain then delegate to inner.fetch().

Enforcement steps: 0. Sensitive-driver pre-check: reject non-slug sources.

  1. Get PermissionContext from provider; None → fail-open.
  2. Resolve physical resources.
  3. Authorize (raises AuthorizationRequired on denial).
  4. Collect RLS predicates.
  5. Inject RLS into the inner source/query.
  6. Delegate to inner.fetch().

fetch(**params) -> pd.DataFrame

Parameter Type Default Description
**params {} Keyword arguments forwarded to inner.fetch().

Returns: pd.DataFrame — class:pandas.DataFrame returned by the inner source.

Raises:

  • AuthorizationRequired — When the guard denies access.
  • ReadOnlyViolation — When a DML/DDL statement is detected.

Method AuthorizingDataSource.describe

Delegate to inner source.

describe() -> str

Returns: str

Method AuthorizingDataSource.prefetch_schema

Delegate schema prefetch to inner source.

prefetch_schema()

Alias DataPlanePolicyGuard

Re-exported from parrot.auth.dataplane_guard.DataPlanePolicyGuard.

Alias DataSource

Re-exported from parrot.tools.dataset_manager.sources.base.DataSource.

Alias PermissionContext

Re-exported from parrot.auth.permission.PermissionContext.

Alias PhysicalResources

Re-exported from parrot.tools.dataset_manager.sources.resolver.PhysicalResources.

Alias RlsPredicate

Re-exported from parrot.auth.rls_registry.RlsPredicate.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally