Skip to content

Commit 01e1d24

Browse files
lroolleclaude
andcommitted
fix: trace state through docker exec, Makefile pin, CA warnings
Review findings on #422: - persistent containers: docker exec now passes DEVA_TRACE=0/1 explicitly every attach — exec env overrides creation-time env, so --trace works on an existing container and a non-traced attach un-trusts a previously installed CA - Makefile CCTRACE_VERSION ?= pin bumped to 0.11.0 (it overrides the Dockerfile default on the make build path) - setup_trace_ca: warn instead of silently swallowing update-ca-certificates failures; chmod 644 the installed cert; success log only on actual success Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 6216c0d commit 01e1d24

6 files changed

Lines changed: 21 additions & 6 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DELTA_VERSION ?= 0.19.2
3131
TMUX_VERSION ?= 3.6a
3232
TMUX_SHA256 ?= b6d8d9c76585db8ef5fa00d4931902fa4b8cbe8166f528f44fc403961a3f3759
3333
CLAUDE_CODE_VERSION ?= 2.1.143
34-
CCTRACE_VERSION ?= 0.4.0
34+
CCTRACE_VERSION ?= 0.11.0
3535
CODEX_VERSION ?= 0.131.0
3636
GEMINI_CLI_VERSION ?= 0.42.0
3737
GROK_CLI_VERSION ?= 0.2.93

agents/claude.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ agent_prepare() {
5050
# DEVA_TRACE=1 tells the entrypoint to install the cctrace MITM CA
5151
# into the container system trust store (#414)
5252
DOCKER_ARGS+=("-e" "DEVA_TRACE=1")
53+
DEVA_TRACE_ACTIVE=true
5354
AGENT_COMMAND=("cctrace" "--no-open" "--")
5455
if [ "$has_dangerously" = false ]; then
5556
AGENT_COMMAND+=("--dangerously-skip-permissions")

agents/codex.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ agent_prepare() {
9393
# cctrace codex profile: codex args go after "--"; always mitm.
9494
# DEVA_TRACE=1 installs the MITM CA into the container store (#414).
9595
DOCKER_ARGS+=("-e" "DEVA_TRACE=1")
96+
DEVA_TRACE_ACTIVE=true
9697
AGENT_COMMAND=("cctrace" "codex" "--no-open" "--" "${AGENT_COMMAND[@]:1}")
9798
fi
9899

agents/grok.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ agent_prepare() {
4141
# cctrace grok profile: grok args go after "--"; always mitm.
4242
# DEVA_TRACE=1 installs the MITM CA into the container store (#414).
4343
DOCKER_ARGS+=("-e" "DEVA_TRACE=1")
44+
DEVA_TRACE_ACTIVE=true
4445
AGENT_COMMAND=("cctrace" "grok" "--no-open" "--" "${AGENT_COMMAND[@]:1}")
4546
fi
4647

deva.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,11 +3684,17 @@ if [ "$EPHEMERAL_MODE" = false ]; then
36843684
update_session_file
36853685
fi
36863686
3687+
# docker exec env overrides the container's creation-time env: pass the
3688+
# trace state explicitly so --trace works on an existing container and a
3689+
# non-traced attach un-trusts the CA installed by an earlier traced run.
3690+
_trace_env="DEVA_TRACE=0"
3691+
[ "${DEVA_TRACE_ACTIVE:-false}" = true ] && _trace_env="DEVA_TRACE=1"
3692+
36873693
if [ "$AUTH_PROVISION_MODE" = true ]; then
3688-
docker exec "${DOCKER_TERMINAL_ARGS[@]}" "$CONTAINER_NAME" /usr/local/bin/docker-entrypoint.sh "${AGENT_COMMAND[@]}" || true
3694+
docker exec -e "$_trace_env" "${DOCKER_TERMINAL_ARGS[@]}" "$CONTAINER_NAME" /usr/local/bin/docker-entrypoint.sh "${AGENT_COMMAND[@]}" || true
36893695
finish_auth_provision
36903696
else
3691-
exec docker exec "${DOCKER_TERMINAL_ARGS[@]}" "$CONTAINER_NAME" /usr/local/bin/docker-entrypoint.sh "${AGENT_COMMAND[@]}"
3697+
exec docker exec -e "$_trace_env" "${DOCKER_TERMINAL_ARGS[@]}" "$CONTAINER_NAME" /usr/local/bin/docker-entrypoint.sh "${AGENT_COMMAND[@]}"
36923698
fi
36933699
else
36943700
echo "Launching ${ACTIVE_AGENT} (ephemeral mode) via $(docker_image_ref)"

docker-entrypoint.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ setup_trace_ca() {
343343
if [ "${DEVA_TRACE:-}" != "1" ]; then
344344
if [ -f "$crt" ]; then
345345
rm -f "$crt"
346-
update-ca-certificates >/dev/null 2>&1 || true
346+
if ! update-ca-certificates >/dev/null 2>&1; then
347+
echo "[entrypoint] warning: trust-store update failed; cctrace MITM CA may still be trusted" >&2
348+
fi
347349
fi
348350
return 0
349351
fi
@@ -363,8 +365,12 @@ setup_trace_ca() {
363365
fi
364366

365367
cp "$ca_path" "$crt"
366-
update-ca-certificates >/dev/null 2>&1 || true
367-
[ "$VERBOSE" = "true" ] && echo "[entrypoint] cctrace MITM CA trusted container-wide: $crt"
368+
chmod 644 "$crt"
369+
if update-ca-certificates >/dev/null 2>&1; then
370+
[ "$VERBOSE" = "true" ] && echo "[entrypoint] cctrace MITM CA trusted container-wide: $crt"
371+
else
372+
echo "[entrypoint] warning: trust-store update failed; container-wide CA trust incomplete (cctrace env-scoped trust still applies)" >&2
373+
fi
368374
return 0
369375
}
370376

0 commit comments

Comments
 (0)