crx-gate 0.1.0 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 crx-gate contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,23 +1,39 @@
1
1
  # crx-gate
2
2
 
3
- Zero-Dependency CLI for Pre-Commit Extension Security, Permission Blast-Radius Auditing, and CWS Rejection Prediction.
3
+ Static security analyzer and permission linter for Chrome extensions. Statically inspects unpacked extension directories, `.zip` bundles, or `.crx` binaries in under 3ms.
4
4
 
5
- ## Usage with NPX
5
+ [![GitHub](https://img.shields.io/badge/GitHub-jaw0r3k%2Fcrx--gate-blue?logo=github)](https://github.com/jaw0r3k/crx-gate)
6
+ [![License: MIT OR Apache-2.0](https://img.shields.io/badge/License-MIT%20OR%20Apache--2.0-blue.svg)](https://github.com/jaw0r3k/crx-gate/blob/master/LICENSE)
6
7
 
7
- Run without installing:
8
+ ---
8
9
 
9
- ```bash
10
- npx crx-gate audit ./path-to-extension
11
- ```
10
+ ## Instant usage via `npx`
12
11
 
13
- Diff two extension builds:
12
+ No installation required:
14
13
 
15
14
  ```bash
16
- npx crx-gate diff ./v1.0.0 ./v1.1.0
17
- ```
15
+ # Audit an extension directory
16
+ npx crx-gate audit ./dist
18
17
 
19
- Export SARIF report for GitHub Code Scanning:
18
+ # Generate standalone interactive HTML report
19
+ npx crx-gate audit ./dist --format html --output report.html
20
20
 
21
- ```bash
21
+ # Audit a packed .crx binary archive
22
+ npx crx-gate audit ./extension.crx
23
+
24
+ # Diff two versions to prevent permission creep
25
+ npx crx-gate diff ./v1.0.0 ./v1.1.0 --fail-on-degradation
26
+
27
+ # Export SARIF for GitHub Code Scanning
22
28
  npx crx-gate audit ./dist --format sarif --output crx-gate.sarif
29
+
30
+ # List all built-in rules
31
+ npx crx-gate rules
23
32
  ```
33
+
34
+ ---
35
+
36
+ ## Documentation
37
+
38
+ Full documentation, GitHub Actions setup, and pre-commit hook integrations:
39
+ [https://github.com/jaw0r3k/crx-gate](https://github.com/jaw0r3k/crx-gate)
package/bin/crx-gate.js CHANGED
@@ -6,8 +6,8 @@ const path = require("path");
6
6
  const os = require("os");
7
7
  const https = require("https");
8
8
 
9
- const VERSION = "0.1.0";
10
- const REPO = "crx-gate/crx-gate";
9
+ const VERSION = "0.2.0";
10
+ const REPO = "jaw0r3k/crx-gate";
11
11
 
12
12
  function getBinaryName() {
13
13
  const platform = os.platform();
@@ -64,6 +64,26 @@ function runBinary(binPath, args) {
64
64
  process.exit(result.status !== null ? result.status : 0);
65
65
  }
66
66
 
67
+ function downloadBinary(url, dest, cb) {
68
+ https.get(url, (res) => {
69
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
70
+ downloadBinary(res.headers.location, dest, cb);
71
+ return;
72
+ }
73
+ if (res.statusCode !== 200) {
74
+ cb(new Error(`Failed to download binary: HTTP ${res.statusCode}`));
75
+ return;
76
+ }
77
+ const file = fs.createWriteStream(dest);
78
+ res.pipe(file);
79
+ file.on("finish", () => {
80
+ file.close(() => cb(null));
81
+ });
82
+ }).on("error", (err) => {
83
+ cb(err);
84
+ });
85
+ }
86
+
67
87
  function main() {
68
88
  const args = process.argv.slice(2);
69
89
  const binPath = getLocalBinaryPath();
@@ -73,19 +93,46 @@ function main() {
73
93
  return;
74
94
  }
75
95
 
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
- });
96
+ const { artifact, binaryName, isZip } = getBinaryName();
97
+ const cacheDir = path.join(os.homedir(), ".crx-gate", `v${VERSION}`);
98
+ fs.mkdirSync(cacheDir, { recursive: true });
82
99
 
83
- if (cargoRun.status === 0) {
84
- process.exit(0);
85
- }
100
+ const archivePath = path.join(cacheDir, artifact);
101
+ const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${artifact}`;
86
102
 
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);
103
+ console.log(`crx-gate: Fetching pre-compiled release binary (v${VERSION})...`);
104
+ downloadBinary(downloadUrl, archivePath, (err) => {
105
+ if (!err) {
106
+ try {
107
+ if (isZip) {
108
+ spawnSync("powershell", ["-Command", `Expand-Archive -Path '${archivePath}' -DestinationPath '${cacheDir}' -Force`]);
109
+ } else {
110
+ spawnSync("tar", ["-xzf", archivePath, "-C", cacheDir]);
111
+ }
112
+ if (fs.existsSync(binPath)) {
113
+ if (process.platform !== "win32") {
114
+ fs.chmodSync(binPath, 0o755);
115
+ }
116
+ try { fs.unlinkSync(archivePath); } catch (_) {}
117
+ runBinary(binPath, args);
118
+ return;
119
+ }
120
+ } catch (_) {}
121
+ }
122
+
123
+ // Fallback to cargo run if developing in repo
124
+ const cargoRun = spawnSync("cargo", ["run", "--release", "--quiet", "--", ...args], {
125
+ stdio: "inherit",
126
+ cwd: path.join(__dirname, "..", ".."),
127
+ });
128
+
129
+ if (cargoRun.status === 0) {
130
+ process.exit(0);
131
+ }
132
+
133
+ console.error(`crx-gate error: Could not run or download binary. Please install via cargo: 'cargo install crx-gate'`);
134
+ process.exit(1);
135
+ });
89
136
  }
90
137
 
91
138
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crx-gate",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Zero-dependency pre-commit extension security, permission blast-radius auditing, and CWS rejection prediction",
5
5
  "bin": {
6
6
  "crx-gate": "bin/crx-gate.js"
@@ -20,10 +20,23 @@
20
20
  ],
21
21
  "author": "crx-gate contributors",
22
22
  "license": "MIT",
23
+ "homepage": "https://github.com/jaw0r3k/crx-gate#readme",
24
+ "bugs": {
25
+ "url": "https://github.com/jaw0r3k/crx-gate/issues"
26
+ },
23
27
  "repository": {
24
28
  "type": "git",
25
- "url": "git+https://github.com/crx-gate/crx-gate.git"
29
+ "url": "git+https://github.com/jaw0r3k/crx-gate.git"
30
+ },
31
+ "funding": {
32
+ "type": "individual",
33
+ "url": "https://github.com/jaw0r3k/crx-gate"
26
34
  },
35
+ "files": [
36
+ "bin",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
27
40
  "engines": {
28
41
  "node": ">=16.0.0"
29
42
  }