whp-scan-scope with the 2000 MiB limit and the review fixes (unreadable
files, control characters, >= 1023-byte paths and web-root links into
the skipped mail tree refused by name). Verified: full build through the
fetch path with a token secret (token in no layer, history, inspect or
build log), tests/run-tests.sh and tests/image-scope-test.sh ALL PASS on
the built image.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
It was logged as a WARN and dropped from the report: a web-root link
into a Maildir (x.php -> ../mail/<d>/<u>/cur/<msg>) got the message
listed as the link's target, and an infected message vanished from what
privd sees. Now fatal (the message is still never moved out of the
Maildir). whp-scan-scope (WHP #334) refuses such links by name as well.
Tests: relative, absolute and chained web-root links to an EICAR message
(red on the pre-review script with the pre-review tool), and a listed
mail-tree hit (red on the pre-review script).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
- GO_IMAGE was the floating tag golang:1.27-alpine: now pinned to the
index digest sha256:70bd7dde... (resolved 2026-11-22).
- The WHP fetch passed the token on git's command line
(-c http.extraHeader=...$(cat secret)): now a credential helper reads the
BuildKit secret file at fetch time (GIT_TERMINAL_PROMPT=0). Verified on a
local build: the token is in no layer blob, not in docker history, not in
docker inspect, not in /whp/.git/config, not in the build log.
- CI passed CI_TOKEN (registry push rights) as whp_token: now the repo
secret WHP_READ_TOKEN (a read-only token for cloud-hosting-platform/whp,
to be created by an admin); the workflow fails at its first step with a
clear error while it is not set.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
Review of the scan-scope change (measured on ClamAV 1.4.6 in this image):
- clamscan exits 1, not 2, when one listed file is infected and another
cannot be read: only the summary says "Total errors: 1". A mode-000
webshell next to any detected file went unscanned and the run passed
(privd accepted the attestation, require_scan_scope=true included).
Now: a summary with Total errors > 0, or no summary at all, fails the run.
- Every hit line must name an EXACT entry of the scan list (the last ": "
ends the path; signature names never contain one); anything else fails
the run instead of being skipped.
- The list itself is checked before clamscan sees it: each entry a plain
absolute path below the extract, <= 1022 bytes, no control character,
and exactly files_scanned entries.
- A hit that cannot be moved to quarantine fails the run (it used to log a
WARN and leave the infected file in the tree to be imported). Duplicate
hits (a link target listed twice) are one action.
- Tests: names with ': ' + ' FOUND', leading '-', \n, \r, >= 1023 bytes;
rogue hit, Total errors, no summary, unquarantinable hit, list longer
than files_scanned, entry outside the extract (red on the old script);
image-scope-test.sh runs a mode-000 file next to EICAR end to end.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
- Dockerfile: multi-stage Go build of whp-scan-scope (CGO off, stdlib only) from a PINNED
commit of the WHP repo (ARG WHP_COMMIT, currently the merge of WHP #331; bump it to the merge
of the 2000 MiB limit PR before publishing an image meant to enforce it). Private repo: the
BuildKit secret whp_token in CI; --build-context whp-src=<checkout> for local builds.
- scan-files.php: whp-scan-scope -> /tmp/scan.list + stats, then clamscan --file-list with
--max-filesize=2000M --max-scansize=4000M --max-scantime=0 --alert-exceeds-max=yes --tempdir on
the disk scratch. A missing/failing tool, clamscan exit >= 2 or 0 loaded signatures is FATAL
(no fall back to an unscoped scan). Writes the attestation (the tool's stats + engine_version,
signature_db_version, signatures_loaded, clamscan_exit).
- entrypoint.sh: passes --attestation/--scratch, removes the scratch, embeds the attestation as
report.json "scan" (objects kept as objects).
- Tests: tests/run-tests.sh (stub clamscan, real tool, fail-closed cases), tests/build-scope-tree.sh
(polyglot, web-root symlink, docroot under tmp, handler dir, uploads, EICAR, sparse 2001 MiB mp4),
tests/image-scope-test.sh (end to end on the built image; CI runs it).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6