-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Security]: GEMINI_API_KEY written as a plaintext literal in the generated systemd service unit #95895
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.securitySecurity documentationSecurity documentation
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.securitySecurity documentationSecurity documentation
Type
Fields
Priority
None yet
Summary
When OpenClaw is configured with a Google/Gemini provider API key and the gateway is installed as a systemd user service via
openclaw gateway install, the generated~/.config/systemd/user/openclaw-gateway.servicecontains the key as a literalEnvironment=GEMINI_API_KEY=*** line. It is not a${VAR}` reference and is not managed via the runtime injection pattern.Every other provider secret in the same file (OpenAI, xAI, Discord tokens, Slack tokens, Brave, GBrain database URL) is handled via
OPENCLAW_SERVICE_MANAGED_ENV_KEYSand resolved at runtime.GEMINI_API_KEYwas not added to this list. It is the only hardcoded secret value in a service file otherwise handled correctly.Reproduction steps
openclaw gateway installto generate the systemd user service.~/.config/systemd/user/openclaw-gateway.service.Environment=GEMINI_API_KEY=<plain…ue>Environment=OPENCLAW_SERVICE_MANAGED_ENV_KEYS=...Expected behavior
GEMINI_API_KEYis included inOPENCLAW_SERVICE_MANAGED_ENV_KEYSalongside OpenAI, xAI, Discord, and all other provider secrets. No plaintext API key values appear in the service file.Actual behavior
GEMINI_API_KEYis the sole hardcoded secret value in the service file. The managed-env runtime injection pattern that handles all other providers was not applied to the Google Gemini key. This exposes the key insystemctl show, process environment dumps, crash reporters, and any tool that reads service definitions.Proposed fix
Add
GEMINI_API_KEYto theOPENCLAW_SERVICE_MANAGED_ENV_KEYSlist in the gateway install path, consistent with how all other provider API keys are handled.Context
~/.config/systemd/user/openclaw-gateway.service