Block the whole standard library in agent-config code references
fix: block the whole standard library in agent-config code references
Block the whole standard library in agent-config code referencesa16f6d-fix-block-the-whole-standard-library-in-cve-2026-79696fixblock whole standard library agent config
Committed by wukath
commit message
fix: block the whole standard library in agent-config code references
The denylist for YAML code references named dangerous standard library modules
one by one, so anything it missed stayed reachable: it had `profile` but not
`cProfile`, `pdb` but not `bdb`, `trace`, `timeit` or `pydoc`. Several of those
execute a string you hand them and need no constructor `args`, so naming one as
a tool or callback slipped past both existing mitigations and ran arbitrary
code.
Block the standard library outright via `sys.stdlib_module_names`. Configs only
ever name the agent's own package, `google.adk`, or a third-party integration,
so nothing legitimate breaks and the list stops needing a revisit every Python
release. The explicit denylist stays for names that are no longer reported as
standard library but remain importable, such as `distutils` and CPython's
`test` packages.
A denylist still cannot cover third-party packages, which the loader resolves
by name, so this narrows the surface rather than closing it.
Co-authored-by: Kathy Wu <[email protected]>
PiperOrigin-RevId: 961151524Editor assessment
This commit patches CVE-2026-79696. Excellent body. It explains why the per-module denylist failed - it named profile but not cProfile, pdb but not bdb, and missed trace, timeit and pydoc, several of which execute a string without constructor args - and then describes the switch to sys.stdlib_module_names, the retained denylist for distutils/test, and the residual third-party gap. Clear, honest and teaching. A scope is the only optional improvement. Structurally the message is clean and the body is well separated; a scope is the only formal addition that would improve an otherwise strong explanation.