Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

windows: ship Vector in the MSI

shukieshahe5556be940bc
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 22eb0be3..77c6a7a4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -846,6 +846,13 @@ jobs:
if (-not (Test-Path -LiteralPath $produced)) { throw "collector build produced no binary" }
Copy-Item $produced beacon-otelcol.exe
+ # The same pinned build the release ships, checked against packaging/vector/ before it is used.
+ - name: Fetch Vector
+ run: |
+ $vector = pwsh -NoProfile -File packaging\windows\fetch-vector.ps1 -OutDir "$env:RUNNER_TEMP\vector" | Select-Object -Last 1
+ if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $vector)) { throw "fetch-vector.ps1 staged no vector.exe" }
+ "VECTOR_EXE=$vector" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
+
- name: Build two MSIs, so the upgrade path can be exercised
run: |
# Two versions rather than one. Installing over an existing install is a different code path
@@ -858,6 +865,7 @@ jobs:
-BeaconExe cli\beacon\beacon.exe `
-HooksExe cli\beacon-hooks\beacon-hooks.exe `
-CollectorExe collector-builder\beacon-otelcol.exe `
+ -VectorExe $env:VECTOR_EXE `
-OutFile "$env:GITHUB_WORKSPACE\Beacon-$version.msi"
if (-not (Test-Path -LiteralPath "$env:GITHUB_WORKSPACE\Beacon-$version.msi")) {
throw "no MSI was produced for $version"
@@ -907,10 +915,14 @@ jobs:
run: |
$beacon = Join-Path $env:ProgramFiles 'Beacon\bin\beacon.exe'
if (-not (Test-Path -LiteralPath $beacon)) { throw "beacon.exe is not at $beacon" }
- foreach ($name in @('beacon-hooks.exe', 'beacon-otelcol.exe')) {
+ foreach ($name in @('beacon-hooks.exe', 'beacon-otelcol.exe', 'vector.exe')) {
$path = Join-Path $env:ProgramFiles "Beacon\bin\$name"
if (-not (Test-Path -LiteralPath $path)) { throw "$name is missing from the payload" }
}
+ # The packaged Vector has to run, and be the copy FindVector picks.
+ $vectorVersion = (& (Join-Path $env:ProgramFiles 'Beacon\bin\vector.exe') --version) -join ' '
+ if ($LASTEXITCODE -ne 0 -or $vectorVersion -notmatch '^vector 0\.56\.0\b') { throw "the packaged vector.exe reported '$vectorVersion'" }
+ Write-Output $vectorVersion
# The claim a package makes is a *running* endpoint, so the service is asserted rather than
# the files. Installing three binaries and registering nothing would pass a file check.
@@ -1056,8 +1068,10 @@ jobs:
throw "the BeaconCollector service still exists after uninstall"
}
- if (Test-Path -LiteralPath (Join-Path $env:ProgramFiles 'Beacon\bin\beacon.exe')) {
- throw "the payload was not removed"
+ foreach ($name in @('beacon.exe', 'vector.exe')) {
+ if (Test-Path -LiteralPath (Join-Path $env:ProgramFiles "Beacon\bin\$name")) {
+ throw "the payload was not removed: $name is still installed"
+ }
}
# Retention, which is a contract rather than an accident: an uninstall is often the first
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e3f91ca2..bf263756 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -6,7 +6,7 @@ name: Release
# 2. package — (after goreleaser) builds, signs, notarizes, and staples the
# macOS .pkg for both arches and attaches them plus the
# package update manifest to the same release.
-# 3. windows-package — (after goreleaser) builds the Windows MSI from the archive
+# 3. windows-package — (after goreleaser) builds the Windows MSI from the archive and the pinned Vector
# goreleaser just published, installs it to prove it works, and
# attaches it. Unsigned for now, so it needs no secrets.
# 4. finalize — (after all three) adds the .pkg, .msi and install.sh to checksums.txt and
@@ -367,6 +367,14 @@ jobs:
}
}
+ # Not in the archive: the Windows zip stays the CLI and collector, and only the MSI carries
+ # Vector. Checked against packaging/vector/, never against a checksum from the download host.
+ - name: Fetch Vector
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $vector = pwsh -NoProfile -File packaging\windows\fetch-vector.ps1 -OutDir dist\windows\vector | Select-Object -Last 1
+ if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $vector)) { throw "fetch-vector.ps1 staged no vector.exe" }
+
- name: Build the MSI
run: |
$ErrorActionPreference = 'Stop'
@@ -376,6 +384,7 @@ jobs:
-BeaconExe dist\windows\extracted\beacon.exe `
-HooksExe dist\windows\extracted\beacon-hooks.exe `
-CollectorExe dist\windows\extracted\beacon-otelcol.exe `
+ -VectorExe dist\windows\vector\vector.exe `
-OutFile "dist\windows\BeaconEndpointAgent-$version-x64.msi"
if ($LASTEXITCODE -ne 0) { throw "building the MSI failed" }
@@ -384,7 +393,9 @@ jobs:
$ErrorActionPreference = 'Stop'
$msi = (Get-ChildItem dist\windows -Filter '*.msi' | Select-Object -First 1).FullName
$log = "$env:GITHUB_WORKSPACE\release-install.log"
- $p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @('/i', $msi, '/qn', '/l*v', $log)
+ # /norestart, as in CI: without it a silent msiexec that finds a file in use reboots the
+ # runner instead of failing the step.
+ $p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @('/i', $msi, '/qn', '/norestart', '/l*v', $log)
if ($p.ExitCode -ne 0) {
Get-Content -LiteralPath $log -Tail 120 | Write-Output
throw "the release MSI failed to install (exit $($p.ExitCode))"
@@ -398,6 +409,9 @@ jobs:
Write-Output $state
if ($state -notmatch 'RUNNING') { throw "the release MSI did not leave a running collector" }
+ $vectorVersion = (& (Join-Path $env:ProgramFiles 'Beacon\bin\vector.exe') --version) -join ' '
+ if ($LASTEXITCODE -ne 0 -or $vectorVersion -notmatch '^vector 0\.56\.0\b') { throw "the release MSI's vector.exe reported '$vectorVersion'" }
+
# The version a user will see, checked against the tag being released.
$beacon = Join-Path $env:ProgramFiles 'Beacon\bin\beacon.exe'
$reported = (& $beacon version | Out-String).Trim()
@@ -407,7 +421,7 @@ jobs:
throw "the packaged binary reports '$reported', which does not contain the released version $expected"
}
- $p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @('/x', $msi, '/qn')
+ $p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @('/x', $msi, '/qn', '/norestart')
if ($p.ExitCode -ne 0) { throw "the release MSI failed to uninstall (exit $($p.ExitCode))" }
exit 0
diff --git a/CLAUDE.md b/CLAUDE.md
index ee71aeb7..f7bf6b0b 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -283,7 +283,9 @@ A pushed `v*` tag runs the full release end-to-end via
GoReleaser still publishes multi-arch CLI tarballs; the signed endpoint
`.pkg` is arm64-only so it can carry a current Vector release.
3. `windows-package` (windows-2025, `needs: goreleaser`) builds the x64 MSI from
- the published archive, installs and uninstalls it on the runner to prove it
+ the published archive plus `vector.exe` (`packaging/windows/fetch-vector.ps1`,
+ checked against the same pinned `packaging/vector/` checksums; the Windows zip
+ itself carries no Vector), installs and uninstalls it on the runner to prove it
works, and attaches the `.msi` and its `.sha256`. Deliberately **not** in the
`release` environment: that environment gates signing secrets, and the MSI is
unsigned, so this job has none to gate.
@@ -611,7 +613,7 @@ unpacked through Chrome's developer mode.
- `cross-build` (ubuntu): builds all five release targets and asserts the Linux binaries are statically linked (no `PT_INTERP`).
- `package-smoke` (macOS): `packaging/macos/test-endpoint-scripts.sh`, a `build-pkg.sh` payload check, and `packaging/macos/smoke-endpoint.sh`.
- `linux-systemd-smoke` and `linux-package-smoke` (ubuntu): the real systemd install path, and installing the built `.deb` in a systemd container.
-- `windows-package-smoke` (windows-2025): `packaging/windows/test-endpoint-scripts.ps1`, then building the MSI and installing it.
+- `windows-package-smoke` (windows-2025): `packaging/windows/test-endpoint-scripts.ps1`, then fetching the pinned Vector, building the MSI and installing it.
The Go jobs build the embedded hooks binary first (`make build-hooks-current`); `cli/beacon` tests
fail against the placeholder because `InstallFactory` requires a real binary.
diff --git a/cli/beacon/internal/endpoint/asymptote/vector.go b/cli/beacon/internal/endpoint/asymptote/vector.go
index 15861566..e6018ae0 100644
--- a/cli/beacon/internal/endpoint/asymptote/vector.go
+++ b/cli/beacon/internal/endpoint/asymptote/vector.go
@@ -24,6 +24,11 @@ const VectorBinEnv = "BEACON_VECTOR_BIN"
// PackagedVectorPath is where the macOS package and the Linux .deb and .rpm install Vector.
const PackagedVectorPath = "/opt/beacon/bin/vector"
+// WindowsVectorName is what the Windows MSI installs Vector as, beside beacon.exe in
+// %ProgramFiles%\Beacon\bin. The plain upstream name is safe there, unlike in a Linux archive
+// unpacked onto PATH: that directory belongs to the package, and nothing puts it on PATH.
+const WindowsVectorName = "vector.exe"
+
// ArchiveVectorName is what the Linux release archive calls Vector, next to the beacon binary.
// Homebrew-on-Linux installs it under the same name. Not "vector", because people unpack the
// archive into a directory on PATH, and a file named vector there would shadow the Vector they
@@ -67,6 +72,10 @@ func vectorNotFoundMessage(goos string) string {
" and the release archive carries it as " + ArchiveVectorName + " beside beacon. " +
"Reinstall Beacon from one of those, install Vector " + MinVectorVersion +
" or newer from https://vector.dev, or set " + VectorBinEnv
+ case "windows":
+ return "vector was not found; the Beacon MSI installs it as " + WindowsVectorName + " beside beacon.exe in " +
+ `%ProgramFiles%\Beacon\bin` + ". Reinstall the MSI, install Vector " + MinVectorVersion +
+ " or newer from https://vector.dev, or set " + VectorBinEnv
default:
return "vector was not found; install Vector " + MinVectorVersion +
" or newer from https://vector.dev or set " + VectorBinEnv
@@ -129,6 +138,9 @@ var vectorSearchPaths = defaultVectorSearchPaths
var currentExecutable = os.Executable
func defaultVectorSearchPaths() []string {
+ if runtime.GOOS == "windows" {
+ return windowsVectorSearchPaths()
+ }
var paths []string
// Beside the CLI first, which is what an extracted Linux release archive and a
// Homebrew-on-Linux install look like. Only under ArchiveVectorName: a plain vector beside
@@ -153,6 +165,23 @@ func defaultVectorSearchPaths() []string {
return paths
}
+// windowsVectorSearchPaths is where the MSI puts Vector: beside the running beacon.exe, and in
+// the package's own directory for a beacon.exe started from somewhere else. There is no Homebrew
+// and no /opt on Windows to look in.
+func windowsVectorSearchPaths() []string {
+ var paths []string
+ if executable, err := currentExecutable(); err == nil {
+ paths = append(paths, filepath.Join(filepath.Dir(executable), WindowsVectorName))
+ }
+ if programFiles := os.Getenv("ProgramFiles"); programFiles != "" {
+ packaged := filepath.Join(programFiles, "Beacon", "bin", WindowsVectorName)
+ if len(paths) == 0 || !strings.EqualFold(paths[0], packaged) {
+ paths = append(paths, packaged)
+ }
+ }
+ return paths
+}
+
// homebrewPrefixes lists the Homebrew prefixes to look under, HOMEBREW_PREFIX first when the
// caller set one. The defaults are the per-platform standard prefixes: Apple Silicon and Intel
// macOS, and the Linuxbrew prefix. A prefix that does not exist just yields candidates that
diff --git a/cli/beacon/internal/endpoint/asymptote/vector_test.go b/cli/beacon/internal/endpoint/asymptote/vector_test.go
index 17706519..37d52b4c 100644
--- a/cli/beacon/internal/endpoint/asymptote/vector_test.go
+++ b/cli/beacon/internal/endpoint/asymptote/vector_test.go
@@ -201,7 +201,7 @@ func TestVectorNotFoundMessageNamesWhereVectorComesFrom(t *testing.T) {
cases := map[string][]string{
"darwin": {"brew install asymptote-labs/tap/" + TapVectorFormula, VectorBinEnv},
"linux": {PackagedVectorPath, ArchiveVectorName, "https://vector.dev", VectorBinEnv},
- "windows": {"https://vector.dev", VectorBinEnv},
+ "windows": {WindowsVectorName, `%ProgramFiles%\Beacon\bin`, "https://vector.dev", VectorBinEnv},
}
for goos, want := range cases {
msg := vectorNotFoundMessage(goos)
@@ -216,6 +216,28 @@ func TestVectorNotFoundMessageNamesWhereVectorComesFrom(t *testing.T) {
}
}
+// The MSI installs vector.exe beside beacon.exe. A beacon.exe run from elsewhere still finds the
+// package's copy, and the package directory is not listed twice when that is where beacon.exe is.
+func TestWindowsVectorSearchPathsFindTheMSICopy(t *testing.T) {
+ programFiles := t.TempDir()
+ t.Setenv("ProgramFiles", programFiles)
+ packaged := filepath.Join(programFiles, "Beacon", "bin", WindowsVectorName)
+ oldExe := currentExecutable
+ t.Cleanup(func() { currentExecutable = oldExe })
+
+ elsewhere := filepath.Join(t.TempDir(), "beacon.exe")
+ currentExecutable = func() (string, error) { return elsewhere, nil }
+ want := []string{filepath.Join(filepath.Dir(elsewhere), WindowsVectorName), packaged}
+ if got := windowsVectorSearchPaths(); !slices.Equal(got, want) {
+ t.Fatalf("beacon.exe outside the package: got %v, want %v", got, want)
+ }
+
+ currentExecutable = func() (string, error) { return filepath.Join(filepath.Dir(packaged), "beacon.exe"), nil }
+ if got := windowsVectorSearchPaths(); !slices.Equal(got, []string{packaged}) {
+ t.Fatalf("beacon.exe in the package: got %v, want only %s", got, packaged)
+ }
+}
+
// Under Homebrew the running CLI is in a versioned keg, and connect writes the Vector path into the
// forwarder's service unit. The keg path breaks at the next `brew upgrade`, so FindVector has to
// return the <prefix>/bin link instead.
diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdx
index 8794d34c..5f92455c 100644
--- a/docs/changelog/cli.mdx
+++ b/docs/changelog/cli.mdx
@@ -11,6 +11,7 @@ Stay up to date with the latest changes to the Agent Beacon CLI.
## Unreleased
+- **The Windows MSI carries Vector** · The MSI now installs Vector 0.56.0 as `vector.exe` beside `beacon.exe` in `%ProgramFiles%\Beacon\bin`, as the macOS and Linux packages already carry it, checked against the same pinned checksums. Beacon finds it there. The package only installs it; nothing runs it until a forwarder is set up. Allow it alongside the other three programs if you run AppLocker or WDAC.
- **Scheduled session sync** · `beacon endpoint install|repair --session-sync` turns on a job that runs every 15 minutes and reads new records from the agent runtimes' local session stores into the runtime log. It runs the same bounded, confined sweep install already runs once, so session-store data keeps reaching the log, and any forwarder reading it, after install. Off by default; repair and upgrades keep the setting, and `--no-session-sync` removes the job. See [Scheduled session sync](/cli/endpoint-install#scheduled-session-sync).
- **Turn session sync on or off without a repair** · `beacon endpoint sessions enable|disable` changes only the scheduled session sync setting and installs or removes its job. `beacon endpoint repair --session-sync` rebuilds the endpoint from its flags, so run without the ones an endpoint was set up with it reset harnesses and OTLP ports and dropped Splunk or Falcon HEC destinations. For package and MDM installs, `BEACON_SESSION_SYNC=1` in the environment of `/opt/beacon/scripts/install-endpoint.sh` (macOS and Linux) turns it on, and `0` turns it off; unset keeps the endpoint's own setting, so package upgrades never change it.
- **Repair keeps the collector it came with** · Without `--collector`, `beacon endpoint repair` and `install` now use the `beacon-otelcol` beside the `beacon` CLI before one on `PATH`, and repair checks the collector before it takes the endpoint down. Under `sudo` on a Mac that also had Homebrew Beacon, repair found Homebrew's older collector first, refused it after removing the collector's service and config, and left the endpoint without its collector.
diff --git a/docs/platforms/windows.mdx b/docs/platforms/windows.mdx
index 082dac6c..a728a6bb 100644
--- a/docs/platforms/windows.mdx
+++ b/docs/platforms/windows.mdx
@@ -128,13 +128,17 @@ See the [event schema](/telemetry-schema/event-schema) for the full field refere
| Step | Result |
|---|---|
-| Unpack | `beacon.exe`, `beacon-hooks.exe`, and `beacon-otelcol.exe` under `%ProgramFiles%\Beacon\bin` |
+| Unpack | `beacon.exe`, `beacon-hooks.exe`, `beacon-otelcol.exe`, and `vector.exe` under `%ProgramFiles%\Beacon\bin` |
| System install | Config and collector config under `%ProgramData%\Beacon\Endpoint`, with `%ProgramData%\Beacon` owned by Administrators and locked down |
| Service | `BeaconCollector`, registered with the SCM, automatic start, restart on failure |
| Runtime log | `%ProgramData%\Beacon\Endpoint\logs\runtime.jsonl` |
| Log permissions | `INTERACTIVE` may append to the runtime log files, and nothing more |
| Agent runtime | Claude Code and Codex CLI settings for the interactive user, pointed at `127.0.0.1:4317` |
+`vector.exe` is [Vector](https://vector.dev) 0.56.0, the log forwarder the macOS and Linux packages also carry. The package only installs it: nothing runs it until you set up a forwarder.
+
+If you run AppLocker or Windows Defender Application Control, allow the four programs in `%ProgramFiles%\Beacon\bin`. None of them is code-signed yet (see below), so a publisher rule cannot match them; use a path or file hash rule.
+
Two of those rows deserve explanation.
**The directory and log permissions.** A system-mode collector runs as `LocalSystem` and writes the log, while hooks run as you and append to it. `%ProgramData%` subdirectories inherit an ACL where ordinary users cannot write existing files, so without a grant every hook write fails with access denied, and nothing reports it, because `status` and `doctor` describe the collector rather than the hooks exporting to it. The grant has to stop there: a user who can add, delete or rename entries in a directory a SYSTEM process writes to can swap the log for a link and send the collector's writes anywhere.
diff --git a/packaging/vector/vector-0.56.0-SHA256SUMS b/packaging/vector/vector-0.56.0-SHA256SUMS
index cd12000d..f1ec22e9 100644
--- a/packaging/vector/vector-0.56.0-SHA256SUMS
+++ b/packaging/vector/vector-0.56.0-SHA256SUMS
@@ -1,3 +1,4 @@
afa383a264e7ab373dac68281cd86fb808f8447bb3813c08b5b0baaae0314a05 vector-0.56.0-aarch64-unknown-linux-musl.tar.gz
9aa8b6772d7c887734d38c84eb721d3a067e08a4aa4dc0dcc809365da242ec16 vector-0.56.0-arm64-apple-darwin.tar.gz
+67611f6b18c3b267ab26402c0dddc59e59bbccd762c7c0ea5f654f4ec4e6bf42 vector-0.56.0-x86_64-pc-windows-msvc.zip
8c114c5e9fd9646516f014d5d837690447cf0d4f43ba4a3746713bc0612b039b vector-0.56.0-x86_64-unknown-linux-musl.tar.gz
diff --git a/packaging/windows/beacon.wxs b/packaging/windows/beacon.wxs
index cc9e8326..74b7103f 100644
--- a/packaging/windows/beacon.wxs
+++ b/packaging/windows/beacon.wxs
@@ -67,6 +67,14 @@
<Component Id="BeaconCollector" Directory="BinFolder">
<File Id="BeaconOtelcolExeFile" Source="$(var.StageDir)\bin\beacon-otelcol.exe" KeyPath="yes" />
</Component>
+ <!--
+ Vector, the log forwarder the macOS and Linux packages also carry. Installed as vector.exe
+ beside beacon.exe, where FindVector looks for it. The package only lays the file down;
+ nothing runs it until a forwarder is set up.
+ -->
+ <Component Id="BeaconVector" Directory="BinFolder">
+ <File Id="VectorExeFile" Source="$(var.StageDir)\bin\vector.exe" KeyPath="yes" />
+ </Component>
<Component Id="InstallScript" Directory="ScriptsFolder">
<File Id="InstallEndpointScriptFile" Source="$(var.StageDir)\scripts\install-endpoint.ps1" KeyPath="yes" />
</Component>
diff --git a/packaging/windows/build-msi.ps1 b/packaging/windows/build-msi.ps1
index 2280f8dc..43a50e3a 100644
--- a/packaging/windows/build-msi.ps1
+++ b/packaging/windows/build-msi.ps1
@@ -5,13 +5,18 @@
# from the one in the archive next to it.
#
# Usage:
-# .\build-msi.ps1 -Version 0.1.2 -BeaconExe ... -HooksExe ... -CollectorExe ... -OutFile ...
+# .\build-msi.ps1 -Version 0.1.2 -BeaconExe ... -HooksExe ... -CollectorExe ... -VectorExe ... -OutFile ...
+#
+# VectorExe is the vector.exe that fetch-vector.ps1 staged. It is required, as the macOS release
+# requires it in the .pkg: the forwarder helpers and docs assume the package carries Vector, so a
+# package without it would install cleanly and fail later, on the first forwarder install.
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)][string]$Version,
[Parameter(Mandatory = $true)][string]$BeaconExe,
[Parameter(Mandatory = $true)][string]$HooksExe,
[Parameter(Mandatory = $true)][string]$CollectorExe,
+ [Parameter(Mandatory = $true)][string]$VectorExe,
[string]$OutFile,
# Pinned by the caller so a build is reproducible and a WiX release cannot change the output
# underneath us.
@@ -35,7 +40,7 @@ if ([string]::IsNullOrWhiteSpace($OutFile)) {
$OutFile = Join-Path (Get-Location) "BeaconEndpointAgent-$normalized-x64.msi"
}
-foreach ($input in @($BeaconExe, $HooksExe, $CollectorExe)) {
+foreach ($input in @($BeaconExe, $HooksExe, $CollectorExe, $VectorExe)) {
if (-not (Test-Path -LiteralPath $input)) {
throw "input binary not found: $input"
}
@@ -49,6 +54,7 @@ try {
Copy-Item -LiteralPath $BeaconExe -Destination (Join-Path $stage 'bin\beacon.exe')
Copy-Item -LiteralPath $HooksExe -Destination (Join-Path $stage 'bin\beacon-hooks.exe')
Copy-Item -LiteralPath $CollectorExe -Destination (Join-Path $stage 'bin\beacon-otelcol.exe')
+ Copy-Item -LiteralPath $VectorExe -Destination (Join-Path $stage 'bin\vector.exe')
Copy-Item -LiteralPath (Join-Path $scriptDir 'install-endpoint.ps1') -Destination (Join-Path $stage 'scripts\install-endpoint.ps1')
Copy-Item -LiteralPath (Join-Path $scriptDir 'uninstall-endpoint.ps1') -Destination (Join-Path $stage 'scripts\uninstall-endpoint.ps1')
Copy-Item -LiteralPath (Join-Path $scriptDir 'package-common.ps1') -Destination (Join-Path $stage 'scripts\package-common.ps1')
diff --git a/packaging/windows/fetch-vector.ps1 b/packaging/windows/fetch-vector.ps1
new file mode 100644
index 00000000..df190f42
--- /dev/null
+++ b/packaging/windows/fetch-vector.ps1
@@ -0,0 +1,72 @@
+# Downloads the Vector build the Windows MSI ships, checks it, and stages vector.exe for build-msi.ps1.
+#
+# .\fetch-vector.ps1 [-OutDir <dir>] [-Version 0.56.0]
+#
+# Writes <OutDir>\vector.exe and prints its path. OutDir defaults to cli\beacon\release-vector\windows_amd64.
+#
+# The archive is checked against packaging\vector\vector-<version>-SHA256SUMS, committed in this
+# repository, never against a checksum file from the download host: vector.exe runs as a SYSTEM
+# service, so a compromised download host must not be able to supply both the binary and its hash.
+# This is the Windows half of packaging/linux/fetch-vector.sh, and the version is pinned to match it.
+#
+# Extracted with Expand-Archive on Windows. Upstream builds the zip with Compress-Archive, so its
+# entry names use backslashes, which zip tools on macOS and Linux turn into file names rather than
+# directories.
+[CmdletBinding()]
+param(
+ [string]$OutDir,
+ [string]$Version = '0.56.0'
+)
+
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+$root = (Resolve-Path (Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) '..\..')).Path
+if ([string]::IsNullOrWhiteSpace($OutDir)) {
+ $OutDir = Join-Path $root 'cli\beacon\release-vector\windows_amd64'
+}
+
+$archive = "vector-$Version-x86_64-pc-windows-msvc.zip"
+$pinned = Join-Path $root "packaging\vector\vector-$Version-SHA256SUMS"
+if (-not (Test-Path -LiteralPath $pinned)) {
+ throw "no pinned checksums at $pinned; commit them for Vector $Version first"
+}
+$line = Get-Content -LiteralPath $pinned | Where-Object { ($_ -split '\s+')[1] -eq $archive } | Select-Object -First 1
+if (-not $line) { throw "no pinned checksum for $archive in $pinned" }
+$expected = ($line -split '\s+')[0].ToLower()
+
+$work = Join-Path ([System.IO.Path]::GetTempPath()) ("beacon-vector-" + [Guid]::NewGuid().ToString('N'))
+New-Item -ItemType Directory -Force -Path $work | Out-Null
+try {
+ $zip = Join-Path $work $archive
+ $url = "https://packages.timber.io/vector/$Version/$archive"
+ for ($attempt = 1; ; $attempt++) {
+ try {
+ Invoke-WebRequest -Uri $url -OutFile $zip -UseBasicParsing
+ break
+ } catch {
+ if ($attempt -ge 3) { throw "downloading ${url}: $($_.Exception.Message)" }
+ Start-Sleep -Seconds (5 * $attempt)
+ }
+ }
+ $actual = (Get-FileHash -LiteralPath $zip -Algorithm SHA256).Hash.ToLower()
+ if ($actual -ne $expected) {
+ throw "$archive has SHA256 $actual; the pinned checksum is $expected"
+ }
+
+ $extracted = Join-Path $work 'extracted'
+ Expand-Archive -LiteralPath $zip -DestinationPath $extracted
+ $exe = Join-Path $extracted 'bin\vector.exe'
+ if (-not (Test-Path -LiteralPath $exe)) { throw "no bin\vector.exe in $archive" }
+
+ $reported = (& $exe --version) -join ' '
+ if ($LASTEXITCODE -ne 0 -or $reported -notmatch "vector $([regex]::Escape($Version))\b") {
+ throw "$exe reported '$reported', not Vector $Version"
+ }
+
+ New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
+ $dest = Join-Path $OutDir 'vector.exe'
+ Copy-Item -LiteralPath $exe -Destination $dest -Force
+ Write-Output $dest
+} finally {
+ Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
+}
diff --git a/packaging/windows/test-endpoint-scripts.ps1 b/packaging/windows/test-endpoint-scripts.ps1
index 36bb7f3d..1230a092 100644
--- a/packaging/windows/test-endpoint-scripts.ps1
+++ b/packaging/windows/test-endpoint-scripts.ps1
@@ -20,7 +20,7 @@ function Fail {
$script:failures++
}
-$scripts = @('install-endpoint.ps1', 'uninstall-endpoint.ps1', 'package-common.ps1', 'build-msi.ps1', 'smoke-restricted-log.ps1')
+$scripts = @('install-endpoint.ps1', 'uninstall-endpoint.ps1', 'package-common.ps1', 'build-msi.ps1', 'fetch-vector.ps1', 'smoke-restricted-log.ps1')
foreach ($name in $scripts) {
$path = Join-Path $scriptDir $name
if (-not (Test-Path -LiteralPath $path)) {
@@ -155,6 +155,14 @@ $build = Get-Content -Raw -LiteralPath (Join-Path $scriptDir 'build-msi.ps1')
if ($wxs -notmatch [regex]::Escape('scripts\package-common.ps1') -or $build -notmatch [regex]::Escape('package-common.ps1')) {
Fail "the MSI no longer ships package-common.ps1 beside the scripts that dot-source it"
}
+# Vector ships in the MSI as it does in the .pkg and the Linux packages, and only from the pinned build.
+if ($wxs -notmatch [regex]::Escape('bin\vector.exe') -or $build -notmatch [regex]::Escape("'bin\vector.exe'")) {
+ Fail "the MSI no longer ships bin\vector.exe"
+}
+$fetch = Get-Content -Raw -LiteralPath (Join-Path $scriptDir 'fetch-vector.ps1')
+if ($fetch -notmatch [regex]::Escape('packaging\vector\vector-$Version-SHA256SUMS') -or $fetch -match '(?i)timber\.io[^\n]*SHA256SUMS') {
+ Fail "fetch-vector.ps1 must check the archive against the checksums committed in packaging\vector, not a downloaded file"
+}
if ($wxs -match 'ExeCommand="[^"]*beacon\.exe') {
Fail "beacon.wxs invokes beacon.exe directly; the install contract belongs in one place, not two"
}