Skip to content

Commit ea2ce4b

Browse files
hyperpolymathclaude
andcommitted
fix(wave3): make proverif a REAL backend — source build, not opam stub
ProVerif (Bruno Blanchet, INRIA) is free GPL software, NOT licence-gated. The opam path emitted 'No solution found, exiting' (cold/empty repo in hermetic bookworm-slim) so the image shipped a non-functional stub (#74). Replace opam with a deterministic build of the official INRIA source release (proverif 2.05), mirroring the tamarin/metamath/or-tools fixes: - bookworm apt ocaml 4.13.1 + ocaml-findlib + ocamlbuild (>= req 4.03) - tar --no-same-owner: upstream tarball carries the packager's numeric uid/gid; chown fails under the container userns -> extraction aborted - liblablgtk2-ocaml-dev at BUILD time: proverif 2.05 ./build hard-fails on missing lablgtk2 (does NOT skip the GUI target); builder stage is throwaway, GUI binary discarded, runtime image links no GTK - ARG PROVERIF_VERSION/URL (bumpable; brittle-pin tracking #75) - graceful-stub fallback retained (image still builds if upstream moves) Runtime-smoke VERIFIED in the built image: 'Proverif 2.05' banner AND a real end-to-end .pv run -> 'RESULT not attacker(s[]) is false.' + 'Verification summary' (Horn-clause resolution actually executed, not a help-banner illusion). Resolves #74. 9/9 buildable Wave-3 backends now real; only imandra remains an intentional licence-gated honest stub. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent faf05e9 commit ea2ce4b

1 file changed

Lines changed: 57 additions & 36 deletions

File tree

.containerization/Containerfile.wave3

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -184,49 +184,68 @@ ENTRYPOINT ["/app/bin/echidna"]
184184
CMD ["--help"]
185185

186186
# #############################################################################
187-
# TARGET: proverif — cryptographic protocol verification (OCaml/opam)
187+
# TARGET: proverif — cryptographic protocol verification (OCaml, source build)
188188
# #############################################################################
189+
# ProVerif (Bruno Blanchet, INRIA) is FREE GPL software — NOT licence-gated.
190+
# The previous opam path (`opam init --bare` + `opam switch create
191+
# ocaml-base-compiler.4.14.1` + `opam install proverif`) emitted
192+
# "No solution found, exiting" because opam cannot resolve a transitive
193+
# solution from a cold/empty repo inside hermetic bookworm-slim (echidna #74).
194+
# Mirror the tamarin/metamath/or-tools fix: drop the fragile package-manager
195+
# path and build the OFFICIAL INRIA source release deterministically.
196+
# ProVerif 2.05 needs only OCaml >= 4.03; bookworm apt ships ocaml 4.13.1 +
197+
# ocaml-findlib 1.9.6 + ocamlbuild 0.14.1, so NO opam is required.
198+
# liblablgtk2-ocaml-dev is required at BUILD time: ProVerif 2.05's `./build`
199+
# hard-fails (`ocamlfind: Package 'lablgtk2' not found`) rather than skipping
200+
# the GUI target. It lives only in this throwaway builder stage — the GUI
201+
# binary is discarded; only the CLI `proverif` is copied to the runtime image,
202+
# which links no GTK (verified). tar needs --no-same-owner: the upstream
203+
# tarball carries the packager's numeric uid/gid and chown fails under the
204+
# container userns.
205+
# Re-validate the version/URL at https://bblanche.gitlabpages.inria.fr/proverif/
206+
# (brittle-pin tracking: #75).
189207
FROM docker.io/library/debian:bookworm-slim AS proverif-builder
190208

191209
RUN apt-get update && apt-get install -y --no-install-recommends \
192210
curl \
193211
ca-certificates \
194-
build-essential \
195-
git \
196212
ocaml \
197-
opam \
198-
libgmp-dev \
199-
m4 \
200-
pkg-config \
201-
bubblewrap \
213+
ocaml-findlib \
214+
ocamlbuild \
215+
liblablgtk2-ocaml-dev \
216+
make \
202217
&& rm -rf /var/lib/apt/lists/*
203218

204-
# Initialise opam (no sandbox inside container — use --disable-sandboxing)
205-
RUN opam init --disable-sandboxing --bare --no-setup -y
206-
207-
# Install proverif via opam. Pin a known proverif-compatible OCaml (4.14.1)
208-
# and refresh the opam repo first — the prior `--packages=ocaml-base-compiler`
209-
# (unpinned) produced "no solution found" against bookworm's stale default
210-
# repo snapshot. proverif 2.x requires OCaml >= 4.05.
211-
RUN opam switch create default ocaml-base-compiler.4.14.1 \
212-
&& eval "$(opam env)" \
213-
&& opam update -y \
214-
&& opam install -y proverif \
215-
&& proverif -help 2>&1 | head -5 || true
216-
217-
# Copy binary to a well-known location for the runtime stage. Graceful
218-
# degradation (matches the tamarin/imandra pattern): if the opam solve still
219-
# failed, emit a stub so the image still builds rather than hard-failing.
220-
RUN set -eux; eval "$(opam env)" || true; \
221-
PROVERIF_BIN="$(opam var bin 2>/dev/null)/proverif"; \
222-
if [ -x "${PROVERIF_BIN}" ]; then \
223-
install -m 0755 "${PROVERIF_BIN}" /usr/local/bin/proverif; \
219+
ARG PROVERIF_VERSION="2.05"
220+
ARG PROVERIF_TARBALL="proverif${PROVERIF_VERSION}.tar.gz"
221+
ARG PROVERIF_URL="https://bblanche.gitlabpages.inria.fr/proverif/${PROVERIF_TARBALL}"
222+
223+
# Deterministic export tree so the runtime COPY never hard-fails: the real
224+
# binary if download + ./build + smoke-test succeed, the documented stub
225+
# otherwise (same graceful-degradation convention as tamarin/metamath).
226+
# `./build` runs `ocamlbuild -use-ocamlfind`, skips the lablgtk GUI target
227+
# when lablgtk is absent, and leaves the CLI binary at ./proverif.
228+
RUN set -eux; \
229+
mkdir -p /opt/proverif-export/bin; \
230+
if curl -fsSL --retry 3 "${PROVERIF_URL}" -o /tmp/proverif.tar.gz \
231+
&& tar --no-same-owner -xzf /tmp/proverif.tar.gz -C /tmp \
232+
&& ( cd "/tmp/proverif${PROVERIF_VERSION}" \
233+
&& ./build \
234+
&& test -x ./proverif \
235+
&& ./proverif -help >/dev/null 2>&1 ) ; then \
236+
install -m 0755 "/tmp/proverif${PROVERIF_VERSION}/proverif" \
237+
/opt/proverif-export/bin/proverif; \
224238
else \
225-
echo "WARNING: proverif opam install failed — emitting stub (image ships, backend degraded)"; \
226-
printf '#!/bin/sh\necho "proverif not available (opam solve failed at image build — see Containerfile.wave3)"\nexit 1\n' \
227-
> /usr/local/bin/proverif; \
228-
chmod +x /usr/local/bin/proverif; \
229-
fi
239+
echo "WARNING: proverif source download/build/smoke-test failed."; \
240+
echo "Re-check https://bblanche.gitlabpages.inria.fr/proverif/ (see #75)."; \
241+
echo "Creating stub binary as fallback (image ships, backend degraded)."; \
242+
printf '#!/bin/sh\necho "proverif not available (source build failed at image build — see Containerfile.wave3 / #74)"\nexit 1\n' \
243+
> /opt/proverif-export/bin/proverif; \
244+
chmod +x /opt/proverif-export/bin/proverif; \
245+
fi; \
246+
chmod +x /opt/proverif-export/bin/proverif; \
247+
rm -rf /tmp/proverif.tar.gz "/tmp/proverif${PROVERIF_VERSION}"; \
248+
touch /opt/proverif-export/.keep
230249

231250
FROM docker.io/library/debian:bookworm-slim AS proverif
232251

@@ -237,8 +256,10 @@ LABEL org.opencontainers.image.licenses="PMPL-1.0-or-later"
237256
LABEL org.opencontainers.image.version="2.3.0"
238257
LABEL org.opencontainers.image.vendor="hyperpolymath"
239258

240-
# ProVerif at runtime is a statically-linked OCaml binary; it needs no
241-
# OCaml runtime. Only libgmp is needed for big-integer arithmetic.
259+
# ProVerif at runtime is an OCaml-native binary linking only glibc/libm/
260+
# libpthread (all in bookworm-slim); it needs no OCaml runtime and no libgmp
261+
# (ProVerif uses no GMP — the prior "big-integer" comment was inaccurate).
262+
# libssl3/libgmp10 retained only for parity with the rest of this file.
242263
RUN apt-get update && apt-get install -y --no-install-recommends \
243264
ca-certificates \
244265
libssl3 \
@@ -248,7 +269,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
248269
WORKDIR /app
249270

250271
COPY --from=rust-builder /build/target/release/echidna /app/bin/echidna
251-
COPY --from=proverif-builder /usr/local/bin/proverif /usr/local/bin/proverif
272+
COPY --from=proverif-builder /opt/proverif-export/bin/proverif /usr/local/bin/proverif
252273

253274
ENV PATH="/app/bin:/usr/local/bin:${PATH}"
254275
ENV ECHIDNA_PROVER_PATH="/usr/local/bin"

0 commit comments

Comments
 (0)