typing.cast() silently passes None as bool, exposing a hidden approval-bypass risk
In Google's adk-python SDK, a tool-call confirmation mechanism relies on cast(bool, await ...) to signal whether human approval is needed, but typing.cast() is a no-op at runtime and simply returns its argument unchanged. If the awaited expression resolves to None, the caller receives None, which evaluates as falsy and silently skips the confirmation step. The issue mirrors a previously filed coercion bug in openai-agents-python, though it arrives via type declaration rather than explicit conversion. The author also notes that multi-line formatting of cast() calls caused their grep-based detection tool to miss the pattern entirely, and that correct line numbers were initially reported for the wrong code branches. No live failure path was confirmed through full call-graph tracing, so the concern reflects what the code structurally permits rather than an observed exploit.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in