Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"CHECKPOINT_DISABLE": "1",
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
"ANONYMIZED_TELEMETRY": "false",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DISABLE_TELEMETRY": "1",
"GOTELEMETRY": "off",
"PIP_DISABLE_PIP_VERSION_CHECK": "1",
Expand Down
1 change: 0 additions & 1 deletion .devcontainer/image/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"CHECKPOINT_DISABLE": "1",
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
"ANONYMIZED_TELEMETRY": "false",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DISABLE_TELEMETRY": "1",
"GOTELEMETRY": "off",
"PIP_DISABLE_PIP_VERSION_CHECK": "1",
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ All code authored in or evaluated by DevOps CLI must strictly adhere to the foll

Before its first tool runs, a review checks that the host can start the sandbox: bubblewrap and `prlimit` are installed, and bubblewrap can make a sandbox. On Ubuntu 24.04 and later, AppArmor refuses unprivileged user namespaces to a program that has no profile with the `userns` rule (`kernel.apparmor_restrict_unprivileged_userns`). A host that fails the check fails closed: no tool runs, in the sandbox or outside it, each scan reports a coverage gap with the cause, and the review says the cause and what a person can change on the host one time. The record is read before the tool starts. Under the `direct` executor, a tool that fetches its rules during the run, such as Trivy with an old cache, may use newer rules than the record names, and Ruff also applies a config file above the tree and its user config file, which the record does not name.
8. **Repository Hygiene**: Never write an internal hostname (`*.lan`, `*.local`, a machine name), a private address (RFC 1918), a private registry, a non-standard NodePort, a device or mount path, or the cluster topology into a committed file. Use `<storage-node>`, `<gpu-node>`, `<worker-node>` or `<host>` for a host, RFC 5737 blocks (`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`) or loopback for an address, `ghcr.io/<org>/<image>:<tag>` for a registry and `<storage-mount-path>` for a path. Committed templates (`config.example.yaml`) use localhost endpoints. The user's `config.yaml` is not committed: never reset its URLs or ports. `tests/invariants/test_committed_addresses.py` holds this rule for addresses and `.lan` hosts. It parses each tracked file with `ipaddress` and fails on an RFC 1918 host address or a `.lan` host. A range in CIDR form names no machine, and the upstream defaults and examples that the test names (the minikube node, the AKS DNS service, the OpenTelemetry `server.address` example) are not ours, so both pass. Test code, which must hold private addresses to test the egress and reference classifiers, the archived OpenSpec changes and `CHANGELOG.md`, which release-please writes, are outside its scope.
9. **No Phone-Home**: Turn off third-party telemetry, usage reports, crash analytics and update checks in every tool, workload and container when the user loses no function. Examples are `DO_NOT_TRACK=1`, `GOTELEMETRY=off`, `PIP_DISABLE_PIP_VERSION_CHECK=1`, `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`, `HF_HUB_DISABLE_TELEMETRY=1` and `OPENSPEC_TELEMETRY=0`. Ask the user before you turn off a feature that shows content, such as update notices or a marketplace.
9. **No Phone-Home**: Turn off third-party telemetry, usage reports, crash analytics and update checks in every tool, workload and container when the user loses no function. Examples are `DO_NOT_TRACK=1`, `GOTELEMETRY=off`, `PIP_DISABLE_PIP_VERSION_CHECK=1`, `HF_HUB_DISABLE_TELEMETRY=1` and `OPENSPEC_TELEMETRY=0`. Ask the user before you turn off a feature that shows content, such as update notices or a marketplace.
10. **Bounded Error Detail**: Cap each external value in an exception `details` dictionary or a structured log at 256 characters (CWE-209, CWE-400).
11. **MCP Tool Inputs**: A URL or host that a model gives to an MCP tool is untrusted input, not configuration. A tool publishes no option for it, and queries the service that the configuration names. `_PATH_PARAM_RESTRICTIONS` in `src/devops_cli/ai/mcp/generator.py` sets the options that a tool publishes. A credential goes only to the origin that the configuration names, whatever the egress level is. `_key_for` in `src/devops_cli/ai/gateway.py` applies this rule to the AI API key. A tool that publishes such an option is a defect. A file path that a model gives is untrusted input too: a tool publishes no option for a path that the command writes or reads, unless a path helper confines the path (`safe_resolve_subpath` in `src/devops_cli/core/paths.py`).

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schema: spec-driven
created: 2026-11-01
skip_specs: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Design

