trustdex 0.4.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 TrustDex 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 ADDED
@@ -0,0 +1,321 @@
1
+ # TrustDex
2
+
3
+ [![CI](https://github.com/grigent/trustdex/actions/workflows/ci.yml/badge.svg)](https://github.com/grigent/trustdex/actions/workflows/ci.yml)
4
+ [![CodeQL](https://github.com/grigent/trustdex/actions/workflows/codeql.yml/badge.svg)](https://github.com/grigent/trustdex/actions/workflows/codeql.yml)
5
+ [![Release](https://img.shields.io/github/v/release/grigent/trustdex)](https://github.com/grigent/trustdex/releases)
6
+ [![License](https://img.shields.io/github/license/grigent/trustdex)](LICENSE)
7
+
8
+ **A local-first trust and provenance gate for AI agent tools.**
9
+
10
+ TrustDex helps decide which MCP servers, skills, and plugins an AI agent should be allowed to use. Instead of treating every discovered extension as trusted, TrustDex evaluates observable evidence and returns one of three outcomes:
11
+
12
+ - **ALLOW** - matches an explicit trust policy
13
+ - **ASK** - needs human review
14
+ - **BLOCK** - not trusted under the current policy
15
+
16
+ > TrustDex is security-related infrastructure, not a malware scanner, sandbox, or certification service. An ALLOW result only means the inspected evidence matched your policy.
17
+
18
+ > **Project status:** TrustDex is early-stage and seeking pilot users. The security boundary is documented, changes are tested on supported Node.js versions, and compatibility may still evolve before 1.0. See the [roadmap](docs/ROADMAP.md), [governance](GOVERNANCE.md), and [support guide](SUPPORT.md).
19
+
20
+ ## Why TrustDex?
21
+
22
+ AI agents increasingly rely on third-party MCP servers, skills, and plugins that may receive credentials, access files, connect to remote services, or execute local programs. A package being installable does not mean it should automatically become available to an agent.
23
+
24
+ TrustDex adds a decision layer **before tool exposure**:
25
+
26
+ ```text
27
+ User request
28
+ |
29
+ v
30
+ AI agent / Codex
31
+ |
32
+ v
33
+ TrustDex policy + provenance gate
34
+ |-- ALLOW -> tool may be exposed
35
+ |-- ASK -> require human review
36
+ `-- BLOCK -> keep tool unavailable
37
+ ```
38
+
39
+ TrustDex deliberately does not infer "official" status from names, stars, or branding. Provenance must come from explicit, reviewable evidence.
40
+
41
+ ## What the current code can do
42
+
43
+ - inspect MCP server entries locally without uploading configuration
44
+ - distinguish package, remote, local, and unknown sources
45
+ - detect trust-relevant signals such as floating versions, install-on-run launchers, shell execution, filesystem-looking arguments, secret-like environment variable names, and remote endpoints
46
+ - inspect `SKILL.md` files and plugin manifests for trust-relevant metadata/instructions
47
+ - apply built-in `strict`, `official-first`, and `development` policy packs
48
+ - attach explicit publisher/provenance assertions from a local trust store
49
+ - output **ALLOW / ASK / BLOCK** decisions
50
+ - generate a filtered MCP config containing only policy-approved tools
51
+ - create snapshots and detect source, provenance, decision, and capability drift
52
+ - create Ed25519-signed trust records for reviewed snapshots
53
+ - run as a GitHub Action in CI
54
+ - fingerprint MCP entries, skills, and plugin manifests without storing secret values
55
+ - inspect and filter Codex `config.toml` MCP sections
56
+ - perform explicit provenance lookups against GitHub, npm, and the official MCP Registry
57
+ - verify whether the latest GitHub release tag/commit has a GitHub-verified signature
58
+ - create signed review bundles and automatically require re-review when trust-relevant state drifts
59
+ - redact credentials, paths, and query values from remote endpoint details in reports
60
+ - block embedded URL credentials and insecure remote transport under strict policies
61
+ - recognize Windows executable paths and command wrappers consistently across hosts
62
+ - fail closed on unsupported Codex MCP keys and subsections
63
+ - verify user-supplied package bytes against npm SRI or MCP Registry SHA-256 metadata
64
+ - bind integrity-backed trust evidence to the configured package version and block mismatches
65
+
66
+ ## Compatibility
67
+
68
+ TrustDex requires Node.js 20 or newer. CI exercises the full test and gate workflow on Ubuntu with Node.js 20 and 22, and on current Windows and macOS runners with Node.js 22. The checked-out composite GitHub Action has a dedicated end-to-end smoke test.
69
+
70
+ ## Quick start
71
+
72
+ Requires Node.js 20+.
73
+
74
+ ```bash
75
+ git clone https://github.com/grigent/trustdex.git
76
+ cd trustdex
77
+ npm test
78
+ npm run check
79
+
80
+ node ./bin/trustdex.mjs inspect ./examples/mcp.json \
81
+ --pack strict \
82
+ --policy ./examples/trustdex.policy.json
83
+ ```
84
+
85
+ The example intentionally includes an unknown server, so a strict inspection exits non-zero.
86
+
87
+ Exit codes for inspection:
88
+
89
+ - `0` - all entries allowed
90
+ - `1` - at least one entry needs review
91
+ - `2` - at least one entry is blocked, or the command failed
92
+
93
+ ## Built-in policy packs
94
+
95
+ ```bash
96
+ node ./bin/trustdex.mjs policy strict
97
+ node ./bin/trustdex.mjs policy official-first
98
+ node ./bin/trustdex.mjs policy development
99
+ ```
100
+
101
+ `official-first` does **not** maintain a hard-coded list of supposedly official vendors. It allows sources only when they have explicit provenance evidence in your trust store (or when you explicitly allowlist them), while unknown third-party sources remain blocked by default.
102
+
103
+ See [Trust store and provenance](docs/TRUST_STORE.md).
104
+
105
+ ## Filter tools before agent use
106
+
107
+ ```bash
108
+ node ./bin/trustdex.mjs gate ./examples/mcp.json \
109
+ --pack official-first \
110
+ --out .trustdex/gated-mcp.json
111
+ ```
112
+
113
+ By default, only `ALLOW` entries are written to the gated configuration. `ASK` entries stay out until reviewed.
114
+
115
+ This is the core TrustDex boundary: the agent receives the filtered configuration instead of the unreviewed source configuration.
116
+
117
+ ## Inspect skills and plugins
118
+
119
+ ```bash
120
+ node ./bin/trustdex.mjs inspect-skill ./path/to/SKILL.md --pack strict
121
+ node ./bin/trustdex.mjs inspect-plugin ./path/to/plugin.json --pack strict
122
+ ```
123
+
124
+ These checks surface observable trust signals. They do not prove that the extension is safe.
125
+
126
+ ## Codex config.toml
127
+
128
+ Current Codex clients store MCP configuration under `[mcp_servers.<name>]` tables in `config.toml`. TrustDex has a focused adapter for those MCP sections:
129
+
130
+ ```bash
131
+ node ./bin/trustdex.mjs inspect-codex ./examples/codex.config.toml --pack strict
132
+
133
+ node ./bin/trustdex.mjs gate-codex ./examples/codex.config.toml \
134
+ --pack strict \
135
+ --out .trustdex/gated-codex.toml
136
+ ```
137
+
138
+ The gate removes non-approved MCP sections while preserving unrelated TOML sections. TrustDex intentionally parses only the MCP-related TOML constructs it needs; unsupported MCP syntax fails rather than being silently trusted.
139
+
140
+ ## Online provenance observations
141
+
142
+ Normal inspection remains local-only. These commands perform an explicit network lookup only when invoked:
143
+
144
+ ```bash
145
+ node ./bin/trustdex.mjs provenance github modelcontextprotocol/servers
146
+ node ./bin/trustdex.mjs provenance github-release owner/repository
147
+ node ./bin/trustdex.mjs provenance npm @scope/package
148
+ node ./bin/trustdex.mjs provenance mcp io.github.user/server
149
+ ```
150
+
151
+ A lookup is **evidence, not trust**. To turn evidence into a local trust-store claim, the user must explicitly name the publisher:
152
+
153
+ ```bash
154
+ node ./bin/trustdex.mjs trust-source mcp io.github.user/server \
155
+ --publisher "Example Publisher" \
156
+ --out ./trust-store.json
157
+ ```
158
+
159
+ For `github-release`, TrustDex refuses to create a trust claim unless GitHub reports the release tag or target commit signature as verified.
160
+
161
+ ### Verify exact package bytes
162
+
163
+ Registry metadata can identify an expected digest, but metadata alone does not prove that a downloaded file matches it. Supply the exact package archive or artifact you reviewed:
164
+
165
+ ```bash
166
+ node ./bin/trustdex.mjs trust-source npm @scope/package \
167
+ --publisher "Example Publisher" \
168
+ --artifact ./scope-package-1.2.3.tgz \
169
+ --out ./trust-store.json
170
+
171
+ node ./bin/trustdex.mjs trust-source mcp io.github.user/server \
172
+ --publisher "Example Publisher" \
173
+ --artifact ./downloaded-package \
174
+ --out ./trust-store.json
175
+ ```
176
+
177
+ TrustDex reads the file locally and compares its bytes with npm SRI metadata or an MCP Registry SHA-256 digest. It does not download or execute the artifact. Integrity-backed evidence is version-bound; a different configured package version receives `artifact-version-mismatch` and is blocked.
178
+
179
+ ## Provenance trust store
180
+
181
+ Example:
182
+
183
+ ```json
184
+ {
185
+ "version": 1,
186
+ "claims": [
187
+ {
188
+ "type": "package",
189
+ "subject": "example-mcp-server",
190
+ "publisher": "Example Publisher",
191
+ "status": "verified",
192
+ "evidence": {
193
+ "kind": "manual-review",
194
+ "reference": "https://example.invalid/security-review"
195
+ }
196
+ }
197
+ ]
198
+ }
199
+ ```
200
+
201
+ Then:
202
+
203
+ ```bash
204
+ node ./bin/trustdex.mjs inspect ./mcp.json \
205
+ --pack official-first \
206
+ --trust-store ./trust-store.json
207
+ ```
208
+
209
+ Here, `verified` means verified according to the evidence maintained in that trust store. It does not mean OpenAI, TrustDex, GitHub, npm, or another platform certified the extension.
210
+
211
+ ## Capability and provenance drift
212
+
213
+ Save a baseline:
214
+
215
+ ```bash
216
+ node ./bin/trustdex.mjs snapshot ./examples/mcp.json \
217
+ --pack strict \
218
+ --out .trustdex/baseline.json
219
+ ```
220
+
221
+ Save another snapshot after an update and compare them:
222
+
223
+ ```bash
224
+ node ./bin/trustdex.mjs diff .trustdex/baseline.json .trustdex/current.json
225
+ ```
226
+
227
+ TrustDex reports newly added signals, source changes, provenance changes, decision changes, and content/configuration fingerprint changes.
228
+
229
+ For a review workflow, generate a signing key once and approve a non-blocked configuration:
230
+
231
+ ```bash
232
+ node ./bin/trustdex.mjs keygen \
233
+ --private .trustdex/private.pem \
234
+ --public .trustdex/public.pem
235
+
236
+ node ./bin/trustdex.mjs approve ./examples/mcp.json \
237
+ --private .trustdex/private.pem \
238
+ --dir .trustdex/review \
239
+ --pack development
240
+ ```
241
+
242
+ Later, re-evaluate the current configuration against that signed review:
243
+
244
+ ```bash
245
+ node ./bin/trustdex.mjs recheck ./examples/mcp.json \
246
+ --review-dir .trustdex/review \
247
+ --public .trustdex/public.pem
248
+ ```
249
+
250
+ The result is `APPROVED`, `NEEDS_REVIEW`, or `INVALID`. A fingerprint, source, provenance, signal, or policy-relevant change invalidates the previous state match.
251
+
252
+ ## Signed trust records
253
+
254
+ Generate a local signing key:
255
+
256
+ ```bash
257
+ node ./bin/trustdex.mjs keygen \
258
+ --private .trustdex/trustdex-private.pem \
259
+ --public .trustdex/trustdex-public.pem
260
+ ```
261
+
262
+ Sign a reviewed snapshot:
263
+
264
+ ```bash
265
+ node ./bin/trustdex.mjs sign .trustdex/baseline.json \
266
+ --private .trustdex/trustdex-private.pem \
267
+ --out .trustdex/trust-record.json
268
+ ```
269
+
270
+ Verify it later:
271
+
272
+ ```bash
273
+ node ./bin/trustdex.mjs verify .trustdex/trust-record.json \
274
+ --public .trustdex/trustdex-public.pem \
275
+ --snapshot .trustdex/baseline.json
276
+ ```
277
+
278
+ The private key should never be committed.
279
+
280
+ ## GitHub Action
281
+
282
+ ```yaml
283
+ - uses: actions/checkout@v4
284
+
285
+ - uses: grigent/trustdex@v0.4.0
286
+ with:
287
+ config: ./mcp.json
288
+ pack: official-first
289
+ trust-store: ./trust-store.json
290
+ output: .trustdex/gated-mcp.json
291
+ ```
292
+
293
+ For production CI, pin the action to a reviewed commit SHA rather than a moving branch.
294
+
295
+ ## Principles
296
+
297
+ 1. **Local first.** Private agent configuration should not need to leave the machine.
298
+ 2. **No blind trust.** Missing provenance should result in review or denial, not a guessed ALLOW.
299
+ 3. **No secret values in output.** Environment variable names may be reported; values are not.
300
+ 4. **Drift matters.** Approval should not silently survive trust-relevant changes.
301
+ 5. **Simple outcomes.** ALLOW / ASK / BLOCK instead of an opaque risk score.
302
+ 6. **Evidence over branding.** "Official" is not inferred from a familiar name.
303
+ 7. **Vendor neutral.** The policy model should work across Codex and other agent runtimes.
304
+
305
+ ## Roadmap
306
+
307
+ The public roadmap is maintained in [docs/ROADMAP.md](docs/ROADMAP.md). Near-term work focuses on registry integrity verification, reproducible releases, additional agent-runtime adapters, and real-world pilot feedback. Roadmap items are intentions, not promises.
308
+
309
+ ## Security
310
+
311
+ TrustDex does **not** prove that third-party code is safe and does not replace sandboxing, dependency scanning, code review, or least-privilege credentials.
312
+
313
+ See [SECURITY.md](SECURITY.md), [docs/THREAT_MODEL.md](docs/THREAT_MODEL.md), and [docs/TRUST_STORE.md](docs/TRUST_STORE.md).
314
+
315
+ ## Contributing
316
+
317
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md), [GOVERNANCE.md](GOVERNANCE.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md), and [AGENTS.md](AGENTS.md).
318
+
319
+ ## License
320
+
321
+ MIT
package/SECURITY.md ADDED
@@ -0,0 +1,47 @@
1
+ # Security Policy
2
+
3
+ TrustDex is security-related software, but it is not a sandbox, malware scanner, vulnerability scanner, or certification service. An ALLOW decision means only that the observed evidence matched the selected policy.
4
+
5
+ ## Supported versions
6
+
7
+ Security fixes are applied to the main branch. When releases are published, users should upgrade to the latest release; older pre-1.0 releases may not receive backports.
8
+
9
+ | Version | Supported |
10
+ | --- | --- |
11
+ | main | Yes |
12
+ | latest release | Yes |
13
+ | older pre-1.0 releases | No guaranteed backports |
14
+
15
+ ## Report a vulnerability
16
+
17
+ Do not open a public issue for a vulnerability that could put users at risk.
18
+
19
+ Use GitHub Private Vulnerability Reporting from the repository Security tab when it is available. If it is unavailable, contact the maintainer through a private channel listed on the maintainer's GitHub profile. Include only a minimal public issue asking for private contact if no private channel is available; do not include exploit details there.
20
+
21
+ Please include:
22
+
23
+ - affected version or commit
24
+ - minimal reproduction or proof of concept
25
+ - expected and observed behavior
26
+ - realistic impact and prerequisites
27
+ - suggested mitigation, if known
28
+
29
+ The maintainer will validate the report, coordinate a fix, and agree on disclosure timing with the reporter. Response times are best effort because the project is currently maintained by one person.
30
+
31
+ ## Security boundaries
32
+
33
+ TrustDex is designed around:
34
+
35
+ - local-first inspection for ordinary commands
36
+ - explicit network access only for provenance commands
37
+ - no telemetry
38
+ - no secret-value logging
39
+ - redacted remote endpoint reporting
40
+ - conservative ALLOW, ASK, and BLOCK outcomes
41
+ - pinned sources preferred over floating versions
42
+ - re-review when trust-relevant state changes
43
+ - fail-closed handling for unsupported Codex MCP syntax
44
+
45
+ TrustDex does not execute inspected MCP servers during inspection. It does not independently prove that third-party code is non-malicious, that a publisher identity is legitimate, or that a signed review was correct.
46
+
47
+ See docs/THREAT_MODEL.md and docs/ARCHITECTURE.md for the detailed boundary.