authz-bridging-exceptions

Diagnose and fix async override anti-patterns in FastAPI JWT and service-account auth fallback branches.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/ZaxbyHub/ragappv3 --skill authz-bridging-exceptions-zaxbyhub
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: authz-bridging-exceptions
Source: https://github.com/ZaxbyHub/ragappv3/tree/main/.opencode/skills/authz-bridging-exceptions
Command: npx skills add https://github.com/ZaxbyHub/ragappv3 --skill authz-bridging-exceptions-zaxbyhub

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? FastAPI dependencies that bridge JWT auth with a service-account fallback can silently mask 403 authorization errors or crash with TypeError when dependency overrides return async functions instead of coroutines, causing routes to return 200 instead of 403. ## Core Features & Use Cases - Anti-Pattern Detection: Identifies the inspect.isawaitable() misuse on the evaluate closure, which returns None for async def overrides and breaks the policy check. - Correct Fallback Pattern: Documents the fix using inspect.iscoroutine() so only genuine 401 credential failures fall through to the SA path while 403 and other errors propagate unchanged. - Diagnostic Command: Provides a grep-based check to locate every vulnerable override branch in the codebase. - Use Case: When tests patch get_evaluate_policy with a sync or async function and a chat or wiki route incorrectly returns 200 for unauthorized users, apply this Skill to correct the override branch in get_chat_stream_auth_context or get_wiki_events_auth_context. ## Quick Start Review the auth override branch in my FastAPI dependency and fix any inspect.isawaitable usage on the evaluate closure to use inspect.iscoroutine instead.

Frequently Asked Questions about authz-bridging-exceptions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a FastAPI dependency override returning None for async functions?▼

Replace inspect.isawaitable with inspect.iscoroutine when checking the evaluate closure. isawaitable returns True for async def functions, and awaiting the function itself yields None instead of its return value, causing a TypeError when the result is later called.

Why does my FastAPI route return 200 instead of 403 in tests?▼

The auth override branch may be masking authorization failures when dependency_overrides patches get_evaluate_policy with a function returning True. Ensure the fallback only triggers on genuine 401 credential failures and that 403 signals propagate unchanged.

What is the difference between inspect.isawaitable and inspect.iscoroutine?▼

iscoroutine is True only for coroutine objects, while isawaitable is also True for coroutine functions and other awaitables. Awaiting an async def function object returns None rather than calling it, so iscoroutine is the safe check before awaiting.

How do I find vulnerable auth override branches in my codebase?▼

Run grep -rn "if inspect.isawaitable" on your backend source and check whether each match sits inside an if-override-is-not-None fallback block. Refactor each matching branch to use inspect.iscoroutine for the post-override check.

When should the service-account auth fallback trigger?▼

The SA fallback should only trigger on 401, meaning genuine missing or invalid credentials. It must not mask 403 responses such as must_change_password or other 4xx and 5xx signals, which are authorization or server-state errors that must reach the client unchanged.