#22713: Security: extend env var blocklist — add GLIBC_TUNABLES, JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, LD_AUDIT, OPENCLAW_ prefix (#22681)
size: XS
## Summary
Extends `host-env-security-policy.json` to block four additional environment variables that can be used for code injection or dynamic linker hijacking, plus the `OPENCLAW_` prefix to prevent behavior modification via environment.
## Missing variables added
| Variable | Risk |
|----------|------|
| `GLIBC_TUNABLES` | glibc dynamic linker behavior modification — code injection vector |
| `JAVA_TOOL_OPTIONS` | JVM options injection for all Java invocations |
| `JDK_JAVA_OPTIONS` | Java 9+ equivalent of `JAVA_TOOL_OPTIONS` |
| `LD_AUDIT` | Dynamic linker audit library loading |
## Prefix added
- `OPENCLAW_` — prevents user-provided env from modifying OpenClaw's own behavior via env vars
## Attack vector (from issue #22681)
Even with `exec` in allowlist mode, an attacker who can influence environment variables could inject:
```bash
GLIBC_TUNABLES=glibc.tune.hwcaps=-AVX512F some_command
JAVA_TOOL_OPTIONS=-Djava.security.manager=... java_app
```
## Testing
- [x] JSON is valid
- [ ] Lightly tested — change is additive only; no existing keys modified
Fixes #22681
AI-assisted: drafted with Claude (Prometheus/OpenClaw agent), reviewed and verified by author.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added four dangerous environment variables (`GLIBC_TUNABLES`, `JAVA_TOOL_OPTIONS`, `JDK_JAVA_OPTIONS`, `LD_AUDIT`) and the `OPENCLAW_` prefix to the security blocklist to prevent code injection and dynamic linker hijacking attacks.
**Critical Issue Found:**
- The Swift file `apps/macos/Sources/OpenClaw/HostEnvSanitizer.swift` was not updated alongside the JSON policy file. The parity test `src/infra/host-env-security.policy-parity.test.ts` will fail because it enforces synchronization between these two files.
<h3>Confidence Score: 1/5</h3>
- This PR cannot be merged because the macOS Swift implementation is out of sync with the JSON policy
- The security policy changes are valid and address real attack vectors, but the PR is incomplete. The Swift file `HostEnvSanitizer.swift` must be updated to match the JSON policy, otherwise the parity test will fail and the macOS app will have inconsistent security protections compared to the Node.js implementation.
- `apps/macos/Sources/OpenClaw/HostEnvSanitizer.swift` requires immediate attention — must be updated to match the JSON policy changes
<sub>Last reviewed commit: a787b28</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22756: fix(security): add missing entries to environment variable blocklist
by miloudbelarebia · 2026-02-21
92.5%
#8139: fix(config): block dangerous environment variables from config.env
by yubrew · 2026-02-03
80.3%
#8161: fix(sandbox): block dangerous environment variables from Docker con...
by yubrew · 2026-02-03
78.1%
#9200: Fix: Strip dangerous env vars from baseEnv in host execution
by vishaltandale00 · 2026-02-05
76.7%
#21668: fix(config): block dangerous environment variable keys from config ...
by AI-Reviewer-QS · 2026-02-20
75.9%
#15757: feat(security): add hardening gap audit checks
by saurabhsh5 · 2026-02-13
75.9%
#11439: fix(security): warn on relative OPENCLAW_CONFIG_PATH and disable co...
by coygeek · 2026-02-07
74.0%
#23574: security: P0 critical remediation — plugin sandbox, password hashin...
by lumeleopard001 · 2026-02-22
73.3%
#11435: fix(security): validate OPENCLAW_BROWSER_CONTROL_MODULE before dyna...
by coygeek · 2026-02-07
73.2%
#17273: feat: add security-guard extension — agentic safety guardrails
by miloudbelarebia · 2026-02-15
73.0%