You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[sec-check] Command-safety regex checks in toolapprove/security.go have easy, non-adversarial bypasses #157
toolapprove/security.go's DefaultSecurityScanner.Scan runs two hardcoded
regexes as a command-safety check ahead of tool execution: destructiveCmdRe
(mkfs / dd / fork-bomb) and credentialExfilRe (reading or printing
credential material). Unlike the rm case, which is decided by a real
shell-aware analyzer (analyzeRmCommand in shellrm.go, exercised by dozens
of quoting/escaping/variable-expansion test cases), these two checks are
plain substring/regex matches with only a single happy-path test each
(coverage_test.go:TestScanFlagsCredentialExfil, one case; the destructive
test in security_command_test.go never exercised a dd-to-block-device
form). That made both easy to slip past with ordinary, non-exotic command
forms - nothing adversarial-looking is required:
dd destructiveness was checked only via dd if=/dev/zero. Writing
garbage onto a raw block device with a different input source bypassed
it entirely: dd if=/dev/urandom of=/dev/sda, or even dd if=image.iso of=/dev/sda (no /dev/zero anywhere).
credentialExfilRe required the literal substrings cat ~/.ssh/, cat /var/run/secrets/, printenv .*TOKEN, echo $GH_TOKEN or echo $GITHUB_TOKEN with no quoting. Ordinary, unremarkable variants all
bypassed it:
echo "$GH_TOKEN" (double-quoted - the common way to print a variable)
cat $HOME/.ssh/id_rsa or cat /root/.ssh/id_rsa (no ~)
less ~/.ssh/id_rsa, head ~/.ssh/id_rsa, base64 ~/.ssh/id_rsa (any
reader other than cat)
Impact
A tool-approval gate that an agent, or an agent acting on injected
instructions, can route around with everyday shell syntax is not much of a
gate. The practical risk is credential disclosure (SSH keys, the
Kubernetes service-account token, GH_TOKEN/GITHUB_TOKEN) and destructive
disk writes going through "clean scan" instead of being flagged, in a
project whose stated purpose is a "tamper-evident, governed" agent runtime.
Recommendation
Widen both regexes to cover the bypasses above: match dd with a of=/dev/(sd|hd|vd|xvd|nvme)... block-device target regardless of if=,
and make the credential-exfil pattern tolerant of quoting ("$VAR", '$VAR', ${VAR}), $HOME/${HOME}//root in place of ~, and common
alternate readers (less, more, head, tail, tac, base64, xxd, od, strings). This remains a heuristic, not a full shell parser - bare env/printenv dumps and variable indirection still pass by design, to
avoid false-positives on routine environment inspection - but it closes the
non-adversarial gaps above and adds the bypass-focused test coverage the rm path already has.
A hive agent asked to open a pull request that would close this issue, but it is already claimed by Danathar. No PR was opened; the owner decides whether to proceed.
Fixed by hivecommons/hive#19092, merged to v5 (96856329). It widens the command-safety checks to cover every bypass listed here: dd to a block device from any input, quoted GH_TOKEN and GITHUB_TOKEN, $HOME and /root paths, and the alternate file readers, with tests. This repo's toolapprove/security.go is byte-identical to hive v5 after the sync at 96856329 (blob e47364ce on both). Closing by hand because the fix merged in a different repository.
Activity
hivecommons-hive commentedon Nov 18, 2026
🔓 Claim by @Danathar released (lease revoked).
Claim history
Danathar(contributor on hive hosted-available-oke-11-placeholder-r05x)Danathar(contributor; lease revoked)hivecommons-hive commentedon Nov 18, 2026
A hive agent asked to claim this issue, but it is already claimed by Danathar. The claim was not recorded; the owner decides whether to proceed.
hivecommons-hive commentedon Nov 18, 2026
A hive agent asked to open a pull request that would close this issue, but it is already claimed by Danathar. No PR was opened; the owner decides whether to proceed.
clubanderson commentedon Nov 18, 2026
Fixed by hivecommons/hive#19092, merged to v5 (96856329). It widens the command-safety checks to cover every bypass listed here: dd to a block device from any input, quoted GH_TOKEN and GITHUB_TOKEN, $HOME and /root paths, and the alternate file readers, with tests. This repo's toolapprove/security.go is byte-identical to hive v5 after the sync at 96856329 (blob e47364ce on both). Closing by hand because the fix merged in a different repository.