#16523: fix(security): audit falsely flags dangerous commands in denyCommands (#16508)
stale
size: XS
trusted-contributor
Cluster:
OpenClaw Plugin Enhancements
## Summary
`security audit --deep` flags entries like `camera.snap`, `screen.record`, `sms.send` in `gateway.nodes.denyCommands` as "unknown command names" — but these are real commands defined in `DEFAULT_DANGEROUS_NODE_COMMANDS`. Users adding them to their deny list get a false warning that creates confusion about whether their config is actually working.
Closes #16508
lobster-biscuit
## Root Cause
`listKnownNodeCommands` in `audit-extra.sync.ts` builds the known command set by iterating platform default allowlists via `resolveNodeCommandAllowlist`. But dangerous commands (`camera.snap`, `camera.clip`, `screen.record`, `calendar.add`, `contacts.add`, `reminders.add`, `sms.send`) aren't in any platform's defaults — they're opt-in via `allowCommands`. So the audit doesn't recognize them as valid names.
## Changes
- Before: denying `camera.snap` triggers `gateway.nodes.deny_commands_ineffective` warning
- After: dangerous commands are recognized as valid, only truly unknown names get flagged
## Tests
- `audit.test.ts` — new test with all 7 dangerous commands in `denyCommands`, confirms no false warning. Fails before fix, passes after.
- All 158 tests in `src/security/` pass
- `pnpm build && pnpm check` pass
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed false positive audit warnings when denying dangerous commands like `camera.snap`, `screen.record`, and `sms.send`. The audit's `listKnownNodeCommands` function now recognizes `DEFAULT_DANGEROUS_NODE_COMMANDS` as valid command names, eliminating confusion about whether deny list configurations are working correctly.
Changes:
- Added `DEFAULT_DANGEROUS_NODE_COMMANDS` to the known command set in `listKnownNodeCommands`
- Added comprehensive test covering all 7 dangerous commands to verify they're recognized as valid
<h3>Confidence Score: 5/5</h3>
- Safe to merge - surgical fix that correctly addresses the root cause with appropriate test coverage
- The fix is minimal and precisely targets the issue: dangerous commands weren't included in the audit's known command set despite being valid. The solution simply adds them to the set after iterating platform defaults. Test coverage includes all 7 dangerous commands and verifies the warning is not triggered.
- No files require special attention
<sub>Last reviewed commit: 8aef653</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16525: fix(shell): stop rejecting newlines in double-quoted args (#16470)
by yinghaosang · 2026-02-14
74.2%
#19690: fix: security audit suppression, MoE false positive, and hook prefi...
by adityuhkapoor · 2026-02-18
73.9%
#15794: docs(security): comprehensive security audit report
by kinder-world · 2026-02-13
73.3%
#15757: feat(security): add hardening gap audit checks
by saurabhsh5 · 2026-02-13
73.0%
#16320: security: harden default tool policies and secure shell execution
by SuccessSoham · 2026-02-14
72.8%
#23280: fix(control-ui): remove stale allowInsecureAuth suggestion from err...
by anillBhoi · 2026-02-22
72.0%
#16907: fix(security): detect obfuscated commands that bypass allowlist fil...
by CornBrother0x · 2026-02-15
71.6%
#11132: fix(telegram): guard command menu overflow and doctor warnings
by kiminbean · 2026-02-07
71.5%
#22711: fix: post-compaction audit skips non-existent required files
by taw0002 · 2026-02-21
71.4%
#7007: Fix security audit false-positive for symlinked state dir
by MohammadErfan-Jabbari · 2026-02-02
71.3%