Archived
tests: the served dashboard bytes get hashed from outside
dashboard_page.h is the Node build of dashboard/, committed because the engine's build has no Node. The ctest dashboard_page compares dashboard/'s sources against the digest recorded INSIDE that header -- which proves the sources and the header's own claim agree, nothing more. Rewrite the header and its embedded digest together and the check passes while the engine serves a page nobody built from these sources. artifact_sums.sh hashes the artifact itself from outside, the mechanical half vendor/SHA256SUMS is to vendor/UPSTREAM: tests/ARTIFACTS names every committed built artifact and its hash, and a lone tamper of a served byte now fails. A rebuild re-records the manifest in the same commit. The residual gap -- a single commit rewriting an artifact AND the manifest -- is exactly the vendor-tree gap, and documented as such.
This commit is contained in:
1 parent
70be48c6fa
commit
4c9a79ca98
4 files changed
+39
No files matched your search
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# artifact_sums.sh -- checks committed built artifacts against tests/ARTIFACTS.
|
||||
#
|
||||
# Some committed files are not sources but a build of sources: core/server/dashboard_page.h is a
|
||||
# Node build of dashboard/, committed because the engine's build has no Node. The digest recorded
|
||||
# INSIDE such an artifact proves only that the sources and the artifact's own claim agree --
|
||||
# tampering with the artifact together with its embedded digest reads as an honest build. This
|
||||
# manifest hashes the artifact itself from outside, the mechanical half that vendor/SHA256SUMS is
|
||||
# to vendor/UPSTREAM: the dashboard_page test keeps sources and header in step, this one checks
|
||||
# the served bytes. (A tamper that updates the artifact and this manifest in one breath remains,
|
||||
# exactly as with a vendor file -- the manifest is against drift and lone tampering, not against
|
||||
# a commit that rewrites the whole record.)
|
||||
#
|
||||
# tests/artifact_sums.sh <repo-root>
|
||||
#
|
||||
# When an artifact is rebuilt for real, re-record it in the same commit:
|
||||
# sha256sum $(awk '{print $2}' tests/ARTIFACTS) > tests/ARTIFACTS
|
||||
set -e
|
||||
root=${1:?usage: artifact_sums.sh <repo-root>}
|
||||
cd "$root"
|
||||
command -v sha256sum >/dev/null || { echo "artifact_sums: sha256sum is required" >&2; exit 1; }
|
||||
[ -f tests/ARTIFACTS ] || { echo "artifact_sums: tests/ARTIFACTS is missing" >&2; exit 1; }
|
||||
sha256sum -c --status tests/ARTIFACTS || {
|
||||
echo "artifact_sums: a committed artifact differs from its recorded hash;" \
|
||||
"run sha256sum -c tests/ARTIFACTS to see which" >&2
|
||||
exit 1; }
|
||||
echo "artifact_sums: $(wc -l < tests/ARTIFACTS) artifact(s), every hash matches"
|
||||
Reference in new issue
Block a user