T09 · Insecure Skill Coding Practices
- Location
references/repo-agent.md:44- Finding
Untrusted Repository Test Execution Without Isolation
- Content
View full analysis
Vulnerability Details
File Location:
references/repo-agent.md:44-59
Vulnerability Type: Arbitrary code execution through untrusted test suites
Risk Level: HighVulnerable Code
bash cd $REPO_PATH # Python if [ -f pytest.ini ] || [ -f pyproject.toml ] || [ -d tests ]; then pytest --tb=short 2>&1 fi # JavaScript/TypeScript if [ -f package.json ]; then npm test 2>&1 || yarn test 2>&1 fi # Go if [ -f go.mod ]; then go test ./... 2>&1 fiTechnical Analysis
The Skill directs the agent to execute test commands from repositories supplied for evaluation. Test execution is not a passive operation:
- Pytest may execute repository-controlled
conftest.py, plugins, imported modules, fixtures, and test collection hooks. npm testandyarn testinvoke repository-controlled package scripts and may trigger lifecycle behavior.go test ./...compiles and runs repository-controlled Go test code.
The workflow does not require a sandbox, container, virtual machine, non-privileged account, read-only mount, network restriction, credential removal, or explicit user confirmation. Consequently, a repository submitted for comparison can cause arbitrary code to run with the permissions and environment of the agent process.
Attack Path
- An attacker creates or modifies a repository that will be evaluated by the Skill.
- The attacker adds a malicious test initialization mechanism, such as:
- Python code in
conftest.py; - a malicious
testscript inpackage.json; or - malicious code in a Go
_test.gofile.
- Python code in
- The repository includes the corresponding marker file, such as
pyproject.toml,package.json, orgo.mod. - The user invokes the Skill to compare that repository with another implementation.
- The Phase 1 agent follows the documented workflow and runs the repository's test command.
- The attacker's code executes with the agent process's filesystem, environment, and network access.
Impact Assessment
...[truncated 642 chars]
- Pytest may execute repository-controlled
- Remediation
View remediation
Remediation Suggestions
- Never execute tests from an untrusted repository directly on the host.
- Run each repository in a fresh disposable container or virtual machine.
- Use a non-root user with no host-level privileges.
- Remove credentials, API tokens, SSH agents, cloud metadata access, and sensitive environment variables.
- Disable outbound networking by default; allow only explicitly required destinations.
- Mount repository source read-only and provide a separate disposable writable workspace.
- Apply strict CPU, memory, process, file-size, and execution-time limits.
- Avoid mounting host sockets or sensitive directories.
- Display the exact command and require explicit user approval before executing repository code.
- If secure isolation is unavailable, perform static inspection only and report that tests were not executed.
