@secure-exec/sidecar 0.0.0-agentos-dylib-base.edaa4a4 → 0.0.0-macos-all-platform.0186eb8

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/index.js +45 -6
  2. package/package.json +4 -2
package/index.js CHANGED
@@ -10,20 +10,59 @@
10
10
  // 2. A `secure-exec-sidecar` binary placed next to this package.
11
11
  // 3. The platform-specific `@secure-exec/sidecar-<platform>` package.
12
12
 
13
- const { existsSync } = require("node:fs");
13
+ const { existsSync, readFileSync } = require("node:fs");
14
14
  const { join, dirname } = require("node:path");
15
15
 
16
- const BINARY_NAME = "secure-exec-sidecar";
16
+ const BINARY_BASENAME = "secure-exec-sidecar";
17
+ const BINARY_NAME =
18
+ process.platform === "win32" ? `${BINARY_BASENAME}.exe` : BINARY_BASENAME;
17
19
 
18
20
  // No runtime chmod. Platform packages are published with `npm publish`, which
19
21
  // preserves the binary's 0755 executable bit.
20
22
 
23
+ // Detect whether the current Linux runtime is musl (Alpine) or glibc. We avoid
24
+ // pulling in a dependency and instead inspect the Node process report (which
25
+ // reports `glibcVersionRuntime` only on glibc), falling back to probing ldd.
26
+ function isMuslLibc() {
27
+ if (process.report && typeof process.report.getReport === "function") {
28
+ try {
29
+ const report = process.report.getReport();
30
+ const header = report && report.header;
31
+ const glibc = header && header.glibcVersionRuntime;
32
+ if (glibc) return false;
33
+ // No glibc runtime version reported -> musl.
34
+ return true;
35
+ } catch {
36
+ // Fall through to filesystem probe.
37
+ }
38
+ }
39
+ try {
40
+ const lddPath = "/usr/bin/ldd";
41
+ if (existsSync(lddPath)) {
42
+ const ldd = readFileSync(lddPath, "utf8");
43
+ if (ldd.includes("musl")) return true;
44
+ }
45
+ } catch {
46
+ // ignore
47
+ }
48
+ return false;
49
+ }
50
+
21
51
  function getPlatformPackageName() {
22
52
  const { platform, arch } = process;
23
53
  switch (platform) {
24
- case "linux":
25
- if (arch === "x64") return "@secure-exec/sidecar-linux-x64-gnu";
26
- if (arch === "arm64") return "@secure-exec/sidecar-linux-arm64-gnu";
54
+ case "linux": {
55
+ const libc = isMuslLibc() ? "musl" : "gnu";
56
+ if (arch === "x64") return `@secure-exec/sidecar-linux-x64-${libc}`;
57
+ if (arch === "arm64") return `@secure-exec/sidecar-linux-arm64-${libc}`;
58
+ break;
59
+ }
60
+ case "darwin":
61
+ if (arch === "x64") return "@secure-exec/sidecar-darwin-x64";
62
+ if (arch === "arm64") return "@secure-exec/sidecar-darwin-arm64";
63
+ break;
64
+ case "win32":
65
+ if (arch === "x64") return "@secure-exec/sidecar-windows-x64";
27
66
  break;
28
67
  default:
29
68
  break;
@@ -51,7 +90,7 @@ function getSidecarPath() {
51
90
  if (!platformPkg) {
52
91
  throw new Error(
53
92
  `@secure-exec/sidecar: unsupported platform ${process.platform}/${process.arch}. ` +
54
- "The Secure Exec sidecar currently supports linux x64 and arm64. " +
93
+ "The Secure Exec sidecar supports linux (x64/arm64, gnu/musl), darwin (x64/arm64), and windows (x64). " +
55
94
  "Set SECURE_EXEC_SIDECAR_BIN to a local secure-exec-sidecar binary to override.",
56
95
  );
57
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secure-exec/sidecar",
3
- "version": "0.0.0-agentos-dylib-base.edaa4a4",
3
+ "version": "0.0.0-macos-all-platform.0186eb8",
4
4
  "description": "Platform-specific resolver for the Secure Exec native sidecar binary",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -22,6 +22,8 @@
22
22
  "node": ">=20"
23
23
  },
24
24
  "optionalDependencies": {
25
- "@secure-exec/sidecar-linux-x64-gnu": "0.0.0-agentos-dylib-base.edaa4a4"
25
+ "@secure-exec/sidecar-darwin-arm64": "0.0.0-macos-all-platform.0186eb8",
26
+ "@secure-exec/sidecar-linux-arm64-gnu": "0.0.0-macos-all-platform.0186eb8",
27
+ "@secure-exec/sidecar-linux-x64-gnu": "0.0.0-macos-all-platform.0186eb8"
26
28
  }
27
29
  }