crx-gate 0.0.0-stage → 0.1.0

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.
package/README.md CHANGED
@@ -1,3 +1,23 @@
1
- # Temporary Holding Version
1
+ # crx-gate
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Zero-Dependency CLI for Pre-Commit Extension Security, Permission Blast-Radius Auditing, and CWS Rejection Prediction.
4
+
5
+ ## Usage with NPX
6
+
7
+ Run without installing:
8
+
9
+ ```bash
10
+ npx crx-gate audit ./path-to-extension
11
+ ```
12
+
13
+ Diff two extension builds:
14
+
15
+ ```bash
16
+ npx crx-gate diff ./v1.0.0 ./v1.1.0
17
+ ```
18
+
19
+ Export SARIF report for GitHub Code Scanning:
20
+
21
+ ```bash
22
+ npx crx-gate audit ./dist --format sarif --output crx-gate.sarif
23
+ ```
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const os = require("os");
7
+ const https = require("https");
8
+
9
+ const VERSION = "0.1.0";
10
+ const REPO = "crx-gate/crx-gate";
11
+
12
+ function getBinaryName() {
13
+ const platform = os.platform();
14
+ const arch = os.arch();
15
+
16
+ let targetArch = arch === "x64" ? "x86_64" : arch === "arm64" ? "aarch64" : null;
17
+ if (!targetArch) {
18
+ console.error(`crx-gate error: Unsupported CPU architecture '${arch}'.`);
19
+ process.exit(1);
20
+ }
21
+
22
+ if (platform === "linux") {
23
+ return {
24
+ artifact: `crx-gate-${targetArch}-unknown-linux-gnu.tar.gz`,
25
+ binaryName: "crx-gate",
26
+ isZip: false,
27
+ };
28
+ } else if (platform === "darwin") {
29
+ return {
30
+ artifact: `crx-gate-${targetArch}-apple-darwin.tar.gz`,
31
+ binaryName: "crx-gate",
32
+ isZip: false,
33
+ };
34
+ } else if (platform === "win32") {
35
+ return {
36
+ artifact: `crx-gate-x86_64-pc-windows-msvc.zip`,
37
+ binaryName: "crx-gate.exe",
38
+ isZip: true,
39
+ };
40
+ } else {
41
+ console.error(`crx-gate error: Unsupported OS '${platform}'.`);
42
+ process.exit(1);
43
+ }
44
+ }
45
+
46
+ function getLocalBinaryPath() {
47
+ // Check local release build first if developing locally
48
+ const localTarget = path.join(__dirname, "..", "..", "target", "release", process.platform === "win32" ? "crx-gate.exe" : "crx-gate");
49
+ if (fs.existsSync(localTarget)) {
50
+ return localTarget;
51
+ }
52
+
53
+ const { binaryName } = getBinaryName();
54
+ const cacheDir = path.join(os.homedir(), ".crx-gate", `v${VERSION}`);
55
+ return path.join(cacheDir, binaryName);
56
+ }
57
+
58
+ function runBinary(binPath, args) {
59
+ const result = spawnSync(binPath, args, { stdio: "inherit" });
60
+ if (result.error) {
61
+ console.error("Execution error:", result.error);
62
+ process.exit(1);
63
+ }
64
+ process.exit(result.status !== null ? result.status : 0);
65
+ }
66
+
67
+ function main() {
68
+ const args = process.argv.slice(2);
69
+ const binPath = getLocalBinaryPath();
70
+
71
+ if (fs.existsSync(binPath)) {
72
+ runBinary(binPath, args);
73
+ return;
74
+ }
75
+
76
+ console.log(`crx-gate: Standalone binary not found locally. Running native cargo build or download...`);
77
+ // Try running via cargo if installed
78
+ const cargoRun = spawnSync("cargo", ["run", "--release", "--quiet", "--", ...args], {
79
+ stdio: "inherit",
80
+ cwd: path.join(__dirname, "..", ".."),
81
+ });
82
+
83
+ if (cargoRun.status === 0) {
84
+ process.exit(0);
85
+ }
86
+
87
+ console.error(`crx-gate error: Could not locate binary. Install via cargo: 'cargo install crx-gate' or download from GitHub releases.`);
88
+ process.exit(1);
89
+ }
90
+
91
+ main();
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "crx-gate",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Zero-dependency pre-commit extension security, permission blast-radius auditing, and CWS rejection prediction",
5
+ "bin": {
6
+ "crx-gate": "bin/crx-gate.js"
7
+ },
8
+ "scripts": {
9
+ "test": "node bin/crx-gate.js --help"
10
+ },
11
+ "keywords": [
12
+ "chrome-extension",
13
+ "crx",
14
+ "security",
15
+ "audit",
16
+ "manifest-v3",
17
+ "blast-radius",
18
+ "sast",
19
+ "taint-analysis"
20
+ ],
21
+ "author": "crx-gate contributors",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/crx-gate/crx-gate.git"
26
+ },
27
+ "engines": {
28
+ "node": ">=16.0.0"
29
+ }
30
+ }