fix: keep node systemd gateway tokens out of units#78044
Conversation
Remove file-backed managed systemd environment keys from .bak units during restage so upgrades from inline-token units do not preserve leaked gateway tokens. Add regression coverage for restaging over a vulnerable unit while preserving unrelated environment entries.
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. for source-level reproduction: current main copies Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this PR or an equivalent narrow fix once redacted Linux user-systemd proof shows the node gateway token only in the owner-only env file and stale unit/backups sanitized. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main copies Is this the best way to solve the issue? Yes: using the existing What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 0ad3d25fb7cd. |
|
Another PR #84815 was merged to fix my issue. Closing this PR. |
Summary
Environment=lines.OPENCLAW_GATEWAY_TOKENis written to the existing owner-only service env file..bakunit backups during re-stage or upgrade.Linked Issue
Security Impact
The change moves the node daemon gateway token from a readable unit-file inline environment entry into the existing
0600service env file path. Non-secret service environment values remain inline, and stale managed token values are removed when the current install omits them.Tests
OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/commands/node-daemon-install-helpers.test.ts src/daemon/systemd.test.tspnpm exec oxfmt --check --threads=1 src/commands/node-daemon-install-helpers.ts src/commands/node-daemon-install-helpers.test.ts src/cli/node-cli/daemon.ts src/daemon/node-service.ts src/daemon/systemd.ts src/daemon/systemd.test.ts docs/cli/node.md CHANGELOG.mdpnpm exec oxlint src/ && pnpm build && pnpm check && pnpm testStage 4 completed with
passed_with_baseline_failures:pnpm buildandpnpm checkpassed; lint and test failures were classified as pre-existing baseline failures with 0 new failures.Notes
7188e4f4ad87a51a11d3dc3c7909fd79ea01d6e9.v2026.5.4before publish.