diff --git a/Dockerfile b/Dockerfile index 183f8cb..87993ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,6 +102,30 @@ RUN set -eux; \ if [ "$commit" != "$SQLMAP_COMMIT" ]; then echo "sqlmap commit mismatch: want $SQLMAP_COMMIT got $commit" >&2; exit 1; fi; \ rm -rf /opt/sqlmap/.git +# -------------------------------------------------------- nuclei templates --- +# nuclei ships no templates in the binary: on first run it clones +# projectdiscovery/nuclei-templates into $HOME/nuclei-templates. Where the process +# cannot reach github.com that install fails softly — it logs "nuclei-templates are +# not installed, installing...", then "no templates found in path", and exits 0, so a +# scan starts with an empty template set and looks like a broken tool. That is the +# normal case behind an egress allowlist, and the case for every agent-run scan: the +# executor's HOME is /app/data/exec-home, not the root-owned home the image is +# built with. Bake the set at a fixed path instead, and point nuclei at it with +# NUCLEI_TEMPLATES_DIR in the runtime stage, so the lookup does not depend on HOME or +# on which user the process runs as. Tag and commit are both pinned and asserted: a +# moved tag fails the build rather than silently changing the template set. +ARG NUCLEI_TEMPLATES_VERSION=v10.5.1 +ARG NUCLEI_TEMPLATES_COMMIT=79fb682760ab3d5b0e22afbb44709353cbebf023 +RUN set -eux; \ + git clone --quiet --depth 1 --branch "$NUCLEI_TEMPLATES_VERSION" \ + https://github.com/projectdiscovery/nuclei-templates /opt/nuclei-templates; \ + commit="$(git -C /opt/nuclei-templates rev-parse HEAD)"; \ + if [ "$commit" != "$NUCLEI_TEMPLATES_COMMIT" ]; then echo "nuclei-templates commit mismatch: want $NUCLEI_TEMPLATES_COMMIT got $commit" >&2; exit 1; fi; \ + rm -rf /opt/nuclei-templates/.git; \ + count="$(find /opt/nuclei-templates -name '*.yaml' | wc -l)"; \ + echo "baked nuclei templates: $count"; \ + test "$count" -gt 10000 + # ---------------------------------------------------------------- runtime --- FROM python:3.12-slim-bookworm ARG TARGETARCH @@ -131,13 +155,22 @@ RUN set -eux; \ tar -xJf "/tmp/$asset" -C /usr/local --strip-components=1 --no-same-owner; \ rm -f "/tmp/$asset" /tmp/SHASUMS256.txt; \ node --version; npm --version -# Pinned, checksum-verified recon binaries and the sqlmap checkout from the tools stage. +# Pinned, checksum-verified recon binaries and the sqlmap checkout from the tools stage, +# plus the baked nuclei template set (see the tools stage for why it is baked). COPY --from=tools /out/ /usr/local/bin/ COPY --from=tools /opt/sqlmap /opt/sqlmap +COPY --from=tools /opt/nuclei-templates /opt/nuclei-templates +# Read by nuclei in preference to $HOME/nuclei-templates, so root and the executor +# resolve the same set. The directory stays root-owned and world-readable; scans +# never need to write to it. +ENV NUCLEI_TEMPLATES_DIR=/opt/nuclei-templates RUN set -eux; \ ln -s /opt/sqlmap/sqlmap.py /usr/local/bin/sqlmap; \ nuclei -version >/dev/null; httpx -version; subfinder -version; katana -version; \ - ffuf -V >/dev/null; dalfox --version >/dev/null; sqlmap --version >/dev/null + ffuf -V >/dev/null; dalfox --version >/dev/null; sqlmap --version >/dev/null; \ + templates="$(nuclei -tl -silent | wc -l)"; \ + echo "nuclei templates visible at build time: $templates"; \ + test "$templates" -gt 10000 # bbot recursive recon orchestrator (#117): blacklanternsecurity/bbot, AGPL-3.0 # (same license as ARTEX; standalone CLI dependency, not linked code). Pinned