opmsec 0.1.3 → 0.1.5
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/.env.example +1 -0
- package/.husky/pre-commit +1 -0
- package/README.md +71 -275
- package/bun.lock +5 -5
- package/docs/architecture/agents.mdx +11 -59
- package/docs/architecture/benchmarks.mdx +20 -46
- package/docs/architecture/overview.mdx +31 -38
- package/docs/architecture/scanner.mdx +11 -37
- package/docs/cli/audit.mdx +9 -12
- package/docs/cli/check.mdx +12 -26
- package/docs/cli/fix.mdx +10 -30
- package/docs/cli/info.mdx +12 -19
- package/docs/cli/install.mdx +27 -39
- package/docs/cli/push.mdx +40 -57
- package/docs/cli/register-agent.mdx +21 -53
- package/docs/cli/view.mdx +12 -29
- package/docs/concepts/ens-records.mdx +44 -0
- package/docs/concepts/multi-agent-consensus.mdx +18 -36
- package/docs/concepts/on-chain-registry.mdx +22 -49
- package/docs/concepts/security-model.mdx +20 -52
- package/docs/concepts/zk-agent-verification.mdx +26 -64
- package/docs/contract/events.mdx +13 -74
- package/docs/contract/functions.mdx +40 -126
- package/docs/contract/overview.mdx +17 -36
- package/docs/introduction.mdx +22 -25
- package/docs/mint.json +3 -2
- package/docs/quickstart.mdx +34 -70
- package/docs/system-design.png +0 -0
- package/package.json +7 -6
- package/packages/cli/src/commands/author-view.tsx +87 -2
- package/packages/cli/src/commands/check.tsx +18 -5
- package/packages/cli/src/commands/fix.tsx +25 -12
- package/packages/cli/src/commands/info.tsx +92 -4
- package/packages/cli/src/commands/install.tsx +327 -23
- package/packages/cli/src/commands/push.tsx +112 -0
- package/packages/cli/src/commands/register-agent.tsx +72 -31
- package/packages/cli/src/index.tsx +7 -5
- package/packages/cli/src/services/ens-records.ts +525 -0
- package/packages/cli/src/services/version.ts +156 -5
- package/packages/core/src/benchmarks.ts +116 -0
- package/packages/core/src/constants.ts +18 -6
- package/packages/core/src/model-rankings.ts +40 -15
- package/packages/core/src/types.ts +10 -0
- package/packages/core/src/utils.ts +136 -1
- package/packages/scanner/src/index.ts +2 -1
- package/packages/scanner/src/queue/memory-queue.ts +7 -2
- package/packages/scanner/src/services/benchmark-runner.ts +86 -1
- package/packages/scanner/src/services/fileverse.ts +61 -12
- package/packages/scanner/src/services/openrouter.ts +18 -7
- package/packages/web/.next/BUILD_ID +1 -0
- package/packages/web/.next/app-path-routes-manifest.json +4 -0
- package/packages/web/.next/diagnostics/build-diagnostics.json +6 -0
- package/packages/web/.next/diagnostics/framework.json +1 -0
- package/packages/web/.next/export-marker.json +6 -0
- package/packages/web/.next/images-manifest.json +58 -0
- package/packages/web/.next/next-minimal-server.js.nft.json +1 -0
- package/packages/web/.next/next-server.js.nft.json +1 -0
- package/packages/web/.next/prerender-manifest.json +54 -4
- package/packages/web/.next/required-server-files.json +320 -0
- package/packages/web/.next/routes-manifest.json +53 -1
- package/packages/web/.next/server/app/_not-found/page.js +2 -0
- package/packages/web/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/packages/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/packages/web/.next/server/app/_not-found.html +1 -0
- package/packages/web/.next/server/app/_not-found.meta +8 -0
- package/packages/web/.next/server/app/_not-found.rsc +18 -0
- package/packages/web/.next/server/app/index.html +6 -0
- package/packages/web/.next/server/app/index.meta +7 -0
- package/packages/web/.next/server/app/index.rsc +22 -0
- package/packages/web/.next/server/app/page.js +24 -24
- package/packages/web/.next/server/app/page.js.nft.json +1 -0
- package/packages/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/packages/web/.next/server/chunks/611.js +6 -0
- package/packages/web/.next/server/chunks/778.js +30 -0
- package/packages/web/.next/server/functions-config-manifest.json +4 -0
- package/packages/web/.next/server/interception-route-rewrite-manifest.js +1 -1
- package/packages/web/.next/server/next-font-manifest.js +1 -1
- package/packages/web/.next/server/next-font-manifest.json +1 -1
- package/packages/web/.next/server/pages/404.html +1 -0
- package/packages/web/.next/server/pages/500.html +1 -0
- package/packages/web/.next/server/pages/_app.js +1 -0
- package/packages/web/.next/server/pages/_app.js.nft.json +1 -0
- package/packages/web/.next/server/pages/_document.js +1 -0
- package/packages/web/.next/server/pages/_document.js.nft.json +1 -0
- package/packages/web/.next/server/pages/_error.js +19 -0
- package/packages/web/.next/server/pages/_error.js.nft.json +1 -0
- package/packages/web/.next/server/webpack-runtime.js +2 -2
- package/packages/web/.next/static/0esGzFBCzREfVwijEGDfL/_buildManifest.js +1 -0
- package/packages/web/.next/static/0esGzFBCzREfVwijEGDfL/_ssgManifest.js +1 -0
- package/packages/web/.next/static/chunks/174-5b5efcb3b8efcc01.js +1 -0
- package/packages/web/.next/static/chunks/255-0dc49b7a6e8e5c05.js +1 -0
- package/packages/web/.next/static/chunks/4bd1b696-382748cc942d8a14.js +1 -0
- package/packages/web/.next/static/chunks/app/_not-found/page-0da542be7eb33a64.js +1 -0
- package/packages/web/.next/static/chunks/app/layout-de8e841104500505.js +1 -0
- package/packages/web/.next/static/chunks/app/layout.js +37 -7
- package/packages/web/.next/static/chunks/app/page-7e086379698b9fb0.js +1 -0
- package/packages/web/.next/static/chunks/app/page.js +297 -1
- package/packages/web/.next/static/chunks/framework-ac73abd125e371fe.js +1 -0
- package/packages/web/.next/static/chunks/main-4e8d71b5ef7ee7e3.js +1 -0
- package/packages/web/.next/static/chunks/main-app-dd261207182e5a23.js +1 -0
- package/packages/web/.next/static/chunks/pages/_app-7d307437aca18ad4.js +1 -0
- package/packages/web/.next/static/chunks/pages/_error-cb2a52f75f2162e2.js +1 -0
- package/packages/web/.next/static/chunks/webpack-0dcd67569eb46132.js +1 -0
- package/packages/web/.next/static/chunks/webpack.js +2 -2
- package/packages/web/.next/static/css/102562cf2d0ae9b0.css +3 -0
- package/packages/web/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/packages/web/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/packages/web/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/packages/web/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/packages/web/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/packages/web/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- package/packages/web/.next/static/webpack/16f18baa938a434c.webpack.hot-update.json +1 -0
- package/packages/web/.next/static/webpack/5fe9fe8578f9c3d2.webpack.hot-update.json +1 -0
- package/packages/web/.next/static/webpack/73c7d02260cc80e4.webpack.hot-update.json +1 -0
- package/packages/web/.next/static/webpack/a2d85d19aa028de1.webpack.hot-update.json +1 -0
- package/packages/web/.next/static/webpack/app/{layout.73e341375c8d429e.hot-update.js → layout.16f18baa938a434c.hot-update.js} +1 -1
- package/packages/web/.next/static/webpack/app/{layout.6fee6306e0f98869.hot-update.js → layout.5fe9fe8578f9c3d2.hot-update.js} +1 -1
- package/packages/web/.next/static/webpack/app/layout.653e365406c0d9ac.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/layout.6800169a899e3a8b.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/layout.73c7d02260cc80e4.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/layout.a2d85d19aa028de1.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/page.653e365406c0d9ac.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/page.6800169a899e3a8b.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/page.73c7d02260cc80e4.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/app/page.a2d85d19aa028de1.hot-update.js +22 -0
- package/packages/web/.next/static/webpack/{webpack.6fee6306e0f98869.hot-update.js → webpack.16f18baa938a434c.hot-update.js} +2 -2
- package/packages/web/.next/static/webpack/{webpack.73e341375c8d429e.hot-update.js → webpack.5fe9fe8578f9c3d2.hot-update.js} +2 -2
- package/packages/web/.next/static/webpack/webpack.653e365406c0d9ac.hot-update.js +12 -0
- package/packages/web/.next/static/webpack/webpack.6800169a899e3a8b.hot-update.js +12 -0
- package/packages/web/.next/static/webpack/webpack.73c7d02260cc80e4.hot-update.js +12 -0
- package/packages/web/.next/static/webpack/webpack.a2d85d19aa028de1.hot-update.js +12 -0
- package/packages/web/.next/trace +2 -5
- package/packages/web/app/globals.css +197 -51
- package/packages/web/app/layout.tsx +6 -3
- package/packages/web/app/page.tsx +791 -309
- package/packages/web/bun.lock +66 -105
- package/packages/web/next.config.ts +8 -1
- package/packages/web/package.json +5 -2
- package/packages/web/postcss.config.mjs +2 -2
- package/packages/web/public/apple-icon.png +1 -0
- package/packages/web/public/dependency-bottleneck.png +0 -0
- package/packages/web/public/icon-dark-32x32.png +1 -0
- package/packages/web/public/icon-light-32x32.png +1 -0
- package/packages/web/public/icon.svg +1 -0
- package/packages/web/public/nextjs-cve-announcement.png +0 -0
- package/packages/web/public/phantomraven-npm-attack.png +0 -0
- package/packages/web/public/placeholder-logo.png +1 -0
- package/packages/web/public/placeholder-logo.svg +1 -0
- package/packages/web/public/placeholder-user.jpg +1 -0
- package/packages/web/public/placeholder.jpg +1 -0
- package/packages/web/public/placeholder.svg +1 -0
- package/packages/web/public/react-cve-meme.png +0 -0
- package/packages/web/public/wallet-drain-exploit.png +0 -0
- package/packages/web/styles/globals.css +125 -0
- package/packages/web/.next/server/vendor-chunks/@swc.js +0 -55
- package/packages/web/.next/server/vendor-chunks/next.js +0 -3010
- package/packages/web/.next/static/chunks/app-pages-internals.js +0 -182
- package/packages/web/.next/static/chunks/main-app.js +0 -1882
- package/packages/web/.next/static/css/app/layout.css +0 -1237
- package/packages/web/.next/static/webpack/633457081244afec._.hot-update.json +0 -1
- package/packages/web/.next/static/webpack/app/page.6fee6306e0f98869.hot-update.js +0 -22
- package/packages/web/.next/static/webpack/app/page.73e341375c8d429e.hot-update.js +0 -22
- package/packages/web/tailwind.config.ts +0 -48
- /package/packages/web/.next/static/chunks/{polyfills.js → polyfills-42372ed130431b0a.js} +0 -0
- /package/packages/web/.next/static/webpack/{6fee6306e0f98869.webpack.hot-update.json → 653e365406c0d9ac.webpack.hot-update.json} +0 -0
- /package/packages/web/.next/static/webpack/{73e341375c8d429e.webpack.hot-update.json → 6800169a899e3a8b.webpack.hot-update.json} +0 -0
|
@@ -5,61 +5,35 @@ description: '10 labeled test cases for agent verification.'
|
|
|
5
5
|
|
|
6
6
|
# Benchmark Suite
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Validates agent accuracy before permissionless registration. Agents must score **100% accuracy** and produce a valid ZK proof.
|
|
9
9
|
|
|
10
|
-
## Test
|
|
10
|
+
## Test Cases
|
|
11
11
|
|
|
12
|
-
Each
|
|
12
|
+
Each case includes: package metadata, version history, source files, known CVEs, and expected output (risk level + score range).
|
|
13
13
|
|
|
14
|
-
|
|
|
15
|
-
|-------|-------------|
|
|
16
|
-
| **id** | Unique identifier (e.g. <code>bench-001-clean-utility</code>) |
|
|
17
|
-
| **category** | One of: clean, typosquat, malicious, cve, obfuscated, exfiltration, dependency_confusion |
|
|
18
|
-
| **metadata** | Package name, version, description, author, license, dependencies, scripts |
|
|
19
|
-
| **versionHistory** | Recent versions with publish dates and change summaries |
|
|
20
|
-
| **sourceFiles** | Path, size, and content of source files |
|
|
21
|
-
| **knownCVEs** | Known advisories (for cve category) |
|
|
22
|
-
| **expected** | risk_level, min_risk_score, max_risk_score, must_flag |
|
|
23
|
-
|
|
24
|
-
## Categories (10 Cases)
|
|
25
|
-
|
|
26
|
-
| Category | Count | Description |
|
|
14
|
+
| Category | Cases | Description |
|
|
27
15
|
|----------|-------|-------------|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
16
|
+
| Clean | 3 | Legitimate packages (string utils, math, validator) |
|
|
17
|
+
| Typosquat | 1 | Lodash typosquat with credential exfil in postinstall |
|
|
18
|
+
| Malicious | 2 | Postinstall shell execution, SSH key exfiltration |
|
|
19
|
+
| CVE | 1 | Known prototype pollution vulnerability |
|
|
20
|
+
| Obfuscated | 1 | Heavily obfuscated reverse shell |
|
|
21
|
+
| Exfiltration | 1 | Env var exfiltration on import |
|
|
22
|
+
| Dependency confusion | 1 | Internal scope shadowing with DNS exfil |
|
|
35
23
|
|
|
36
24
|
## Evaluation
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
1. **Score range check**: <code>actualScore</code> must be within <code>[min_risk_score, max_risk_score]</code>
|
|
41
|
-
2. **Risk level ordinal**: For non-LOW cases, <code>actualLevel</code> must be within ±1 of expected ordinal (LOW=0, MEDIUM=1, HIGH=2, CRITICAL=3)
|
|
42
|
-
|
|
43
|
-
A case **PASS**es only if both checks succeed.
|
|
44
|
-
|
|
45
|
-
## ZK Proof Generation
|
|
46
|
-
|
|
47
|
-
The ZK proof proves accuracy **without revealing** test data or individual results:
|
|
48
|
-
|
|
49
|
-
1. **Commitment**: Hash of (salt, expected[0..9]) using Poseidon
|
|
50
|
-
2. **Proof**: Prove that <code>expected[i] == actual[i]</code> for all i, and that the commitment matches
|
|
51
|
-
3. **Output**: <code>proofHash</code> is stored on-chain; test data stays private
|
|
26
|
+
Each case is checked against:
|
|
52
27
|
|
|
53
|
-
|
|
28
|
+
1. **Score range** — `actualScore` within `[min_risk_score, max_risk_score]`
|
|
29
|
+
2. **Risk level** — For non-LOW cases, actual level within ±1 of expected ordinal
|
|
54
30
|
|
|
55
|
-
|
|
31
|
+
A case passes only if both checks succeed.
|
|
56
32
|
|
|
57
|
-
|
|
58
|
-
- **Public input**: commitmentHash (Poseidon hash of salt + expected values)
|
|
59
|
-
- **Public outputs**: passed (1 if all match), proofHash
|
|
33
|
+
## ZK Proof
|
|
60
34
|
|
|
61
|
-
|
|
35
|
+
1. **Commit** — Poseidon hash of (salt, expected[0..9]) → `commitmentHash`
|
|
36
|
+
2. **Prove** — Circuit verifies `expected[i] == actual[i]` for all i, outputs `passed` and `proofHash`
|
|
37
|
+
3. **Store** — `keccak256(proof)` stored on-chain via `registerAgent()`
|
|
62
38
|
|
|
63
|
-
|
|
64
|
-
The circuit is compiled and used for local verification. On-chain registration stores <code>keccak256(proof)</code> as the proof hash; full on-chain ZK verification can be added later.
|
|
65
|
-
</Note>
|
|
39
|
+
Test data stays private — future agents can't game the benchmark.
|
|
@@ -5,54 +5,47 @@ description: 'Monorepo structure and data flow.'
|
|
|
5
5
|
|
|
6
6
|
# Architecture Overview
|
|
7
7
|
|
|
8
|
-
OPM is a monorepo
|
|
8
|
+
OPM is a monorepo. The flow is: **CLI → Scanner → LLM providers → Contract → Base Sepolia**.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Packages
|
|
11
11
|
|
|
12
12
|
| Package | Purpose |
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
13
|
+
|---------|---------|
|
|
14
|
+
| `packages/core` | Types, constants, prompts, benchmarks, risk classification |
|
|
15
|
+
| `packages/scanner` | Agent runner, LLM client, scan queue, benchmark runner, ZK verifier |
|
|
16
|
+
| `packages/cli` | Ink terminal UI, commands, ENS/OSV/npm integration |
|
|
17
|
+
| `packages/contracts` | OPMRegistry.sol, Hardhat config, Circom circuit |
|
|
18
|
+
| `packages/web` | Next.js landing page |
|
|
19
19
|
|
|
20
20
|
## Data Flow
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
│ │ Writer │
|
|
32
|
-
│ └──────┬──────┘
|
|
33
|
-
│ │
|
|
34
|
-
▼ ▼
|
|
35
|
-
┌─────────────┐ ┌─────────────┐
|
|
36
|
-
│ npm / ENS │ │ Base Sepolia│
|
|
37
|
-
└─────────────┘ └─────────────┘
|
|
23
|
+
CLI (push/install/check)
|
|
24
|
+
→ Scanner (parallel agent execution)
|
|
25
|
+
→ LLM providers (OpenRouter / OpenAI)
|
|
26
|
+
→ Contract writer (submitScore, registerPackage)
|
|
27
|
+
→ Base Sepolia
|
|
28
|
+
→ npm registry (publish / install)
|
|
29
|
+
→ ENS (text records, contenthash)
|
|
30
|
+
→ Fileverse (IPFS report upload)
|
|
38
31
|
```
|
|
39
32
|
|
|
40
33
|
## External Services
|
|
41
34
|
|
|
42
35
|
| Service | Purpose |
|
|
43
36
|
|---------|---------|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
52
|
-
## Key
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
37
|
+
| OpenRouter / OpenAI | LLM inference |
|
|
38
|
+
| OSV | CVE/GHSA lookup |
|
|
39
|
+
| Fileverse | IPFS report storage |
|
|
40
|
+
| ChainPatrol | Blocklist fallback |
|
|
41
|
+
| Artificial Analysis | Model intelligence indices |
|
|
42
|
+
| ENS | Identity resolution + text records |
|
|
43
|
+
| npm | Package metadata + tarball download |
|
|
44
|
+
|
|
45
|
+
## Key Entry Points
|
|
46
|
+
|
|
47
|
+
- CLI: `packages/cli/src/index.tsx`
|
|
48
|
+
- Scanner: `packages/scanner/src/index.ts`
|
|
49
|
+
- Contract: `packages/contracts/contracts/OPMRegistry.sol`
|
|
50
|
+
- Benchmarks: `packages/core/src/benchmarks.ts`
|
|
51
|
+
- ZK circuit: `packages/contracts/circuits/accuracy_verifier.circom`
|
|
@@ -5,49 +5,23 @@ description: 'Scan queue, parallel execution, and integrations.'
|
|
|
5
5
|
|
|
6
6
|
# Scanner Engine
|
|
7
7
|
|
|
8
|
-
The scanner
|
|
8
|
+
The scanner coordinates package data fetching, LLM calls, and on-chain score submission.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Scan Queue
|
|
11
11
|
|
|
12
|
-
Scans are enqueued via
|
|
12
|
+
Scans are enqueued via `enqueueScan(packageName, version)`. The queue deduplicates concurrent scans for the same `name@version` and supports local tarball context for pre-publish scans.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
- Supports local tarball context for pre-publish scans (no npm download)
|
|
14
|
+
## Parallel Execution
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Agents run in parallel via <code>Promise.allSettled</code>:
|
|
20
|
-
|
|
21
|
-
- Each agent fetches package data, queries OSV, calls the LLM, and submits its score on-chain
|
|
22
|
-
- Failures in one agent do not block others
|
|
23
|
-
- Aggregate score is the mean of successful submissions (intelligence-weighted when Artificial Analysis API is configured)
|
|
16
|
+
Agents run via `Promise.allSettled` — failures in one agent don't block others. The aggregate score is the mean of successful submissions, intelligence-weighted when the Artificial Analysis API is configured.
|
|
24
17
|
|
|
25
18
|
## Source Code Extraction
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Downloads the tarball from the npm registry, extracts to a temp directory, and reads scannable files (<code>.js</code>, <code>.ts</code>, <code>.mjs</code>, <code>.cjs</code>, <code>.json</code>).
|
|
30
|
-
</Accordion>
|
|
31
|
-
<Accordion title="From local tarball">
|
|
32
|
-
When <code>opm push</code> runs, the packed tarball path is passed. The scanner extracts source from the local file instead of downloading from npm.
|
|
33
|
-
</Accordion>
|
|
34
|
-
</AccordionGroup>
|
|
35
|
-
|
|
36
|
-
## NPM Registry Integration
|
|
37
|
-
|
|
38
|
-
- **Metadata**: Package name, version, description, dependencies, scripts
|
|
39
|
-
- **Version history**: Recent versions with publish dates and change summaries
|
|
40
|
-
- **Tarball URL**: Fetched from <code>versions[version].dist.tarball</code>
|
|
41
|
-
|
|
42
|
-
## Fileverse Upload
|
|
43
|
-
|
|
44
|
-
Audit reports are formatted as Markdown and uploaded via the Fileverse API. The returned URI is set on-chain via <code>setReportURI</code>. Requires <code>FILEVERSE_API_KEY</code>.
|
|
45
|
-
|
|
46
|
-
## Contract Writer
|
|
47
|
-
|
|
48
|
-
The scanner's contract writer:
|
|
20
|
+
- **From npm**: Downloads tarball, extracts to temp dir, reads scannable files (`.js`, `.ts`, `.mjs`, `.cjs`, `.json`)
|
|
21
|
+
- **From local**: During `opm push`, the packed tarball path is passed directly
|
|
49
22
|
|
|
50
|
-
|
|
51
|
-
- **setReportURIOnChain**: Calls <code>OPMRegistry.setReportURI()</code>
|
|
23
|
+
## Integrations
|
|
52
24
|
|
|
53
|
-
|
|
25
|
+
- **npm registry** — Package metadata, version history, tarball URL
|
|
26
|
+
- **Fileverse** — Audit reports formatted as Markdown, uploaded via API, URI set on-chain
|
|
27
|
+
- **Contract writer** — `submitScore()` and `setReportURI()` calls with agent wallet
|
package/docs/cli/audit.mdx
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 'opm audit'
|
|
3
|
-
description: '
|
|
3
|
+
description: 'Quick on-chain + CVE audit for all dependencies.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# opm audit
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Fast security audit — checks on-chain scores and CVEs for all dependencies without running AI agents.
|
|
9
9
|
|
|
10
10
|
## What It Does
|
|
11
11
|
|
|
12
|
-
- Scans all <code>dependencies</code> and <code>devDependencies</code> in <code>package.json</code>
|
|
13
12
|
- Queries OPMRegistry for on-chain risk scores
|
|
14
13
|
- Queries OSV for CVE counts
|
|
15
|
-
-
|
|
14
|
+
- Checks ChainPatrol blocklist for unregistered packages
|
|
16
15
|
- Shows per-package risk level and CVE counts
|
|
17
16
|
|
|
18
17
|
## Output
|
|
19
18
|
|
|
20
19
|
| Column | Description |
|
|
21
20
|
|--------|-------------|
|
|
22
|
-
| Package |
|
|
21
|
+
| Package | `name@version` |
|
|
23
22
|
| On-chain | Risk badge (LOW/MEDIUM/HIGH) or "not in registry" |
|
|
24
|
-
| Author | Truncated wallet address
|
|
25
|
-
| CVEs | Count of known vulnerabilities
|
|
23
|
+
| Author | Truncated wallet address |
|
|
24
|
+
| CVEs | Count of known vulnerabilities |
|
|
26
25
|
|
|
27
|
-
Summary
|
|
26
|
+
Summary: `X high · Y medium · Z low · W unverified · N CVEs`
|
|
28
27
|
|
|
29
28
|
<Tip>
|
|
30
|
-
Use
|
|
29
|
+
Use `opm audit` for a quick overview. Use `opm check` when you need AI analysis and typosquat detection.
|
|
31
30
|
</Tip>
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
No environment variables are required. Uses built-in RPC and contract address.
|
|
32
|
+
No environment variables required.
|
package/docs/cli/check.mdx
CHANGED
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 'opm check'
|
|
3
|
-
description: '
|
|
3
|
+
description: 'Full dependency security scan with AI agents.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# opm check
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Scans all dependencies for typosquats, CVEs, on-chain risk, and AI-detected threats. Optionally uploads a report to Fileverse.
|
|
9
9
|
|
|
10
10
|
## What It Scans
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<Accordion title="CVE lookup (OSV)">
|
|
17
|
-
Queries the OSV API for known vulnerabilities per package and version.
|
|
18
|
-
</Accordion>
|
|
19
|
-
<Accordion title="On-chain score lookup">
|
|
20
|
-
Fetches aggregate risk scores from OPMRegistry for registered packages.
|
|
21
|
-
</Accordion>
|
|
22
|
-
<Accordion title="AI agent analysis">
|
|
23
|
-
Three agents analyze the full dependency list in parallel. Each produces findings, severity, and suggested replacements.
|
|
24
|
-
</Accordion>
|
|
25
|
-
</AccordionGroup>
|
|
26
|
-
|
|
27
|
-
## Report Upload
|
|
28
|
-
|
|
29
|
-
When <code>FILEVERSE_API_KEY</code> is set, the scan report is uploaded to Fileverse (IPFS). The report URI can be set on-chain for packages you publish.
|
|
12
|
+
- **Typosquats** — Levenshtein distance against top npm packages
|
|
13
|
+
- **CVEs** — OSV API lookup for known vulnerabilities per package/version
|
|
14
|
+
- **On-chain scores** — Aggregate risk from OPMRegistry for registered packages
|
|
15
|
+
- **AI analysis** — 3 agents analyze the full dependency list in parallel, producing severity ratings and suggested replacements
|
|
30
16
|
|
|
31
17
|
## Output
|
|
32
18
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
19
|
+
- Per-dependency results: typosquats, CVE counts, on-chain scores, fix versions
|
|
20
|
+
- AI agent findings with severity and suggested replacements
|
|
21
|
+
- Summary: total typosquats, CVEs, high-risk, AI flags
|
|
22
|
+
- Fileverse report link when upload succeeds
|
|
37
23
|
|
|
38
24
|
<Note>
|
|
39
|
-
|
|
25
|
+
Requires `OPENROUTER_API_KEY` or `OPENAI_API_KEY` for AI analysis. Without them, typosquat and CVE checks still run.
|
|
40
26
|
</Note>
|
|
41
27
|
|
|
42
28
|
<Tip>
|
|
43
|
-
Run
|
|
29
|
+
Run `opm fix` to auto-apply the fixes identified by `opm check`.
|
|
44
30
|
</Tip>
|
package/docs/cli/fix.mdx
CHANGED
|
@@ -5,45 +5,25 @@ description: 'Auto-fix typosquats and vulnerable dependencies.'
|
|
|
5
5
|
|
|
6
6
|
# opm fix
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Runs the same scan as `opm check`, then auto-applies fixes to `package.json`.
|
|
9
9
|
|
|
10
10
|
## What It Fixes
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</Accordion>
|
|
16
|
-
<Accordion title="Vulnerable packages">
|
|
17
|
-
Updates packages with CRITICAL or HIGH CVEs to the patched version suggested by OSV.
|
|
18
|
-
</Accordion>
|
|
19
|
-
<Accordion title="AI-suggested replacements">
|
|
20
|
-
When 2+ agents flag a package and suggest a replacement, the fix is applied if the suggestion is valid.
|
|
21
|
-
</Accordion>
|
|
22
|
-
</AccordionGroup>
|
|
12
|
+
- **Typosquats** — Renames to the correct package (e.g. `lodahs` → `lodash`)
|
|
13
|
+
- **Vulnerable packages** — Upgrades to patched versions suggested by OSV
|
|
14
|
+
- **AI-flagged packages** — Applies replacements when 2+ agents agree on a suggestion
|
|
23
15
|
|
|
24
16
|
## Process
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Step title="Collect fixes">
|
|
31
|
-
Builds a list of fixes: typosquat renames, CVE upgrades, and AI-suggested replacements.
|
|
32
|
-
</Step>
|
|
33
|
-
<Step title="Apply to package.json">
|
|
34
|
-
Modifies <code>dependencies</code> and <code>devDependencies</code> with the fixes. Preserves version range prefixes (<code>^</code>, <code>~</code>).
|
|
35
|
-
</Step>
|
|
36
|
-
<Step title="Upload report">
|
|
37
|
-
Optionally uploads the scan report to Fileverse when <code>FILEVERSE_API_KEY</code> is set.
|
|
38
|
-
</Step>
|
|
39
|
-
</Steps>
|
|
40
|
-
|
|
41
|
-
## After Running
|
|
18
|
+
1. Scans all dependencies (same as `opm check`)
|
|
19
|
+
2. Collects fixes: typosquat renames, CVE upgrades, AI-suggested replacements
|
|
20
|
+
3. Modifies `package.json` in place (preserves `^`/`~` prefixes)
|
|
21
|
+
4. Optionally uploads report to Fileverse
|
|
42
22
|
|
|
43
23
|
<Warning>
|
|
44
|
-
|
|
24
|
+
Run `npm install` or `opm install` after `opm fix` to apply changes and update the lockfile.
|
|
45
25
|
</Warning>
|
|
46
26
|
|
|
47
27
|
<Tip>
|
|
48
|
-
Review the diff
|
|
28
|
+
Review the diff before committing. AI replacements require 2+ agent consensus.
|
|
49
29
|
</Tip>
|
package/docs/cli/info.mdx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 'opm info'
|
|
3
|
-
description: '
|
|
3
|
+
description: 'On-chain security metadata and ENS records for a package.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# opm info
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Display on-chain security information for a package: author, checksum, signature, risk scores, agent assessments, audit report, and ENS records.
|
|
9
9
|
|
|
10
10
|
## Usage
|
|
11
11
|
|
|
@@ -21,24 +21,17 @@ opm info lodash@4.17.21
|
|
|
21
21
|
|
|
22
22
|
</CodeGroup>
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## What It Shows
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
| Aggregate score | Mean risk score (0–100) |
|
|
35
|
-
| Safest version | Lowest-risk version in recent releases |
|
|
36
|
-
|
|
37
|
-
## Links
|
|
38
|
-
|
|
39
|
-
- **Fileverse report** — Full AI audit when report URI is set
|
|
40
|
-
- **BaseScan** — Contract and transaction links
|
|
26
|
+
- **Author** — Wallet address with ENS resolution
|
|
27
|
+
- **Checksum** — SHA-256 hash of the tarball
|
|
28
|
+
- **Signature** — ECDSA signature (verified/unverified status)
|
|
29
|
+
- **Agent scores** — Per-agent risk scores with reasoning
|
|
30
|
+
- **Aggregate score** — Mean risk across all agents
|
|
31
|
+
- **Safest version** — Lowest-risk version in recent releases
|
|
32
|
+
- **Report URI** — Link to Fileverse audit report
|
|
33
|
+
- **ENS records** — `opm.*` text records from the author's ENS name (version, checksum, fileverse, risk score, contenthash)
|
|
41
34
|
|
|
42
35
|
<Note>
|
|
43
|
-
If the package
|
|
36
|
+
No environment variables required. If the package isn't in the OPM registry, a warning is shown.
|
|
44
37
|
</Note>
|
package/docs/cli/install.mdx
CHANGED
|
@@ -5,67 +5,55 @@ description: 'Install packages with on-chain security verification.'
|
|
|
5
5
|
|
|
6
6
|
# opm install
|
|
7
7
|
|
|
8
|
-
Install packages with on-chain
|
|
8
|
+
Install packages with on-chain verification, CVE checks, and signature validation.
|
|
9
9
|
|
|
10
10
|
## Usage
|
|
11
11
|
|
|
12
12
|
<CodeGroup>
|
|
13
13
|
|
|
14
|
-
```bash
|
|
14
|
+
```bash Single package
|
|
15
15
|
opm install lodash
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
```bash
|
|
18
|
+
```bash Specific version
|
|
19
19
|
opm install lodash@4.17.21
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
```bash
|
|
22
|
+
```bash ENS-based version
|
|
23
|
+
opm install express@djpai.eth
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash All dependencies
|
|
23
27
|
opm install
|
|
24
28
|
```
|
|
25
29
|
|
|
26
30
|
</CodeGroup>
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- <code>opm i</code> — same as <code>opm install</code>
|
|
31
|
-
- <code>opm add</code> — same as <code>opm install</code>
|
|
32
|
+
**Aliases**: `opm i`, `opm add`
|
|
32
33
|
|
|
33
34
|
## Verification Pipeline
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<Accordion title="On-chain score lookup">
|
|
40
|
-
Fetches aggregate risk score from OPMRegistry. Blocks if score ≥ 70.
|
|
41
|
-
</Accordion>
|
|
42
|
-
<Accordion title="Signature verification">
|
|
43
|
-
Verifies ECDSA signature against tarball checksum for packages in the registry.
|
|
44
|
-
</Accordion>
|
|
45
|
-
<Accordion title="ChainPatrol blocklist">
|
|
46
|
-
For packages not in the OPM registry, falls back to ChainPatrol API. BLOCKED status prevents install.
|
|
47
|
-
</Accordion>
|
|
48
|
-
</AccordionGroup>
|
|
49
|
-
|
|
50
|
-
## Blocking Rules
|
|
36
|
+
1. **CVE check** — Queries OSV for known vulnerabilities. CRITICAL CVEs block install.
|
|
37
|
+
2. **On-chain score** — Fetches aggregate risk from OPMRegistry. Score ≥ 70 blocks install.
|
|
38
|
+
3. **Signature verification** — Verifies ECDSA signature against tarball checksum.
|
|
39
|
+
4. **ChainPatrol** — Blocklist fallback for packages not in the registry.
|
|
51
40
|
|
|
52
|
-
|
|
53
|
-
Installation is **blocked** if:
|
|
54
|
-
- Risk score ≥ 70 (on-chain)
|
|
55
|
-
- Any CRITICAL CVE is present (OSV)
|
|
56
|
-
- ChainPatrol returns BLOCKED (for unregistered packages)
|
|
57
|
-
</Warning>
|
|
41
|
+
If all gates pass, delegates to `npm install`.
|
|
58
42
|
|
|
59
|
-
##
|
|
43
|
+
## ENS Version Resolution
|
|
60
44
|
|
|
61
|
-
|
|
62
|
-
If a package is **not in the OPM registry**, OPM falls back to standard <code>npm install</code> with a warning. ChainPatrol is consulted when available.
|
|
63
|
-
</Note>
|
|
45
|
+
When you specify an ENS name as a version (e.g. `express@djpai.eth`), OPM:
|
|
64
46
|
|
|
65
|
-
|
|
47
|
+
1. Resolves the ENS name to an Ethereum address
|
|
48
|
+
2. Verifies the author is registered on-chain
|
|
49
|
+
3. Fetches the safest version from the registry
|
|
50
|
+
4. Checks for CVEs and auto-bumps to a safe version if needed
|
|
51
|
+
5. Updates `package.json` with the resolved version
|
|
66
52
|
|
|
67
|
-
|
|
53
|
+
<Warning>
|
|
54
|
+
Installation is **blocked** if risk score ≥ 70, any CRITICAL CVE exists, or ChainPatrol returns BLOCKED.
|
|
55
|
+
</Warning>
|
|
68
56
|
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
</
|
|
57
|
+
<Note>
|
|
58
|
+
No environment variables needed. Defaults for RPC and contract address are built-in.
|
|
59
|
+
</Note>
|