herozion 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install.js +23 -10
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -33,8 +33,11 @@ const crypto = require("crypto");
33
33
  const { execSync } = require("child_process");
34
34
 
35
35
  const VERSION = require("./package.json").version;
36
+ // BINARY_VERSION may differ from VERSION when npm patches (install.js fixes, etc.)
37
+ // are published without new binaries. Update this when new binaries are released.
38
+ const BINARY_VERSION = "1.1.5";
36
39
  const BASE_URL =
37
- `https://github.com/Herozion/scanner-releases/releases/download/v${VERSION}`;
40
+ `https://github.com/Herozion/scanner-releases/releases/download/v${BINARY_VERSION}`;
38
41
 
39
42
  // ── Platform detection ────────────────────────────────────────────────────────
40
43
 
@@ -111,7 +114,8 @@ function sha256File(filePath) {
111
114
  async function main() {
112
115
  const binaryName = getBinaryName();
113
116
  const url = `${BASE_URL}/${binaryName}`;
114
- const checksumUrl = `${BASE_URL}/${binaryName}.sha256`;
117
+ // The release ships a combined CHECKSUMS.sha256 file, not per-binary .sha256 files.
118
+ const checksumUrl = `${BASE_URL}/CHECKSUMS.sha256`;
115
119
 
116
120
  // Store the binary inside this package directory (node_modules/herozion/)
117
121
  const binDir = path.join(__dirname, "bin");
@@ -122,10 +126,10 @@ async function main() {
122
126
  const destPath = path.join(binDir, destName);
123
127
  const tmpPath = destPath + ".tmp";
124
128
 
125
- // Skip download if binary already exists and matches version
126
- const markerPath = path.join(binDir, `.version-${VERSION}`);
129
+ // Skip download if binary already exists and matches binary version
130
+ const markerPath = path.join(binDir, `.version-${BINARY_VERSION}`);
127
131
  if (fs.existsSync(destPath) && fs.existsSync(markerPath)) {
128
- console.log(`herozion: binary v${VERSION} already present, skipping download.`);
132
+ console.log(`herozion: binary v${BINARY_VERSION} already present, skipping download.`);
129
133
  return;
130
134
  }
131
135
 
@@ -137,7 +141,7 @@ async function main() {
137
141
  bundledHash = (bundled[binaryName] || "").toLowerCase().trim();
138
142
  } catch (_) {}
139
143
 
140
- console.log(`herozion: downloading ${binaryName} v${VERSION}...`);
144
+ console.log(`herozion: downloading ${binaryName} v${BINARY_VERSION}...`);
141
145
  try {
142
146
  // Download binary to a temporary path first, then verify checksum before placing
143
147
  await download(url, tmpPath);
@@ -158,10 +162,19 @@ async function main() {
158
162
  }
159
163
  }
160
164
 
161
- // ── Secondary check: .sha256 from GitHub Releases ─────────────────────────
165
+ // ── Secondary check: CHECKSUMS.sha256 from GitHub Releases ────────────────
162
166
  try {
163
167
  const checksumData = await downloadText(checksumUrl);
164
- const remoteHash = checksumData.trim().split(/\s+/)[0].toLowerCase();
168
+ // Parse the combined checksum file: each line is "<hash> <filename>"
169
+ const remoteHash = (() => {
170
+ for (const line of checksumData.split(/\n/)) {
171
+ const parts = line.trim().split(/\s+/);
172
+ if (parts.length >= 2 && parts[1] === binaryName) {
173
+ return parts[0].toLowerCase();
174
+ }
175
+ }
176
+ return "";
177
+ })();
165
178
  if (remoteHash && actualHash !== remoteHash) {
166
179
  fs.unlinkSync(tmpPath);
167
180
  throw new Error(
@@ -194,8 +207,8 @@ async function main() {
194
207
  try { fs.unlinkSync(tmpPath); } catch (_) {}
195
208
  // Non-fatal: warn and continue — the bin shim will give a clear error at runtime
196
209
  console.warn(`herozion: WARNING — could not download binary: ${err.message}`);
197
- console.warn("You can download it manually from:");
198
- console.warn(` ${url}`);
210
+ console.warn(`You can download it manually from:`);
211
+ console.warn(` ${BASE_URL}/${binaryName}`);
199
212
  }
200
213
  }
201
214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herozion",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Security audit and performance analysis CLI tool for developers",
5
5
  "keywords": [
6
6
  "security",