Skip to content

Fix security_scan remote/VM checksum module require failure - #226

Merged
jasperf merged 1 commit into
mainfrom
fix/security-scan-remote-checksum-require
Sep 10, 2026
Merged

Fix security_scan remote/VM checksum module require failure#226
jasperf merged 1 commit into
mainfrom
fix/security-scan-remote-checksum-require

Conversation

@jasperf

@jasperf jasperf commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

v5.22.0's checksum-verification module broke security_scan for every remote (SSH) and Trellis-VM site. Both scanners pull the module in via:

require_once dirname(__FILE__) . '/checksum-verify.php';

That only resolves when PHP runs the scanner file directly off disk. security_scan's remote and VM paths instead stream the scanner source over php /dev/stdin (by design — nothing is ever written to disk on the remote host), where __FILE__ resolves to a pipe/fd path with no real sibling directory. Every remote or VM scan since 5.22.0 fails with:

Fatal error: Uncaught Error: Failed opening required '.../checksum-verify.php'

Confirmed live against a production site over SSH.

Fix

securityScan.ts now inlines checksum-verify.php's source in place of that require_once line before streaming the scanner over stdin, so the piped script is fully self-contained. Local scans (localPath, or running a scanner file directly) were never affected and need no change.

Testing

No test harness exists for mcp-server yet, so this was verified by reproducing the exact failure mode directly: piping both the original and the patched scanner source into php /dev/stdin <path> (matching what runRemote/runVm actually do). The original source fails with the same "Failed opening required" error reported from production; the patched source runs the full checksum + pattern-scan flow with no error.

Fixes the regression from #225 / v5.22.0.

The checksum-verification module added in v5.22.0 is pulled in via
require_once dirname(__FILE__) . '/checksum-verify.php', which only
resolves when PHP runs the scanner file directly off disk.
security_scan's remote (SSH) and Trellis-VM paths instead stream the
scanner source over `php /dev/stdin`, where __FILE__ resolves to a
pipe/fd path with no real sibling directory, so every remote or VM
scan failed with:

  Fatal error: Uncaught Error: Failed opening required
  '.../checksum-verify.php'

Inline the module's source in place of that require_once line before
streaming, so the piped script is self-contained. Local scans
(localPath, or running the scanner file directly) were unaffected and
need no change.

Reproduced and verified the fix by piping both the original and
patched scanner source into `php /dev/stdin` directly, matching what
runRemote/runVm actually do.
@jasperf
jasperf merged commit fbb9efa into main Sep 10, 2026
1 check passed
@jasperf
jasperf deleted the fix/security-scan-remote-checksum-require branch September 10, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant