The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
security: pin Vector checksums in-repo; publish the SDK only from tags (#813)
Justin D'Souzacd38acc9da1c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 086d8169..ec6e8d78 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -681,7 +681,7 @@ jobs:id: vector-cachewith:path: cli/beacon/release-vector- key: release-vector-${{ hashFiles('packaging/linux/fetch-vector.sh') }}+ key: release-vector-${{ hashFiles('packaging/linux/fetch-vector.sh', 'packaging/vector/*') }}- name: Download Vector for the Linux packagesif: steps.vector-cache.outputs.cache-hit != 'true'run: sh packaging/linux/fetch-vector.shdiff --git a/.github/workflows/npm-publish-sdk.yml b/.github/workflows/npm-publish-sdk.ymlindex 31047068..a6ce1b78 100644--- a/.github/workflows/npm-publish-sdk.yml+++ b/.github/workflows/npm-publish-sdk.yml@@ -17,7 +17,20 @@ permissions:jobs:publish:runs-on: ubuntu-latest+ # The protection that holds against a rewritten workflow: the npm-publish environment allows+ # deployments only from sdk-js-v* tags, and npm's trusted publisher for @asymptote/sdk requires+ # this environment. A branch that drops this line gets no token npm accepts; one that keeps it+ # is refused by GitHub before the job starts.+ environment: npm-publishsteps:+ - name: Require an SDK release tag+ # Catches an accidental dispatch from a branch, before any branch code is installed with+ # id-token: write. It is not the security boundary: workflow_dispatch runs the workflow+ # file from the dispatched ref, which can omit this step. The environment above is.+ if: github.ref_type != 'tag' || !startsWith(github.ref_name, 'sdk-js-v')+ run: |+ echo "npm publish runs only from an sdk-js-v* tag (got ${GITHUB_REF})" >&2+ exit 1- uses: actions/checkout@v4- uses: actions/setup-node@v4with:@@ -39,7 +52,6 @@ jobs:working-directory: packages/asymptote-sdk-jsrun: npm ci- name: Verify tag matches SDK version- if: startsWith(github.ref, 'refs/tags/')working-directory: packages/asymptote-sdk-jsshell: bashrun: |diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 3751b704..ba65b61b 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -118,7 +118,8 @@ jobs:run: |set -euo pipefailmkdir -p dist/vector- curl -fsSLO "https://packages.timber.io/vector/${VECTOR_VERSION}/vector-${VECTOR_VERSION}-SHA256SUMS"+ # Checked against checksums pinned in the repository, not a file from the download host.+ cp "packaging/vector/vector-${VECTOR_VERSION}-SHA256SUMS" .for ARCH in $BEACON_PKG_ARCHES; docase "$ARCH" inarm64) VECTOR_ARCH="arm64" ;;diff --git a/CLAUDE.md b/CLAUDE.mdindex 74c12565..3d4b3a87 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -327,7 +327,7 @@ separate Vector install.The Linux `.deb`, `.rpm`, and release archives carry Vector too. Run`sh packaging/linux/fetch-vector.sh` before GoReleaser: it downloads the static-(musl) build for both arches, checks it against Vector's published checksums and+(musl) build for both arches, checks it against the checksums pinned in `packaging/vector/` (never a file from the download host) andfor a program interpreter, and stages it under `cli/beacon/release-vector/`. TheGoReleaser before-hook fails without it. The packages install it as`/opt/beacon/bin/vector`; the archives carry it as `beacon-vector`, which thediff --git a/beacon-sandbox/image/image_test.go b/beacon-sandbox/image/image_test.goindex 9e406804..2b560fbf 100644--- a/beacon-sandbox/image/image_test.go+++ b/beacon-sandbox/image/image_test.go@@ -691,3 +691,21 @@ func TestBuildInstallsTheBundledVectorOnlyWhenAsked(t *testing.T) {t.Errorf("the layer must end by running Vector, so a bad binary fails the build:\n%s", layer)}}++// The release packages check Vector against packaging/vector/, and this image against+// VectorSHA256. Both must name the same archive, or i04 tests a Vector the packages do not ship;+// a Vector bump that updates one pin and not the other fails here.+func TestVectorPinMatchesTheReleasePin(t *testing.T) {+ path := filepath.Join("..", "..", "packaging", "vector", "vector-"+VectorVersion+"-SHA256SUMS")+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatalf("the release pins no checksums for Vector %s: %v", VectorVersion, err)+ }+ want := VectorSHA256 + " vector-" + VectorVersion + "-x86_64-unknown-linux-musl.tar.gz"+ for _, line := range strings.Split(string(data), "\n") {+ if strings.TrimSpace(line) == want {+ return+ }+ }+ t.Fatalf("%s has no line %q:\n%s", path, want, data)+}diff --git a/packaging/linux/fetch-vector.sh b/packaging/linux/fetch-vector.shindex 326f1cab..713b6df3 100755--- a/packaging/linux/fetch-vector.sh+++ b/packaging/linux/fetch-vector.sh@@ -19,6 +19,11 @@# expanding the ${VAR:-default} form, and 0.58 stops expanding ${VAR} at all unless Vector runs# with --dangerously-allow-env-var-interpolation. (Beacon Cloud's connect is unaffected because# it writes literal values.)+#+# The archives are checked against packaging/vector/vector-<version>-SHA256SUMS, committed in this+# repository, not against a checksum file fetched from the same host as the archives: the binary+# is signed into Beacon's packages and runs as the root forwarder, so a compromised download host+# must not be able to supply both. A new version needs its pinned checksums committed first.set -euVECTOR_VERSION="${VECTOR_VERSION:-0.56.0}"@@ -42,7 +47,9 @@ fiwork="$(mktemp -d)"trap 'rm -rf "$work"' EXIT INT TERMsums="vector-${VECTOR_VERSION}-SHA256SUMS"-curl -fsSL --retry 3 -o "$work/$sums" "$BASE_URL/$sums"+pinned="$ROOT_DIR/packaging/vector/$sums"+[ -f "$pinned" ] || { echo "fetch-vector: no pinned checksums at $pinned; commit them for Vector $VECTOR_VERSION first" >&2; exit 1; }+cp "$pinned" "$work/$sums"for arch in $ARCHES; docase "$arch" in@@ -53,7 +60,7 @@ for arch in $ARCHES; doarchive="vector-${VECTOR_VERSION}-${triple}.tar.gz"curl -fsSL --retry 3 -o "$work/$archive" "$BASE_URL/$archive"line="$(awk -v a="$archive" '$2 == a { print }' "$work/$sums")"- [ -n "$line" ] || { echo "fetch-vector: no checksum for $archive in $sums" >&2; exit 1; }+ [ -n "$line" ] || { echo "fetch-vector: no pinned checksum for $archive in $pinned" >&2; exit 1; }(cd "$work" && printf '%s\n' "$line" | sha256_check)mkdir -p "$work/$arch"diff --git a/packaging/vector/vector-0.56.0-SHA256SUMS b/packaging/vector/vector-0.56.0-SHA256SUMSnew file mode 100644index 00000000..cd12000d--- /dev/null+++ b/packaging/vector/vector-0.56.0-SHA256SUMS@@ -0,0 +1,3 @@+afa383a264e7ab373dac68281cd86fb808f8447bb3813c08b5b0baaae0314a05 vector-0.56.0-aarch64-unknown-linux-musl.tar.gz+9aa8b6772d7c887734d38c84eb721d3a067e08a4aa4dc0dcc809365da242ec16 vector-0.56.0-arm64-apple-darwin.tar.gz+8c114c5e9fd9646516f014d5d837690447cf0d4f43ba4a3746713bc0612b039b vector-0.56.0-x86_64-unknown-linux-musl.tar.gz