# Security and privacy

## Privacy: what DevWorkspace does and does not do

- **Local only.** The CLI makes no network requests and sends nothing anywhere. There is **no telemetry**.
- **What it reads:** directory listings; `package.json`-style manifests and lockfile names; dependency files (`pyproject.toml`, `requirements*.txt`, `Pipfile`, `Cargo.toml` workspace section, `pnpm-workspace.yaml`); `.gitignore`/`.devworkspaceignore`; its own `.devworkspace/` files; Claude Code settings files and skill directories (to detect plugins); and Git state via read-only Git commands. It hashes files you cite as evidence for facts.
- **What it stores:** counts, names of detected frameworks, the testing contract, relative file paths, hashes and the knowledge you or the agent record. Not source code.
- **What it ignores:** `.git`, `node_modules`, build output, caches, virtual environments, anything in `.gitignore` or `.devworkspaceignore`, symlinks, and files over the size limits. Binary files are skipped.
- **Important:** the generated prompts cause *your chosen AI agent* to read repository content. DevWorkspace cannot control what that agent's provider does with it. Review your agent's data policy.

Ignore precedence: hard-coded skip list (always) → root and nested `.gitignore` → `.devworkspaceignore` (root). Credential files are never *read* regardless of ignore rules, and are listed by name only.

## Secrets

- Sensitive files (`.env`, `.env.*` except `.example/.sample/.template/.dist`, `*.pem`, `*.key`, `*.p12`, `id_rsa*`, `credentials.*`, `secrets.*`, `.npmrc`, `*.tfvars`, service-account JSON, …) are **never read**. `safeReadText` is the only way analysis reads repository text and it refuses them.
- Every write path (facts, tasks, decisions, sessions, export) rejects text matching credential patterns (private keys, AWS/GitHub/Slack/npm/OpenAI-style tokens, JWTs, URLs with embedded credentials, `password=…`-style assignments). Logs are redacted.
- Patterns are heuristic. They reduce risk; they are not a guarantee. `doctor` re-scans `.devworkspace/` and warns if a credential-like file is **tracked by Git**.

## Prompt injection

Repository files are untrusted data. The installed instructions and every generated prompt state that source, comments, READMEs, docs, fixtures, test data and generated content are things to inspect, never instructions, and cannot override the user, system instructions, security policy or DevWorkspace's rules. DevWorkspace does not copy README/comment prose into prompts (a test checks that attacker text in a fixture never appears in generated output). This reduces the attack surface but cannot make a model immune; keep the agent's tool permissions sensible.

## Filesystem safety

- Paths from imports/knowledge are validated: no absolute paths, `..`, backslashes, NUL, Windows-reserved characters or trailing dots/spaces; writes re-resolve inside the workspace and refuse symlink escapes.
- Writes are atomic (temp file → fsync → rename). Mutating commands hold an advisory lock. Interrupted runs leave the previous file intact; `doctor` reports leftover `.tmp` files.
- Nothing deletes user files. `doctor --fix` only *creates* missing folders/ignore rules.
- `export` refuses to run if the workspace contains secret-like values. `import` validates **everything** (format, schema version, path allow-list, size, secrets, JSON validity) before writing anything, never replaces `project.json`, and never overwrites differing local files unless `--overwrite` (with backups).

## Subprocesses

`git` (read-only) and, during `setup --integrations`, the installers (`uv`, `pipx`, `python -m pip`, `graphify`, `claude`) are executed with argument arrays and `shell: false`, with timeouts and output caps. Windows `.cmd` shims are run only through a validated `cmd.exe` call that rejects arguments containing shell metacharacters. Repository scripts are never run by DevWorkspace.

## Installing third-party tools

`setup --integrations` can install a Python tool (per user), register Claude Code plugins and, as a fallback, run a registry package (`npx skills`). Each step has a consent level and only project-local steps run without `--yes`. Existing `CLAUDE.md`, `.claude/settings*.json`, `AGENTS.md` and skills are snapshotted and verified after every step, and restored on damage. Claude Code's own plugin installer is never given `-y`. The Skills CLI is run with `DISABLE_TELEMETRY=1` and `DO_NOT_TRACK=1`; its other behaviour is its own. Tool output is scrubbed of secrets and absolute paths before it is shown or stored. Plugins and Graphify hooks run code on your machine: review what you approve.

## Git safety

DevWorkspace issues only read-only Git commands. The generated instructions require `git status` before edits, protection of uncommitted changes, and forbid `git reset --hard`, `git clean -fd`, force-push and branch deletion without explicit user authorisation.

## Supply chain

Zero runtime dependencies. Dev-only tools (TypeScript, Vitest, ESLint) are pinned by `package-lock.json`; CI runs `npm audit`. Release publishing uses an explicit manual trigger with npm provenance (see [contributing](contributing.md)).

## Reporting vulnerabilities

Open a private security advisory on the repository (once published). Do not file public issues containing exploit details or real secrets.
