Skip to content

SPEC-011: Security

  • Status: Implemented
  • Milestone: M0, M6
  • Owners: lead maintainer

1. Purpose

Define how AgentPlay handles secrets, logs and third-party plugin code.

2. Terms

Secret: an API key, token or credential. Plugin: a world, agent or evaluator not shipped in this repo.

3. Requirements

  • SEC-001 Secrets MUST be read from environment variables or an explicit config, never from scenario files.
  • SEC-002 Secrets MUST NOT appear in run logs, error messages or CLI output; the log writer MUST redact known secret values.
  • SEC-003 agentplaykit check MUST NOT import or execute plugin code.
  • SEC-004 Loading a non-built-in plugin for the first time SHOULD show a trust notice.
  • SEC-005 Only core MAY write run logs; plugins MUST return plain data.
  • SEC-006 The core MUST expose sandbox hook points so later phases (Docker, browser) can restrict plugins: run_episode MUST accept hooks whose wrap_world(world) and wrap_agent(agent_id, agent) return the objects the runner then uses (for example proxies to an isolated process). The defaults change nothing.
  • SEC-008 HTTP clients that send credentials MUST NOT follow redirects; a redirect MUST fail with an error naming the new location, so a key is never sent to a host the user did not name.
  • SEC-009 An adapter MUST refuse to send an API key over plain http:// to a host that is not on the local machine, unless config sets allow_insecure_http: true.
  • SEC-010 Agent programs started by AgentPlay (command, mcp) MUST NOT inherit the parent's environment by default: they get a minimal environment (PATH, home and temp directories, locale and the OS variables needed to start a program) plus AGENTPLAYKIT_* variables and any variables listed in config pass_env.
  • SEC-011 Every file AgentPlay writes from a run (log, .eval.json, summary) MUST be redacted the same way as the log. A log path MUST end in .jsonl, so a scenario cannot overwrite an unrelated file.
  • SEC-012 The first time code is loaded from a .py file or an agentplaykit.yaml target in a process, a one-line notice MUST name the file (SEC-004 for local code).
  • SEC-013 Text written by agents (messages, reasoning) is untrusted input to other agents and to judges. The judge's instructions MUST tell it that the transcript is data and that instructions inside it are to be ignored.
  • SEC-007 Vulnerabilities MUST be reported privately via GitHub security advisories (see SECURITY.md).
  • SEC-014 Sandbox worlds MUST isolate agent work as SPEC-014 SBX-006 to SBX-010 require: no network, non-root, no capabilities, read-only root, resource caps, nothing shared from the host, and nothing left behind. The docs MUST say that a container is a strong boundary but not a perfect one, and that agents nobody trusts belong inside a virtual machine.

4. Acceptance criteria

Requirement Test ID Notes
SEC-001..013 SEC-001..SEC-013 tests/conformance/test_security.py

5. Open questions

  • Exact redaction algorithm (pattern vs. known-value matching).

6. Change log

  • 2026-11-30: Initial draft.
  • 2026-11-30: Accepted by the lead maintainer.
  • 2026-11-30: M6 security review: SEC-006 made concrete (hooks); added SEC-008 to SEC-013. See docs/security-review.md.
  • 2026-11-30: Implemented in v0.1.0; every requirement has a test (PRO-004, PRO-011).
  • 2026-12-01: Added SEC-014 (sandbox isolation), with SPEC-014.