Skip to content

fix(security): Credential injection file path allowlist (#183) - #207

Merged
vybe merged 1 commit into
mainfrom
fix/183-credential-inject-allowlist
Mar 27, 2026
Merged

fix(security): Credential injection file path allowlist (#183)#207
vybe merged 1 commit into
mainfrom
fix/183-credential-inject-allowlist

Conversation

@vybe

@vybe vybe commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds strict file path allowlist ({.env, .mcp.json, .mcp.json.template, .credentials.enc}) to the credential injection endpoint, blocking arbitrary file writes inside agent containers
  • Enforced at both backend (rejects before forwarding) and agent (defense in depth) layers
  • Closes pentest finding 3.2.6 (CVSS 4.8 Medium) — previously any authenticated owner could write attacker-controlled content to any path within /home/developer/

Test plan

  • Reproduced pentest PoC (/hello/anyfile.html) — confirmed blocked with HTTP 400
  • Verified legitimate .env injection still succeeds
  • Verified path traversal (../../etc/passwd) blocked
  • Verified config overwrite (CLAUDE.md, .bashrc) blocked
  • 20 unit tests passing (tests/unit/test_credential_inject_allowlist.py)
  • Rebuild base image to deploy agent-side fix to new containers

Closes #183

🤖 Generated with Claude Code

…rary file writes (#183)

Add strict allowlist validation to POST /api/agents/{name}/credentials/inject
so only known credential files (.env, .mcp.json, .mcp.json.template,
.credentials.enc) can be written. Previously any authenticated owner could
write attacker-controlled content to arbitrary paths inside the agent
container (pentest finding 3.2.6, CVSS 4.8).

Defense in depth: allowlist enforced at both backend and agent layers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SEC: Arbitrary File Write via Credential Injection Parameter Tampering

1 participant