Skip to content

API Reference parrot.auth.oauth2.legacy_audit

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

parrot.auth.oauth2.legacy_audit

View source

Read-only audit of legacy channel-scoped OAuth2 keys (FEAT-773 M10, U3 cutover metric).

Alias OAUTH2_LEGACY_KEYS_UNTIL

Re-exported from parrot.conf.OAUTH2_LEGACY_KEYS_UNTIL.

Alias OAUTH2_REDIS_URL

Re-exported from parrot.conf.OAUTH2_REDIS_URL.

Alias PrincipalResolver

Re-exported from parrot.auth.principal.PrincipalResolver.

Function audit_legacy_keys

Return bound and unbound counts by provider and channel.

Redis is only scanned; values are never read or printed. Legacy OAuth2 keys use oauth2:{provider}:{channel}:{user_id}, while Jira's older layout uses jira:oauth:{channel}:{user_id}.

audit_legacy_keys(redis: Any, resolver: PrincipalResolver, *, providers: Sequence[str]) -> Dict[str, Dict[str, Dict[str, int]]]

Parameter Type Default Description
redis Any
resolver PrincipalResolver
providers Sequence[str]

Returns: Dict[str, Dict[str, Dict[str, int]]]

Alias get_principal_resolver

Re-exported from parrot.auth.principal.get_principal_resolver.

Attribute logger

Function main

Run the read-only audit and print a table of counts.

main(argv: Optional[Sequence[str]] = None) -> int

Parameter Type Default Description
argv Optional[Sequence[str]] None

Returns: int

Function purge_legacy_keys

Count (and, unless dry_run, UNLINK) legacy keys for one channel. Never reads values.

purge_legacy_keys(redis: Any, *, channel: str, providers: Sequence[str], dry_run: bool = True, force: bool = False, now: Optional[datetime] = None) -> Dict[str, int]

Parameter Type Default Description
redis Any Async Redis client supporting scan_iter and unlink.
channel str Channel whose legacy keys are targeted (e.g. telegram).
providers Sequence[str] OAuth2 providers to purge.
dry_run bool True Only count keys when True (always allowed).
force bool False Bypass the cutoff date gate.
now Optional[datetime] None Override of the current time (tests).

Returns: Dict[str, int] — Mapping of scan pattern to matched key count.

Raises:

  • PermissionError — before the cutoff (or with a missing/invalid cutoff) unless force.

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