“Install it, then run the audit” sounds like a reasonable dependency policy.
For a Python environment containing a malicious startup hook, that order can give the payload its turn before your audit gets one. Your script might correctly report the problem after the interpreter has already executed it.
The audit still has value. It just isn't preventing first execution. That distinction matters when a frontend demo's Python backend runs on a laptop or CI runner with credentials nearby.
Your script isn't the first code to run
The malicious agent-framework releases 1.26.1 and 1.26.2 added executable .pth startup hooks. During normal site-enabled Python startup, those hooks could load malicious helpers without application code importing agent_framework.
The affected releases were removed from PyPI. The documented collection included environment variables, credential files, other processes' environments where accessible, and cloud or CI identity tokens. The rest of the package could keep working.
A successful application test and an unchanged application diff can coexist with credential theft.
An audit launched through that environment's Python starts behind the same startup boundary. Don't investigate a suspected environment by casually running its interpreter or pip to list packages. Use clean, trusted tooling outside it.
A working demo isn't a vetted environment
Consider a hypothetical evaluation: you want a UI that turns a chat request into an interactive planning form, backed by a Python agent service.
Choose the interaction pattern first. A directory of Generative UI examples, which I maintain, can help with that discovery. A listing is not a review of the dependency bytes you'll install. Nor does this hypothetical Python backend describe the implementation of any listed product.
Now make a separate decision: where can the candidate backend execute, and what could it reach?
“It's only a demo” doesn't answer either question. Neither does “the agent will run the tests.”
Put admission before execution
Here's a proposed policy, not a procedure tested for this article:
| Boundary | Evidence to require | Stop condition |
|---|---|---|
| Acquire and inspect | Use clean tooling outside the candidate environment to record artifact origin, versions and hashes; review package contents and unexpected startup hooks without executing candidate build backends. | Unexplained executable startup behavior, unresolved origin, or acquisition that requires unreviewed code execution. |
| First execution | Define a disposable, restricted environment, synthetic inputs and permitted destinations. Enforce limits on credentials, mounts, process visibility and network access. | Required restrictions cannot be enforced, or the candidate requests broader access. |
| Promote | Rebuild from a clean base using the reviewed inputs, with recorded test scope and separately approved operational permissions. | Evaluation state or unreviewed artifacts would be carried into the promoted environment. |
Static inspection is incomplete. Legitimate packages can contain executable .pth files; finding one is a review trigger, not a malware verdict. Finding none is not a clean bill of health. A lockfile and hash pin identify bytes. They don't establish benign behavior.
A virtualenv separates package installations. It isn't a host, process or network sandbox. An empty set of injected secrets also isn't enough if code can read a mounted home directory, inspect accessible processes, or request workload-identity tokens.
For the planning-form example, start with synthetic data and a mock destination. Don't mount production configuration or grant access to real customer systems just to make the demo convenient. If a real model endpoint is necessary, approve that destination separately and use a narrowly scoped evaluation credential; that credential remains exposed to the evaluated code.
For a concrete mock-versus-real-endpoint example, see set test destinations before delegating to an agent (Japanese). Passing a test doesn't establish that its destination or side effects were authorized. Written instructions alone cannot enforce that boundary.
If you can't establish the restrictions, don't run the candidate there. A promise to inspect the result afterward doesn't repair the ordering.
Cooldowns buy time, not trust
Release-age policies address a different problem: routine automation adopting a fresh artifact before an incident is discovered and the release is removed.
For ordinary dependency bumps, choose and enforce a waiting threshold appropriate to your team's risk. Don't treat elapsed time as certification. A malicious artifact can remain available beyond the threshold, and caches can outlive a registry removal.
Urgent security fixes need a faster route, because waiting has costs too. Make that an explicit, human-reviewed exception with an exact artifact or version, a reason, an owner and an expiry. “Security update” shouldn't become an automatic bypass that approves whatever resolves next.
Keep the exception narrow. It changes the release-age decision; it doesn't waive artifact review or give the evaluation environment production authority.
Once exposed, this is incident response
If either affected release was installed, treat that environment as exposed. Stop using its interpreter for investigation. Contain the environment and preserve relevant external records before cleanup, following your incident-response process.
Inventory reachable credentials and identities with trusted tooling. Rotate or revoke credentials the environment could reach and review relevant CI and cloud activity. Include images, caches and mirrors when tracing where the affected artifacts went; quarantine and rebuilding decisions belong in that response, not an improvised in-place cleanup script.
Downgrading a package doesn't revoke a stolen credential. A green test doesn't undo an outbound request. The advisory's unaffected historical version is not a promise about today's best upgrade target.
For the next evaluation, change the order: inspect from outside, constrain first execution, and grant operational permissions deliberately. The security check can't be your first boundary if it starts after the code you're checking.
Source notes
- GitHub advisory: malicious code in agent-framework — incident baseline for affected versions, startup hooks, credential reach and exposure response.
- Release cooldowns and a Python startup-hook audit — operational walkthrough and audit-order limitations. Its experiments were not reproduced here; its incident account draws on the advisory, not an independent forensic investigation.