You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Avoid evaluating Bitwarden secret values as shell code in drain wrapper #12261
infra/github-backup/systemd/drain-wrapper.sh:23-35 fetches the Worker URL and bearer from Bitwarden, then runs eval over Python output built with repr():
Python string repr() is not shell escaping. A value containing both quote types can make the generated shell statement execute injected syntax. This was reproduced in an isolated wrapper harness using fabricated secret data; the command executed with the wrapper's user privileges. The existing wrapper tests (infra/github-backup/tests/test_drain_wrapper.py) exercise only simple values such as https://worker.invalid and stub-bearer, so they miss this boundary case.
Impact
A malicious or accidentally malformed Bitwarden value can execute arbitrary shell commands whenever the systemd drain wrapper runs, before drain_queue.py starts. This affects the host account running the backup service. No real credentials or external services were used in reproduction.
Suggested fix
Do not feed Python repr() output to eval. Pass values to the child process without shell interpretation, or emit values using a shell-specific quoting function and add regression tests containing quotes and shell metacharacters that assert no command execution and exact environment round-tripping.
Related: #12260 (scheduled suggestions pass that found this issue).
Picked up by scheduled lane oc-code-03 (worker repo-worker-code). Revalidating the reported shell-evaluation issue and routing a bounded fix; triage only, no implementation in this task.
Triage verified: the current wrapper still runs Python repr() output through eval. In an isolated temporary harness, a fabricated value containing shell command substitution created a marker file, confirming command execution; no real credentials or external services were used. The existing test suite passes (21 checks) but covers only simple values. Routed the bounded fix to queue task 20935: remove shell interpretation and add a hostile-value round-trip/no-execution regression, scoped to the wrapper and its tests.
Parked pending CI on PR #12262: CodeRabbit is still in progress (Proof check was skipped). Resume by checking PR checks fresh; merge only after required checks are green. Local targeted test passes 24/24.
Resumed parked task 20935. Fresh GitHub verification: issue #12261 remains OPEN with no hard-stop labels; canonical PR #12262 remains OPEN against main, CLEAN/mergeable, with CodeRabbit SUCCESS and Proof SKIPPED. Diff is limited to the drain wrapper and regression tests. Preserved worktree /home/user/git/fleet/20935, branch queue/20935-12261-drain-wrapper. Targeted test passed: python3 infra/github-backup/tests/test_drain_wrapper.py — 24 checks, 0 failed. Next: fresh revalidation and merge.
Activity
developing-today commentedon Nov 21, 2026
CODE-4463
dezren39 commentedon Nov 21, 2026
Picked up by scheduled lane oc-code-03 (worker repo-worker-code). Revalidating the reported shell-evaluation issue and routing a bounded fix; triage only, no implementation in this task.
dezren39 commentedon Nov 21, 2026
Triage verified: the current wrapper still runs Python repr() output through eval. In an isolated temporary harness, a fabricated value containing shell command substitution created a marker file, confirming command execution; no real credentials or external services were used. The existing test suite passes (21 checks) but covers only simple values. Routed the bounded fix to queue task 20935: remove shell interpretation and add a hostile-value round-trip/no-execution regression, scoped to the wrapper and its tests.
8 remaining items
dezren39 commentedon Nov 21, 2026
Parked pending CI on PR #12262: CodeRabbit is still in progress (Proof check was skipped). Resume by checking PR checks fresh; merge only after required checks are green. Local targeted test passes 24/24.
dezren39 commentedon Nov 21, 2026
agent-note:v1
state: picked_up
task: 20935
lane: oc-code-08 (OpenChamber scheduled lane, worker repo-worker-code)
stage: claimed -> targeted_tests_passed
Resumed parked task 20935. Fresh GitHub verification: issue #12261 remains OPEN with no hard-stop labels; canonical PR #12262 remains OPEN against main, CLEAN/mergeable, with CodeRabbit SUCCESS and Proof SKIPPED. Diff is limited to the drain wrapper and regression tests. Preserved worktree /home/user/git/fleet/20935, branch queue/20935-12261-drain-wrapper. Targeted test passed: python3 infra/github-backup/tests/test_drain_wrapper.py — 24 checks, 0 failed. Next: fresh revalidation and merge.
dezren39 commentedon Nov 21, 2026
agent-note:v1
state: done
task: 20935
lane: oc-code-08 (OpenChamber scheduled lane, worker repo-worker-code)
PR #12262 merged (bb62c06); issue #12261 is CLOSED. Targeted regression suite passed: python3 infra/github-backup/tests/test_drain_wrapper.py — 24 checks, 0 failed, including exact hostile-secret round-trip and no command execution. CI: CodeRabbit SUCCESS; Proof SKIPPED. Sandbox backlog/sweep bookkeeping deferred to fleet reconciliation.