[Fix] Keep node systemd tokens out of unit files#84408
Conversation
d6b81e6 to
8f96eb2
Compare
|
Codex review: needs maintainer review before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. Source inspection on current main shows the node token is included in service environment without file-backed metadata and the systemd renderer emits environment values inline; I did not run a local install path in this read-only review. PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this PR after normal CI and maintainer review, then use it as the canonical fix for #78043 and supersede #78044. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows the node token is included in service environment without file-backed metadata and the systemd renderer emits environment values inline; I did not run a local install path in this read-only review. Is this the best way to solve the issue? Yes. The PR uses the existing environment-source contract instead of adding a separate token path, adds node-specific env-file ownership, and covers backup sanitization, migration, and uninstall behavior. Label changes:
Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 18a514e39e8b. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6b81e60d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Sunspot Signal Puff Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
Signed-off-by: samzong <samzong.lu@gmail.com>
8f96eb2 to
a137175
Compare
Signed-off-by: samzong <samzong.lu@gmail.com>
|
@clawsweeper merge |
|
@clawsweeper automerge |
|
🦞🔧
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
|
|
ClawSweeper 🐠 reef update Thanks for the work here. GitHub would not let ClawSweeper push to this branch with the available credentials, so the fix moved to a narrow replacement PR. nothing personal, just permission currents. Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
fish notes: model gpt-5.5, reasoning high; reviewed against f626b66. |
Summary
OPENCLAW_GATEWAY_TOKENinline in the generated unit, exposing the token through unit inspection and backups.Environment=directives.node.systemd.env, migrates operator entries from the legacy shared env file, and scrubs only OpenClaw-managed token entries on uninstall.Motivation
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
Behavior addressed:
openclaw node install --forceon Linux user systemd keeps the node gateway token out of the generated unit, writes the current token to an owner-only node env file, migrates operator entries from the old shared systemd env file, and leaves only operator entries after uninstall.Real environment tested: Docker Desktop Linux container running Debian 12 with systemd PID 1 and a real unprivileged user systemd manager (
systemd 252,systemctl --user is-system-running=running, Linux 6.10.14-linuxkit aarch64).Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: The node service was enabled and running under the real user systemd manager. The generated unit referenced
EnvironmentFile=-/home/ocproof/.openclaw/node.systemd.env, did not contain inlineOPENCLAW_GATEWAY_TOKEN, and did not contain the redacted proof token value. The node env file was0600, preserved a legacy operator key fromgateway.systemd.env, replaced the legacy token with the current redacted token, and uninstall removed only the managed token while preserving operator env-file entries.What was not tested: A live gateway connection was not started in the container; the node host stayed running and retried
127.0.0.1:18789, which is sufficient for credential placement, migration, and user-systemd install/uninstall proof.Before evidence (optional but encouraged): Regression tests fail on the old behavior for legacy env-file migration and unlink failure cleanup; the new tests pass after this patch.
Root Cause (if applicable)
Regression Test Plan (if applicable)
src/daemon/systemd.test.ts,src/commands/node-daemon-install-helpers.test.tsnode.systemd.env, are not rendered inline in unit or backup files, preserve/migrate operator env-file entries, and are scrubbed safely during uninstall.User-visible / Behavior Changes
Linux node host systemd units no longer inline
OPENCLAW_GATEWAY_TOKEN; the token is stored in~/.openclaw/node.systemd.envwith0600permissions.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) YesYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: token placement changes from inline unit text to an owner-only env file. The migration preserves operator entries and the real user-systemd proof verifies the unit does not contain the redacted token value.Repro + Verification
Environment
OPENCLAW_GATEWAY_TOKEN=<redacted proof token>Steps
~/.openclaw/gateway.systemd.envwith a redacted old token and an operator key.OPENCLAW_GATEWAY_TOKEN=<redacted proof token> pnpm openclaw node install --force --host 127.0.0.1 --port 18789 --jsonunder an unprivileged user systemd manager.pnpm openclaw node uninstall --jsonand inspect the unit/env-file cleanup markers.Expected
node.systemd.envis0600, contains the current token, and preserves legacy operator entries.Actual
Evidence
Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) YesYes/No) No manual migrationopenclaw node install --forcemigrates operator entries from the legacy shared env file intonode.systemd.envwhile replacing the managed token value.Risks and Mitigations