Commit 5e0323d
fix(daemon): value-redact secrets in Gemini/NanoBot/OpenCode provider output (#10)
The daemon runs provider CLIs in full-access mode with the daemon's env
(via buildProviderEnv, which spreads process.env), so secret-named vars
such as provider API keys are present in the spawned process. Task prompts
are workspace-member-controlled, so a prompted provider can echo a secret
into its stdout/stderr, which then flows back via task output / error
diagnostics / streamed callbacks.
The agent-router execution path (claude, codex, openclaw, hermes) already
scrubs secret values from stdout/stderr with buildRedactions/redactText
(agent-router/subprocess.ts). The direct provider-runtime paths did not:
- runGeminiProviderTask (gemini)
- execProviderCommand, the shared helper used by runNanoBotProviderTask
(nanobot) and runOpenCodeProviderTask (opencode)
These accumulated raw stdout/stderr and, for execProviderCommand, forwarded
raw chunks to the external onStdout/onStderr callbacks. The legacy
sanitizeDiagnosticText only catches recognizable shapes (KEY=value, sk-…,
Bearer …, URL params), so a bare secret value leaked.
Apply the same value-based redaction to these paths via a buildProviderRedactions
helper, and forward the redacted chunks to external callbacks. This brings
gemini/nanobot/opencode to parity with the agent-router providers.
runCodexProviderTaskAttempt / runClaudeProviderTask are left untouched:
runProviderTask routes claude and codex through the agent-router, so those
direct functions are currently unreached.
Adds a Gemini regression test that echoes a bare secret value to stdout and
asserts the returned output is redacted. Verified it fails without the fix
and passes with it. No new test regressions (3 pre-existing resume-session
test failures also fail on main).
Co-authored-by: Test User <test@example.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7f14a1a commit 5e0323d
2 files changed
Lines changed: 61 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1295 | 1295 | | |
1296 | 1296 | | |
1297 | 1297 | | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1298 | 1329 | | |
1299 | 1330 | | |
1300 | 1331 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
1624 | 1625 | | |
1625 | 1626 | | |
1626 | 1627 | | |
| 1628 | + | |
| 1629 | + | |
1627 | 1630 | | |
1628 | 1631 | | |
1629 | 1632 | | |
1630 | 1633 | | |
1631 | | - | |
| 1634 | + | |
1632 | 1635 | | |
1633 | | - | |
| 1636 | + | |
| 1637 | + | |
1634 | 1638 | | |
1635 | 1639 | | |
1636 | 1640 | | |
| |||
1656 | 1660 | | |
1657 | 1661 | | |
1658 | 1662 | | |
1659 | | - | |
| 1663 | + | |
1660 | 1664 | | |
1661 | 1665 | | |
1662 | 1666 | | |
| |||
1871 | 1875 | | |
1872 | 1876 | | |
1873 | 1877 | | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
1874 | 1892 | | |
1875 | 1893 | | |
1876 | 1894 | | |
| |||
1913 | 1931 | | |
1914 | 1932 | | |
1915 | 1933 | | |
| 1934 | + | |
| 1935 | + | |
1916 | 1936 | | |
1917 | 1937 | | |
1918 | 1938 | | |
1919 | 1939 | | |
1920 | 1940 | | |
1921 | 1941 | | |
1922 | | - | |
| 1942 | + | |
1923 | 1943 | | |
1924 | | - | |
1925 | | - | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1926 | 1947 | | |
1927 | 1948 | | |
1928 | | - | |
1929 | | - | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
1930 | 1952 | | |
1931 | 1953 | | |
1932 | 1954 | | |
| |||
0 commit comments