## Context

`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` was previously added to `.devcontainer/devcontainer.json`, `.devcontainer/image/devcontainer.json`, and `src/devops_cli/templates/devcontainer.json.j2` under the assumption that it served only as a telemetry opt-out variable. However, in Claude Code, setting this variable to `1` disables all non-essential traffic, which includes remote web sessions and update checks. Rule 9 of `SECURITY.md` specifies that non-essential traffic and telemetry should be turned off only when the user loses no function.

## Decisions

### 1. Remove `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` from container environments

Remove the variable from `.devcontainer/devcontainer.json`, `.devcontainer/image/devcontainer.json`, and `src/devops_cli/templates/devcontainer.json.j2`. This restores remote session capabilities for Claude Code in the devcontainer while keeping other telemetry opt-out variables (`DO_NOT_TRACK`, `HF_HUB_DISABLE_TELEMETRY`, `DOTNET_CLI_TELEMETRY_OPTOUT`, `GOTELEMETRY`, `PIP_DISABLE_PIP_VERSION_CHECK`) intact.

### 2. Update telemetry tests to assert absence

Update `tests/core/test_third_party_telemetry.py` to:
- Remove `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` from the expected environment tuples.
- Explicitly assert `assert "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" not in env` across workspace, image, and template tests to prevent accidental reintroduction.

### 3. Update security policy documentation

Update `SECURITY.md` item 9 to remove `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` from the list of example telemetry opt-out variables.

## Risks / Trade-offs

- **Claude Code nonessential traffic**: Without this variable, Claude Code may check for updates and emit default analytics unless configured otherwise at the tool or user level. This is an accepted trade-off to allow remote sessions and interactive features to function.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Proposal

## Why

Issue #3122: In the devcontainer environment, `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set to `"1"`. Anthropic's Claude Code uses this variable to disable nonessential network traffic, including remote web sessions and update checks. This setting prevents remote sessions and other remote connectivity in the devcontainer environment.

## What Changes

- Remove `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` from `containerEnv` in `.devcontainer/devcontainer.json`.
- Remove `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` from `containerEnv` in `.devcontainer/image/devcontainer.json`.
- Remove `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` from `containerEnv` in `src/devops_cli/templates/devcontainer.json.j2`.
- Update the telemetry opt-out examples in `SECURITY.md` to omit this variable.
- Update `tests/core/test_third_party_telemetry.py` to assert that `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is not set in devcontainer configurations or the template.
- The change sets `skip_specs: true` in `.openspec.yaml`. It alters no behavior a consumer observes: no `devops` command, option, message, manifest or service changes.
- This change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

None.

## Impact

- Devcontainer configuration: `.devcontainer/devcontainer.json`, `.devcontainer/image/devcontainer.json`, and `src/devops_cli/templates/devcontainer.json.j2`.
- Documentation: `SECURITY.md`.
- Tests: `tests/core/test_third_party_telemetry.py`.

## Feasibility

- Upstream Claude Code documentation specifies that `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` disables non-essential traffic such as telemetry, automatic update checks, and remote terminal connections.
- Command output: `uv run devops ci fail-to-pass --base origin/main` confirms that 3 tests in `tests/core/test_third_party_telemetry.py` fail on the base tree where the variable is set and pass when it is removed.
- Fast checks and static analysis pass cleanly via `uv run devops ci devcontainer`, `uv run devops ci lint`, and `uv run devops ci typecheck`.

## Existing Tool Considered

Dev Containers configuration specification (<https://containers.dev/implementors/json_reference/>) provides `containerEnv` for container-level environment variables. No custom code or wrapper is required. The change removes the variable from existing JSON configurations and templates. It builds nothing and deletes no internal code.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tasks

## 1. Remove CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC

- [x] 1.1 Update `tests/core/test_third_party_telemetry.py` to assert that `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is omitted from container environments
- Verification: `uv run devops ci fail-to-pass --base origin/main`
- [x] 1.2 Remove the variable from `.devcontainer/devcontainer.json`
- Verification: `uv run devops ci devcontainer`
- [x] 1.3 Remove the variable from `.devcontainer/image/devcontainer.json`
- Verification: `uv run pytest tests/core/test_third_party_telemetry.py -k test_devcontainer_image_disables_telemetry`
- [x] 1.4 Remove the variable from `src/devops_cli/templates/devcontainer.json.j2`
- Verification: `uv run pytest tests/core/test_third_party_telemetry.py -k test_a_rendered_devcontainer_template_omits_claude_code_nonessential_traffic`
- [x] 1.5 Update telemetry opt-out examples in `SECURITY.md`
- Verification: `git grep "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"`

## 2. Verification and static checks

- [x] 2.1 Verify fail-to-pass against base tree
- Verification: `uv run devops ci fail-to-pass --base origin/main`
- [x] 2.2 Run lint, format, typecheck, and telemetry tests
- Verification: `uv run devops ci lint && uv run devops ci format --check && uv run devops ci typecheck && uv run pytest tests/core/test_third_party_telemetry.py`

## Workflow follow-up

- Pending a person: rebuild devcontainer to confirm remote sessions work without restriction.
1 change: 0 additions & 1 deletion src/devops_cli/templates/devcontainer.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"CHECKPOINT_DISABLE": "1",
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
"ANONYMIZED_TELEMETRY": "false",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DISABLE_TELEMETRY": "1",
"GOTELEMETRY": "off",
"PIP_DISABLE_PIP_VERSION_CHECK": "1",
Expand Down
12 changes: 8 additions & 4 deletions tests/core/test_third_party_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def test_devcontainer_disables_telemetry() -> None:
env.get("CHECKPOINT_DISABLE"),
env.get("DOTNET_CLI_TELEMETRY_OPTOUT"),
env.get("ANONYMIZED_TELEMETRY"),
env.get("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"),
env.get("DISABLE_TELEMETRY"),
env.get("GOTELEMETRY"),
env.get("PIP_DISABLE_PIP_VERSION_CHECK"),
Expand All @@ -192,7 +191,6 @@ def test_devcontainer_disables_telemetry() -> None:
"1",
"false",
"1",
"1",
"off",
"1",
"false",
Expand All @@ -201,6 +199,7 @@ def test_devcontainer_disables_telemetry() -> None:
"false",
)
assert actual_env == expected_env
assert "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" not in env

vscode_settings = data.get("customizations", {}).get("vscode", {}).get("settings", {})
actual_settings = (
Expand All @@ -227,7 +226,6 @@ def test_devcontainer_image_disables_telemetry() -> None:
env.get("CHECKPOINT_DISABLE"),
env.get("DOTNET_CLI_TELEMETRY_OPTOUT"),
env.get("ANONYMIZED_TELEMETRY"),
env.get("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"),
env.get("DISABLE_TELEMETRY"),
env.get("GOTELEMETRY"),
env.get("PIP_DISABLE_PIP_VERSION_CHECK"),
Expand All @@ -245,7 +243,6 @@ def test_devcontainer_image_disables_telemetry() -> None:
"1",
"false",
"1",
"1",
"off",
"1",
"false",
Expand All @@ -254,6 +251,7 @@ def test_devcontainer_image_disables_telemetry() -> None:
"false",
)
assert actual_env == expected_env
assert "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" not in env


def _rendered_devcontainer_template() -> dict[str, Any]:
Expand All @@ -272,6 +270,12 @@ def _rendered_devcontainer_template() -> dict[str, Any]:
return rendered


def test_a_rendered_devcontainer_template_omits_claude_code_nonessential_traffic() -> None:
"""The devcontainer template omits CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC so remote sessions work."""
env = _rendered_devcontainer_template()["containerEnv"]
assert "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" not in env


@pytest.mark.parametrize(
"source",
["this-repository", "image-configuration", "scaffolded-template"],
Expand Down
Loading