trustdex 0.5.1 → 0.7.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.
Files changed (49) hide show
  1. package/README.ko.md +65 -7
  2. package/README.md +71 -7
  3. package/bin/trustdex.mjs +98 -1
  4. package/docs/ARCHITECTURE.ko.md +9 -2
  5. package/docs/ARCHITECTURE.md +11 -2
  6. package/docs/CLAUDE.ko.md +54 -1
  7. package/docs/CLAUDE.md +69 -1
  8. package/docs/CODEX.ko.md +50 -4
  9. package/docs/CODEX.md +62 -4
  10. package/docs/DEFENSIVE_USE_CASE.ko.md +85 -0
  11. package/docs/DEFENSIVE_USE_CASE.md +89 -0
  12. package/docs/EVALUATION.ko.md +46 -1
  13. package/docs/EVALUATION.md +48 -1
  14. package/docs/ROADMAP.ko.md +17 -2
  15. package/docs/ROADMAP.md +17 -2
  16. package/docs/SECURITY_RESEARCH.ko.md +7 -0
  17. package/docs/SECURITY_RESEARCH.md +7 -0
  18. package/docs/THREAT_MODEL.ko.md +8 -1
  19. package/docs/THREAT_MODEL.md +8 -1
  20. package/examples/adversarial/README.ko.md +31 -0
  21. package/examples/adversarial/README.md +31 -0
  22. package/examples/adversarial/drift-after.json +11 -0
  23. package/examples/adversarial/drift-before.json +8 -0
  24. package/examples/adversarial/expected.json +30 -0
  25. package/examples/adversarial/mcp-config.json +32 -0
  26. package/examples/adversarial/permissions/README.ko.md +15 -0
  27. package/examples/adversarial/permissions/README.md +15 -0
  28. package/examples/adversarial/permissions/claude-expanded.settings.json +30 -0
  29. package/examples/adversarial/permissions/claude-restrictive.settings.json +16 -0
  30. package/examples/adversarial/permissions/codex-expanded.toml +13 -0
  31. package/examples/adversarial/permissions/codex-restrictive.toml +13 -0
  32. package/examples/adversarial/permissions/expected.json +18 -0
  33. package/examples/adversarial/policy.json +10 -0
  34. package/examples/claude.mcp.json +24 -0
  35. package/examples/claude.policy.json +6 -0
  36. package/examples/claude.settings.json +26 -0
  37. package/examples/codex.config.toml +16 -0
  38. package/examples/codex.permissions.toml +13 -0
  39. package/examples/mcp.json +22 -0
  40. package/examples/trust-store.example.json +16 -0
  41. package/examples/trustdex.policy.json +14 -0
  42. package/package.json +5 -3
  43. package/schemas/permission-posture-diff-v1.schema.json +78 -0
  44. package/schemas/permission-posture-v1.schema.json +162 -0
  45. package/src/claude-settings.mjs +173 -0
  46. package/src/codex-config.mjs +9 -7
  47. package/src/codex-settings.mjs +247 -0
  48. package/src/policy-packs.mjs +38 -2
  49. package/src/posture.mjs +540 -0
package/README.ko.md CHANGED
@@ -58,7 +58,9 @@ TrustDex는 이름, 스타 수 또는 브랜딩만으로 "공식" 여부를 추
58
58
  - CI에서 GitHub Action으로 실행
59
59
  - 비밀 값을 저장하지 않고 MCP 항목, 스킬 및 플러그인 매니페스트의 지문 생성
60
60
  - Codex `config.toml`의 MCP 섹션 검사 및 필터링
61
+ - 경로 값을 보관하지 않고 Codex 승인, 샌드박스, 네트워크, 쓰기 가능 루트, 웹 검색 및 서브에이전트 설정 검사
61
62
  - 명시적인 전송 방식 검증과 헤더 실행 제어를 포함해 Claude Code MCP JSON 검사 및 필터링
63
+ - 규칙 값을 보관하지 않고 자동 셸, 파일 시스템, 네트워크, MCP 및 서브에이전트 권한에 대해 Claude Code 권한 설정 검사
62
64
  - GitHub, npm 및 공식 MCP Registry를 대상으로 명시적인 출처 조회 수행
63
65
  - 최신 GitHub 릴리스 태그/커밋에 GitHub 검증 서명이 있는지 확인
64
66
  - 서명된 검토 번들을 생성하고 신뢰 관련 상태가 변경되면 자동으로 재검토 요구
@@ -80,8 +82,8 @@ Node.js 20 이상이 필요합니다.
80
82
  npm에서 직접 실행:
81
83
 
82
84
  ```bash
83
- npx trustdex@0.5.0 --help
84
- npx trustdex@0.5.0 inspect ./mcp.json --pack strict --policy ./trustdex.policy.json
85
+ npx trustdex@0.7.0 --help
86
+ npx trustdex@0.7.0 inspect ./mcp.json --pack strict --policy ./trustdex.policy.json
85
87
  ```
86
88
 
87
89
  또는 소스 체크아웃에서 작업:
@@ -120,7 +122,7 @@ node ./bin/trustdex.mjs inspect \
120
122
 
121
123
  직접 검사는 의도적으로 종료 코드 `2`를 반환합니다. 체크인된 기대 결과는 `ALLOW` 1개, `ASK` 1개, `BLOCK` 5개입니다. 자동화된 테스트는 자리표시자 비밀 값이 결과에 나타나지 않는지, 비밀 정보를 포함하는 새 환경 변수가 이전 검토 상태를 무효화하는지도 확인합니다.
122
124
 
123
- [방어적 보안 연구 정책](docs/SECURITY_RESEARCH.ko.md), [평가 기록](docs/EVALUATION.ko.md), [적대적 픽스처 가이드](examples/adversarial/README.ko.md)를 참고하세요.
125
+ [방어적 AI 에이전트 보안 사용 사례](docs/DEFENSIVE_USE_CASE.ko.md), [방어적 보안 연구 정책](docs/SECURITY_RESEARCH.ko.md), [평가 기록](docs/EVALUATION.ko.md), [적대적 픽스처 가이드](examples/adversarial/README.ko.md)를 참고하세요.
124
126
 
125
127
  ## 기본 제공 정책 팩
126
128
 
@@ -169,6 +171,16 @@ node ./bin/trustdex.mjs gate-codex ./examples/codex.config.toml \
169
171
 
170
172
  게이트는 승인되지 않은 MCP 섹션을 제거하면서 관련 없는 TOML 섹션은 유지합니다. TrustDex는 필요한 MCP 관련 TOML 구성만 의도적으로 파싱합니다. 지원하지 않는 MCP 구문은 조용히 신뢰하지 않고 실패합니다.
171
173
 
174
+ MCP 도구와 별도로 에이전트의 실행 경계를 검사하세요.
175
+
176
+ ```bash
177
+ node ./bin/trustdex.mjs inspect-codex-settings \
178
+ ./examples/codex.permissions.toml \
179
+ --pack strict
180
+ ```
181
+
182
+ 이 명령은 승인 정책, 샌드박스 종류, 네트워크 접근, 추가 쓰기 가능 루트 개수, 웹 검색 모드 및 명시적인 서브에이전트 활성화를 보고합니다. 쓰기 가능 경로나 관련 없는 설정의 값은 보관하지 않으며, 모든 설정 범위를 하나의 실제 런타임 정책으로 병합하지 않습니다.
183
+
172
184
  단계별 게이트 워크플로와 이 프로젝트가 자체 검토 과정에서 Codex를 사용하는 방법은 [Codex에서 TrustDex 사용하기](docs/CODEX.ko.md)를 참고하세요.
173
185
 
174
186
  ## Claude Code MCP 설정
@@ -181,10 +193,56 @@ node ./bin/trustdex.mjs gate-claude ./.mcp.json --pack strict --out .trustdex/cl
181
193
  claude --strict-mcp-config --mcp-config .trustdex/claude-mcp.json
182
194
  ```
183
195
 
184
- Claude를 시작하기 전에 게이트의 결과를 확인하세요. 기본적으로 `ALLOW` 항목만 노출되며, `ASK` 항목에는 검토가 필요합니다. 어댑터는 검사할 수 없는 설정을 조용히 신뢰하지 않고 거부합니다. 이 명령은 npm 0.5.0 이상과 소스 체크아웃에서 사용할 수 있습니다. 게시된 CLI를 실행하려면 `node ./bin/trustdex.mjs` 대신 `npx trustdex@0.5.0`을 사용하세요.
196
+ Claude를 시작하기 전에 게이트의 결과를 확인하세요. 기본적으로 `ALLOW` 항목만 노출되며, `ASK` 항목에는 검토가 필요합니다. 어댑터는 검사할 수 없는 설정을 조용히 신뢰하지 않고 거부합니다. 이 명령은 npm 0.5.0 이상과 소스 체크아웃에서 사용할 수 있습니다. 게시된 CLI를 실행하려면 `node ./bin/trustdex.mjs` 대신 `npx trustdex@0.7.0`을 사용하세요.
185
197
 
186
198
  지원되는 설정, PowerShell 오류 처리, 서명된 검토 및 Claude Desktop 워크플로는 [Claude에서 TrustDex 사용하기](docs/CLAUDE.ko.md)를 참고하세요.
187
199
 
200
+ Claude Code 프로젝트 및 사용자 설정은 별도 확인 없이 실행되는 작업을 허용할 수도 있습니다. 문서화된 `permissions` 객체와 인접한 자동 실행 설정을 별도로 검사하세요.
201
+
202
+ ```bash
203
+ node ./bin/trustdex.mjs inspect-claude-settings \
204
+ ./.claude/settings.json \
205
+ --pack strict
206
+ ```
207
+
208
+ 이 명령은 구조적인 기능 증거만 보고합니다. 권한 지정자, 디렉터리 값, 훅 명령, 도메인, 자격 증명 도우미 값 또는 환경 값을 출력하거나 지문에 포함하지 않습니다. 이는 정적 검토 도구이며 설정 병합기나 런타임 샌드박스가 아닙니다.
209
+
210
+ ## 권한 상태 드리프트
211
+
212
+ 각 런타임에 대해 값이 제거된 구조적 기준 상태를 기록한 뒤 에이전트 또는 정책
213
+ 변경 후 상태와 비교할 수 있습니다.
214
+
215
+ ```bash
216
+ node ./bin/trustdex.mjs snapshot-claude-settings \
217
+ ./.claude/settings.json \
218
+ --pack strict \
219
+ --out .trustdex/claude-posture.json
220
+
221
+ node ./bin/trustdex.mjs snapshot-codex-settings \
222
+ ~/.codex/config.toml \
223
+ --pack strict \
224
+ --out .trustdex/codex-posture.json
225
+
226
+ node ./bin/trustdex.mjs diff-permissions \
227
+ .trustdex/approved-posture.json \
228
+ .trustdex/current-posture.json \
229
+ --json
230
+ ```
231
+
232
+ 자동 허용, 쓰기 범위, 네트워크 접근, 서브에이전트, 정책 의미 또는 분류되지 않은
233
+ 설정이 확대되면 `diff-permissions`는 종료 코드 `1`을 반환합니다. 더 제한적으로만
234
+ 변한 경우에는 종료 코드 `0`과 `restricted` 상태를 반환합니다. 스냅샷에는 개수,
235
+ 문서화된 열거 값, 기능 범주, 위험 신호 및 정책 의미 다이제스트만 포함됩니다.
236
+ 입력 경로, 규칙 지정자, 쓰기 가능 경로, 도메인, 명령, 환경 변수 이름과 값 및
237
+ 관련 없는 설정 값은 제외합니다. 값이 제거된 규칙 내용이 같은 개수 안에서 바뀌면
238
+ 감지할 수 없으므로 이는 런타임 강제가 아니라 권고형 CI 검토 게이트입니다.
239
+
240
+ 기계 소비자는 `--json` 출력을
241
+ [`schemas/permission-posture-v1.schema.json`](schemas/permission-posture-v1.schema.json)과
242
+ [`schemas/permission-posture-diff-v1.schema.json`](schemas/permission-posture-diff-v1.schema.json)으로
243
+ 검증할 수 있습니다. 스키마가 바뀌면 새로운 정수 `schemaVersion`을 사용하며 기존
244
+ 필드의 의미를 조용히 바꾸지 않습니다.
245
+
188
246
  ## 온라인 출처 관찰
189
247
 
190
248
  일반 검사는 계속 로컬에서만 수행됩니다. 다음 명령은 명시적으로 실행할 때만 네트워크 조회를 수행합니다.
@@ -330,7 +388,7 @@ node ./bin/trustdex.mjs verify .trustdex/trust-record.json \
330
388
  ```yaml
331
389
  - uses: actions/checkout@v4
332
390
 
333
- - uses: grigent/trustdex@v0.5.0
391
+ - uses: grigent/trustdex@v0.7.0
334
392
  with:
335
393
  config: ./mcp.json
336
394
  pack: official-first
@@ -348,7 +406,7 @@ node ./bin/trustdex.mjs verify .trustdex/trust-record.json \
348
406
  4. **드리프트는 중요합니다.** 신뢰 관련 변경이 발생해도 승인이 조용히 유지되어서는 안 됩니다.
349
407
  5. **단순한 결과.** 불투명한 위험 점수 대신 ALLOW / ASK / BLOCK을 사용합니다.
350
408
  6. **브랜딩보다 증거.** 익숙한 이름만으로 "공식"이라고 추론하지 않습니다.
351
- 7. **공급업체 중립.** 정책 모델은 Codex 및 다른 에이전트 런타임에서도 작동해야 합니다.
409
+ 7. **런타임 중립.** 도구 출처와 에이전트 행동 권한은 Codex와 Claude 모두에서 검토할 수 있어야 하며, 추가 런타임으로 확장할 수 있어야 합니다.
352
410
 
353
411
  ## 로드맵
354
412
 
@@ -358,7 +416,7 @@ node ./bin/trustdex.mjs verify .trustdex/trust-record.json \
358
416
 
359
417
  TrustDex는 서드파티 코드가 안전하다는 것을 **증명하지 않으며**, 샌드박싱, 의존성 검사, 코드 검토 또는 최소 권한 자격 증명을 대체하지 않습니다.
360
418
 
361
- [SECURITY.ko.md](SECURITY.ko.md), [docs/THREAT_MODEL.ko.md](docs/THREAT_MODEL.ko.md), [docs/SECURITY_RESEARCH.ko.md](docs/SECURITY_RESEARCH.ko.md), [docs/EVALUATION.ko.md](docs/EVALUATION.ko.md), [docs/TRUST_STORE.ko.md](docs/TRUST_STORE.ko.md)를 참고하세요.
419
+ [SECURITY.ko.md](SECURITY.ko.md), [docs/THREAT_MODEL.ko.md](docs/THREAT_MODEL.ko.md), [docs/DEFENSIVE_USE_CASE.ko.md](docs/DEFENSIVE_USE_CASE.ko.md), [docs/SECURITY_RESEARCH.ko.md](docs/SECURITY_RESEARCH.ko.md), [docs/EVALUATION.ko.md](docs/EVALUATION.ko.md), [docs/TRUST_STORE.ko.md](docs/TRUST_STORE.ko.md)를 참고하세요.
362
420
 
363
421
  ## 기여
364
422
 
package/README.md CHANGED
@@ -58,7 +58,9 @@ TrustDex deliberately does not infer "official" status from names, stars, or bra
58
58
  - run as a GitHub Action in CI
59
59
  - fingerprint MCP entries, skills, and plugin manifests without storing secret values
60
60
  - inspect and filter Codex `config.toml` MCP sections
61
+ - inspect Codex approval, sandbox, network, writable-root, web-search, and subagent settings without retaining path values
61
62
  - inspect and filter Claude Code MCP JSON with explicit transport validation and header execution controls
63
+ - inspect Claude Code permission settings for automatic shell, filesystem, network, MCP, and subagent grants without retaining rule values
62
64
  - perform explicit provenance lookups against GitHub, npm, and the official MCP Registry
63
65
  - verify whether the latest GitHub release tag/commit has a GitHub-verified signature
64
66
  - create signed review bundles and automatically require re-review when trust-relevant state drifts
@@ -80,8 +82,8 @@ Requires Node.js 20+.
80
82
  Run directly from npm:
81
83
 
82
84
  ```bash
83
- npx trustdex@0.5.0 --help
84
- npx trustdex@0.5.0 inspect ./mcp.json --pack strict --policy ./trustdex.policy.json
85
+ npx trustdex@0.7.0 --help
86
+ npx trustdex@0.7.0 inspect ./mcp.json --pack strict --policy ./trustdex.policy.json
85
87
  ```
86
88
 
87
89
  Or work from a source checkout:
@@ -120,7 +122,7 @@ node ./bin/trustdex.mjs inspect \
120
122
 
121
123
  The direct inspection intentionally exits with code `2`: the checked-in expectation is one `ALLOW`, one `ASK`, and five `BLOCK` decisions. The automated test also verifies that placeholder secret values do not appear in results and that a newly introduced secret-bearing environment variable invalidates the previous review state.
122
124
 
123
- See the [defensive security research policy](docs/SECURITY_RESEARCH.md), [evaluation record](docs/EVALUATION.md), and [adversarial fixture guide](examples/adversarial/README.md).
125
+ See the [defensive AI-agent security use case](docs/DEFENSIVE_USE_CASE.md), [defensive security research policy](docs/SECURITY_RESEARCH.md), [evaluation record](docs/EVALUATION.md), and [adversarial fixture guide](examples/adversarial/README.md).
124
126
 
125
127
  ## Built-in policy packs
126
128
 
@@ -169,6 +171,19 @@ node ./bin/trustdex.mjs gate-codex ./examples/codex.config.toml \
169
171
 
170
172
  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.
171
173
 
174
+ Inspect the agent's execution boundary separately from its MCP tools:
175
+
176
+ ```bash
177
+ node ./bin/trustdex.mjs inspect-codex-settings \
178
+ ./examples/codex.permissions.toml \
179
+ --pack strict
180
+ ```
181
+
182
+ This reports approval policy, sandbox class, network access, additional writable-root
183
+ count, web-search mode, and explicit subagent enablement. It does not retain writable
184
+ paths or values from unrelated settings, and it does not merge every configuration
185
+ scope into an effective runtime policy.
186
+
172
187
  See [Using TrustDex with Codex](docs/CODEX.md) for a step-by-step gating workflow and for how this project uses Codex in its own review process.
173
188
 
174
189
  ## Claude Code MCP configuration
@@ -186,11 +201,60 @@ claude --strict-mcp-config --mcp-config .trustdex/claude-mcp.json
186
201
  Check the gate's result before starting Claude. Only `ALLOW` entries are exposed by
187
202
  default; `ASK` entries require review. The adapter rejects settings it cannot
188
203
  inspect instead of silently trusting them. These commands are available in npm 0.5.0 and later, and from a source checkout.
189
- Use `npx trustdex@0.5.0` in place of `node ./bin/trustdex.mjs` to run the published CLI.
204
+ Use `npx trustdex@0.7.0` in place of `node ./bin/trustdex.mjs` to run the published CLI.
190
205
 
191
206
  See [Using TrustDex with Claude](docs/CLAUDE.md) for supported settings, PowerShell
192
207
  error handling, signed review, and the Claude Desktop workflow.
193
208
 
209
+ Claude Code project and user settings can also grant actions without prompting. Inspect
210
+ the documented `permissions` object and nearby executable settings separately:
211
+
212
+ ```bash
213
+ node ./bin/trustdex.mjs inspect-claude-settings \
214
+ ./.claude/settings.json \
215
+ --pack strict
216
+ ```
217
+
218
+ The command reports structural capability evidence only. It does not print or fingerprint
219
+ permission specifiers, directory values, hook commands, domains, credential-helper values,
220
+ or environment values. It is a static review aid, not a settings merger or runtime sandbox.
221
+
222
+ ## Permission posture drift
223
+
224
+ Record a value-free structural baseline for either runtime, then compare it after an
225
+ agent or policy change:
226
+
227
+ ```bash
228
+ node ./bin/trustdex.mjs snapshot-claude-settings \
229
+ ./.claude/settings.json \
230
+ --pack strict \
231
+ --out .trustdex/claude-posture.json
232
+
233
+ node ./bin/trustdex.mjs snapshot-codex-settings \
234
+ ~/.codex/config.toml \
235
+ --pack strict \
236
+ --out .trustdex/codex-posture.json
237
+
238
+ node ./bin/trustdex.mjs diff-permissions \
239
+ .trustdex/approved-posture.json \
240
+ .trustdex/current-posture.json \
241
+ --json
242
+ ```
243
+
244
+ `diff-permissions` exits `1` when automatic grants, writable scope, network access,
245
+ subagents, policy semantics, or another unclassified setting expands. A change that
246
+ is only more restrictive exits `0` with status `restricted`. Snapshots contain counts,
247
+ documented enums, capability categories, risk signals, and a policy-semantics digest;
248
+ they omit input paths, rule specifiers, writable paths, domains, commands, environment
249
+ names and values, and unrelated setting values. Same-count changes to redacted rule
250
+ contents cannot be detected, so this is an advisory CI review gate rather than runtime
251
+ enforcement.
252
+
253
+ Machine consumers can validate `--json` output against
254
+ [`schemas/permission-posture-v1.schema.json`](schemas/permission-posture-v1.schema.json)
255
+ and [`schemas/permission-posture-diff-v1.schema.json`](schemas/permission-posture-diff-v1.schema.json).
256
+ Schema changes require a new integer `schemaVersion`; fields are not silently repurposed.
257
+
194
258
  ## Online provenance observations
195
259
 
196
260
  Normal inspection remains local-only. These commands perform an explicit network lookup only when invoked:
@@ -336,7 +400,7 @@ The private key should never be committed.
336
400
  ```yaml
337
401
  - uses: actions/checkout@v4
338
402
 
339
- - uses: grigent/trustdex@v0.5.0
403
+ - uses: grigent/trustdex@v0.7.0
340
404
  with:
341
405
  config: ./mcp.json
342
406
  pack: official-first
@@ -354,7 +418,7 @@ For production CI, pin the action to a reviewed commit SHA rather than a moving
354
418
  4. **Drift matters.** Approval should not silently survive trust-relevant changes.
355
419
  5. **Simple outcomes.** ALLOW / ASK / BLOCK instead of an opaque risk score.
356
420
  6. **Evidence over branding.** "Official" is not inferred from a familiar name.
357
- 7. **Vendor neutral.** The policy model should work across Codex and other agent runtimes.
421
+ 7. **Runtime neutral.** Tool provenance and agent-action permissions should be reviewable across both Codex and Claude, with room for additional runtimes.
358
422
 
359
423
  ## Roadmap
360
424
 
@@ -364,7 +428,7 @@ The public roadmap is maintained in [docs/ROADMAP.md](docs/ROADMAP.md). Near-ter
364
428
 
365
429
  TrustDex does **not** prove that third-party code is safe and does not replace sandboxing, dependency scanning, code review, or least-privilege credentials.
366
430
 
367
- See [SECURITY.md](SECURITY.md), [docs/THREAT_MODEL.md](docs/THREAT_MODEL.md), [docs/SECURITY_RESEARCH.md](docs/SECURITY_RESEARCH.md), [docs/EVALUATION.md](docs/EVALUATION.md), and [docs/TRUST_STORE.md](docs/TRUST_STORE.md).
431
+ See [SECURITY.md](SECURITY.md), [docs/THREAT_MODEL.md](docs/THREAT_MODEL.md), [docs/DEFENSIVE_USE_CASE.md](docs/DEFENSIVE_USE_CASE.md), [docs/SECURITY_RESEARCH.md](docs/SECURITY_RESEARCH.md), [docs/EVALUATION.md](docs/EVALUATION.md), and [docs/TRUST_STORE.md](docs/TRUST_STORE.md).
368
432
 
369
433
  ## Contributing
370
434
 
package/bin/trustdex.mjs CHANGED
@@ -6,7 +6,9 @@ import process from 'node:process';
6
6
 
7
7
  import { inspectMcpConfig } from '../src/inspect.mjs';
8
8
  import { parseCodexMcpToml, gateCodexToml } from '../src/codex-config.mjs';
9
+ import { inspectCodexSettingsText } from '../src/codex-settings.mjs';
9
10
  import { parseClaudeMcpConfig } from '../src/claude-config.mjs';
11
+ import { inspectClaudeSettings } from '../src/claude-settings.mjs';
10
12
  import { inspectSkillText, inspectPluginManifest } from '../src/extensions.mjs';
11
13
  import { evaluateAll } from '../src/policy.mjs';
12
14
  import { getPolicyPack, mergePolicy } from '../src/policy-packs.mjs';
@@ -21,6 +23,10 @@ import {
21
23
  verifyArtifactBytes
22
24
  } from '../src/provenance-online.mjs';
23
25
  import { createSnapshot, diffSnapshots } from '../src/snapshot.mjs';
26
+ import {
27
+ createPermissionPostureSnapshot,
28
+ diffPermissionPostureSnapshots
29
+ } from '../src/posture.mjs';
24
30
  import { gateMcpConfig } from '../src/gate.mjs';
25
31
  import { assessReview } from '../src/review.mjs';
26
32
  import {
@@ -43,6 +49,8 @@ Usage:
43
49
  trustdex inspect-plugin <plugin.json> [--pack ...] [--policy policy.json] [--json]
44
50
  trustdex inspect-codex <config.toml> [--pack ...] [--policy policy.json]
45
51
  [--trust-store trust-store.json] [--json]
52
+ trustdex inspect-codex-settings <config.toml> [--pack ...] [--policy policy.json] [--json]
53
+ trustdex snapshot-codex-settings <config.toml> --out posture.json [--pack ...]
46
54
 
47
55
  trustdex gate <mcp.json> --out gated.json [--pack ...] [--policy policy.json]
48
56
  [--trust-store trust-store.json] [--include-ask] [--json]
@@ -50,11 +58,13 @@ Usage:
50
58
  [--trust-store trust-store.json] [--include-ask]
51
59
 
52
60
  trustdex inspect-claude <.mcp.json> [--pack ...] [--policy policy.json] [--json]
61
+ trustdex inspect-claude-settings <settings.json> [--pack ...] [--policy policy.json] [--json]
62
+ trustdex snapshot-claude-settings <settings.json> --out posture.json [--pack ...]
53
63
  trustdex gate-claude <.mcp.json> --out gated.json [--pack ...] [--policy policy.json]
54
64
  trustdex snapshot-claude <.mcp.json> --out snapshot.json [--pack ...]
55
65
  trustdex approve-claude <.mcp.json> --private key.pem --dir review [--pack ...]
56
66
  trustdex recheck-claude <.mcp.json> --review-dir review --public key.pem [--json]
57
- Claude commands accept the same policy/trust-store flags as their generic counterparts.
67
+ Claude MCP commands accept the same policy/trust-store flags as their generic counterparts.
58
68
 
59
69
  trustdex provenance github <owner/repo> [--json]
60
70
  trustdex provenance github-release <owner/repo> [--json]
@@ -75,6 +85,7 @@ Usage:
75
85
  [--policy policy.json] [--trust-store trust-store.json]
76
86
 
77
87
  trustdex diff <before.json> <after.json> [--json]
88
+ trustdex diff-permissions <before.json> <after.json> [--json]
78
89
  trustdex policy <strict|official-first|development>
79
90
 
80
91
  trustdex keygen --private trustdex-private.pem --public trustdex-public.pem
@@ -195,6 +206,25 @@ async function inspectSingle(item, args) {
195
206
  setInspectExitCode(results);
196
207
  }
197
208
 
209
+ async function evaluateClaudeSettings(settingsPath, args) {
210
+ let settings;
211
+ try { settings = await readJson(settingsPath); } catch (error) {
212
+ if (error instanceof SyntaxError) throw new Error('Invalid Claude settings JSON.');
213
+ throw error;
214
+ }
215
+ const policy = await loadPolicy(args);
216
+ const [result] = evaluateAll([inspectClaudeSettings(settings, settingsPath)], policy);
217
+ return { policy, result };
218
+ }
219
+
220
+ async function evaluateCodexSettings(configPath, args) {
221
+ const policy = await loadPolicy(args);
222
+ const [result] = evaluateAll([
223
+ inspectCodexSettingsText(await fs.readFile(configPath, 'utf8'), configPath)
224
+ ], policy);
225
+ return { policy, result };
226
+ }
227
+
198
228
  function printObservation(observation, asJson) {
199
229
  if (asJson) {
200
230
  console.log(JSON.stringify(observation, null, 2));
@@ -220,6 +250,24 @@ function printChanges(changes) {
220
250
  }
221
251
  }
222
252
 
253
+ function printPermissionPostureDiff(diff) {
254
+ if (diff.status === 'unchanged') {
255
+ console.log('UNCHANGED: permission posture matches the baseline.');
256
+ return;
257
+ }
258
+ if (diff.status === 'restricted') {
259
+ console.log('RESTRICTED: permission posture became more restrictive.');
260
+ } else {
261
+ console.log('NEEDS_REVIEW: permission posture expanded or changed in an unclassified way.');
262
+ }
263
+ for (const change of diff.changes) {
264
+ const details = change.items
265
+ ? ` (${change.items.join(', ')})`
266
+ : Object.hasOwn(change, 'before') ? ` (${String(change.before)} -> ${String(change.after)})` : '';
267
+ console.log(`${change.impact.toUpperCase()} ${change.type}: ${change.field}${details}`);
268
+ }
269
+ }
270
+
223
271
  async function main() {
224
272
  const args = process.argv.slice(2);
225
273
  const command = args[0];
@@ -263,6 +311,15 @@ async function main() {
263
311
  return;
264
312
  }
265
313
 
314
+ if (command === 'inspect-claude-settings') {
315
+ const settingsPath = args[1];
316
+ if (!settingsPath) throw new Error('inspect-claude-settings requires a path to Claude settings JSON.');
317
+ const { result } = await evaluateClaudeSettings(settingsPath, args);
318
+ printResults([result], hasFlag(args, '--json'));
319
+ setInspectExitCode([result]);
320
+ return;
321
+ }
322
+
266
323
  if (command === 'inspect-codex') {
267
324
  const configPath = args[1];
268
325
  if (!configPath) throw new Error('inspect-codex requires a path to Codex config.toml.');
@@ -272,6 +329,46 @@ async function main() {
272
329
  return;
273
330
  }
274
331
 
332
+ if (command === 'inspect-codex-settings') {
333
+ const configPath = args[1];
334
+ if (!configPath) throw new Error('inspect-codex-settings requires a path to Codex config.toml.');
335
+ const { result } = await evaluateCodexSettings(configPath, args);
336
+ printResults([result], hasFlag(args, '--json'));
337
+ setInspectExitCode([result]);
338
+ return;
339
+ }
340
+
341
+ if (command === 'snapshot-claude-settings' || command === 'snapshot-codex-settings') {
342
+ const configPath = args[1];
343
+ const out = getFlag(args, '--out');
344
+ if (!configPath || !out) {
345
+ throw new Error(`${command} requires a settings path and --out <posture.json>.`);
346
+ }
347
+ const { policy, result } = command === 'snapshot-claude-settings'
348
+ ? await evaluateClaudeSettings(configPath, args)
349
+ : await evaluateCodexSettings(configPath, args);
350
+ const snapshot = createPermissionPostureSnapshot(result, policy);
351
+ await writeFileSafe(out, `${JSON.stringify(snapshot, null, 2)}\n`);
352
+ console.log(`Wrote ${out}\nDigest: ${snapshot.digest}`);
353
+ return;
354
+ }
355
+
356
+ if (command === 'diff-permissions') {
357
+ const beforePath = args[1];
358
+ const afterPath = args[2];
359
+ if (!beforePath || !afterPath) {
360
+ throw new Error('diff-permissions requires <before.json> <after.json>.');
361
+ }
362
+ const diff = diffPermissionPostureSnapshots(
363
+ await readJson(beforePath),
364
+ await readJson(afterPath)
365
+ );
366
+ if (hasFlag(args, '--json')) console.log(JSON.stringify(diff, null, 2));
367
+ else printPermissionPostureDiff(diff);
368
+ if (diff.status === 'needs-review') process.exitCode = 1;
369
+ return;
370
+ }
371
+
275
372
  if (command === 'gate-codex') {
276
373
  const configPath = args[1];
277
374
  const out = getFlag(args, '--out');
@@ -8,12 +8,12 @@ TrustDex는 관찰, 정책, 게이트 및 검토 증거를 분리하는 의존
8
8
 
9
9
  ## 데이터 흐름
10
10
 
11
- 1. 어댑터가 MCP JSON 파일, Codex TOML의 제한된 하위 집합, 스킬 또는 플러그인 매니페스트를 읽습니다.
11
+ 1. 어댑터가 MCP JSON 파일, Codex TOML의 제한된 하위 집합, Claude/Codex 권한 설정 파일, 스킬 또는 플러그인 매니페스트를 읽습니다.
12
12
  2. 검사가 소스를 정규화하고 관찰 가능한 신호를 생성합니다. 비밀 값은 보고서에 보관하지 않습니다.
13
13
  3. 선택적인 신뢰 저장소 주장이 명시적인 출처 증거를 연결합니다.
14
14
  4. 정책 엔진이 ALLOW, ASK 또는 BLOCK을 생성합니다.
15
15
  5. 게이트가 승인된 설정만 출력합니다.
16
- 6. 스냅샷과 서명된 신뢰 기록을 통해 이후 드리프트를 검토할 수 있습니다.
16
+ 6. MCP 스냅샷, 권한 상태 스냅샷 및 서명된 신뢰 기록을 통해 이후 드리프트를 검토할 수 있습니다.
17
17
 
18
18
  게이트가 강제 적용 경계입니다. 보고서만으로는 에이전트가 검토되지 않은 확장을 불러오는 것을 막을 수 없습니다.
19
19
 
@@ -23,12 +23,15 @@ TrustDex는 관찰, 정책, 게이트 및 검토 증거를 분리하는 의존
23
23
  | --- | --- |
24
24
  | `src/inspect.mjs` | MCP 소스 분류, 민감 정보 제거, 지문 생성 및 신호 |
25
25
  | `src/codex-config.mjs` | 안전하게 실패하는 Codex MCP 전용 파싱 및 섹션 필터링 |
26
+ | `src/codex-settings.mjs` | Codex 승인, 샌드박스, 네트워크, 쓰기 가능 루트, 웹 검색 및 서브에이전트 설정 검사 |
27
+ | `src/claude-settings.mjs` | Claude Code 권한 규칙 및 인접 자동 실행 설정 검사 |
26
28
  | `src/extensions.mjs` | 스킬 및 플러그인 매니페스트 검사 |
27
29
  | `src/provenance.mjs` | 명시적인 로컬 신뢰 저장소 주장 |
28
30
  | `src/provenance-online.mjs` | 사용자가 호출하는 GitHub, npm 및 MCP Registry 관찰과 로컬 아티팩트 다이제스트 검증 |
29
31
  | `src/policy.mjs` | 단조로운 정책 평가. 신호는 심각도를 높일 수 있음 |
30
32
  | `src/gate.mjs` | 승인된 MCP 항목만 출력 |
31
33
  | `src/snapshot.mjs` | 결정론적 신뢰 관련 상태 및 드리프트 |
34
+ | `src/posture.mjs` | 값이 제거된 Claude/Codex 권한 상태 스냅샷 및 자율성 확대 분류 |
32
35
  | `src/trust-record.mjs` | Ed25519 검토 기록 서명 및 검증 |
33
36
  | `src/review.mjs` | 서명된 기준선 비교 |
34
37
 
@@ -36,12 +39,16 @@ TrustDex는 관찰, 정책, 게이트 및 검토 증거를 분리하는 의존
36
39
 
37
40
  - 검사는 검사 대상 확장을 실행해서는 안 됩니다.
38
41
  - 비밀 값은 출력하거나 스냅샷에 저장해서는 안 됩니다.
42
+ - 권한 규칙 값, 쓰기 가능 루트 경로, 훅/도우미 본문 및 관련 없는 설정 값은 에이전트 설정 보고서에 보관해서는 안 됩니다.
43
+ - 권한 상태 스냅샷은 소스 경로와 설정 값을 제외해야 하며, 새 자율성 또는 정책 의미 변경은 검토를 요구해야 합니다.
39
44
  - 알 수 없는 증거가 신뢰로 바뀌어서는 안 됩니다.
40
45
  - 차단 신호의 심각도를 출처 정보로 낮춰서는 안 됩니다.
41
46
  - 지원하지 않는 보안 관련 구문은 안전하게 실패해야 합니다.
42
47
  - 네트워크 조회는 명시적으로 수행하며, 관찰은 승인이 아닙니다.
43
48
  - ALLOW는 정책 결과이지 안전 인증이 아닙니다.
44
49
 
50
+ 설정 검사는 현재 권고 기능입니다. 한 번에 설정 소스 파일 하나를 읽으며 병합된 실제 런타임 정책을 계산하지 않습니다. MCP 게이트는 구현된 강제 적용 경계로 유지되고, 에이전트 작업은 운영체제 및 런타임 샌드박스가 강제합니다.
51
+
45
52
  ## 의존성 정책
46
53
 
47
54
  현재 런타임 코드는 Node.js 기본 제공 기능만 사용합니다. 새로운 의존성을 추가하려면 해당 기능을 플랫폼만으로 합리적으로 구현할 수 없는 이유, 패키지의 유지관리 및 보안 상태, 공급망 경계에 미치는 영향을 설명하는 이슈가 필요합니다.
@@ -8,12 +8,12 @@ TrustDex is a dependency-free Node.js CLI that separates observation, policy, ga
8
8
 
9
9
  ## Data flow
10
10
 
11
- 1. An adapter reads an MCP JSON file, a focused Codex TOML subset, a skill, or a plugin manifest.
11
+ 1. An adapter reads an MCP JSON file, a focused Codex TOML subset, a Claude/Codex permission settings file, a skill, or a plugin manifest.
12
12
  2. Inspection normalizes the source and emits observable signals. Secret values are not retained in reports.
13
13
  3. Optional trust-store claims attach explicit provenance evidence.
14
14
  4. The policy engine produces ALLOW, ASK, or BLOCK.
15
15
  5. A gate emits only the approved configuration.
16
- 6. Snapshots and signed trust records make later drift reviewable.
16
+ 6. MCP snapshots, permission posture snapshots, and signed trust records make later drift reviewable.
17
17
 
18
18
  The gate is the enforcement boundary. Reports alone do not prevent an agent from loading an unreviewed extension.
19
19
 
@@ -23,12 +23,15 @@ The gate is the enforcement boundary. Reports alone do not prevent an agent from
23
23
  | --- | --- |
24
24
  | src/inspect.mjs | MCP source classification, redaction, fingerprinting, and signals |
25
25
  | src/codex-config.mjs | Focused fail-closed Codex MCP parsing and section filtering |
26
+ | src/codex-settings.mjs | Codex approval, sandbox, network, writable-root, web-search, and subagent settings inspection |
27
+ | src/claude-settings.mjs | Claude Code permission rules and adjacent executable settings inspection |
26
28
  | src/extensions.mjs | Skill and plugin manifest inspection |
27
29
  | src/provenance.mjs | Explicit local trust-store claims |
28
30
  | src/provenance-online.mjs | User-invoked GitHub, npm, and MCP Registry observations plus local artifact-digest verification |
29
31
  | src/policy.mjs | Monotonic policy evaluation; signals may raise severity |
30
32
  | src/gate.mjs | Output only approved MCP entries |
31
33
  | src/snapshot.mjs | Deterministic trust-relevant state and drift |
34
+ | src/posture.mjs | Value-free Claude/Codex permission posture snapshots and autonomy-expansion classification |
32
35
  | src/trust-record.mjs | Ed25519 review-record signing and verification |
33
36
  | src/review.mjs | Signed-baseline comparison |
34
37
 
@@ -36,12 +39,18 @@ The gate is the enforcement boundary. Reports alone do not prevent an agent from
36
39
 
37
40
  - Inspection must not execute the inspected extension.
38
41
  - Secret values must not be printed or stored in snapshots.
42
+ - Permission rule values, writable-root paths, hook/helper bodies, and unrelated settings values must not be retained in agent-settings reports.
43
+ - Permission posture snapshots must omit source paths and setting values; new autonomy or changed policy semantics must require review.
39
44
  - Unknown evidence must not become trust.
40
45
  - A blocking signal must not be lowered by provenance.
41
46
  - Unsupported security-relevant syntax must fail closed.
42
47
  - Network lookup is explicit and observation is not approval.
43
48
  - ALLOW is a policy result, not a safety certification.
44
49
 
50
+ Settings inspection is currently advisory. It reads one source file at a time and does
51
+ not calculate the merged effective runtime policy. MCP gates remain the implemented
52
+ enforcement boundary; operating-system and runtime sandboxes enforce agent actions.
53
+
45
54
  ## Dependency policy
46
55
 
47
56
  Runtime code currently uses only Node.js built-ins. A new dependency requires an issue explaining why the feature cannot reasonably be implemented with the platform, the package's maintenance and security posture, and the effect on the supply-chain boundary.
package/docs/CLAUDE.ko.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  TrustDex는 Claude Code 또는 Claude Desktop이 MCP JSON을 받기 전에 이를 검사할 수 있습니다. 설정 증거를 로컬에서 평가하고, MCP 서버를 시작하지 않으며, 설정을 업로드하지 않습니다. ALLOW 결정은 증거가 정책과 일치한다는 뜻이며 서버 코드가 안전하다는 것을 증명하지 않습니다.
8
8
 
9
- Claude 전용 명령은 TrustDex 0.5.0 이상에서 사용할 수 있습니다. 게시된 CLI를 실행하려면 아래 예제의 `node ./bin/trustdex.mjs` 대신 `npx trustdex@0.5.0`을 사용하거나, 소스 체크아웃에서 명령을 직접 사용하세요.
9
+ Claude 전용 명령은 TrustDex 0.5.0 이상에서 사용할 수 있습니다. 게시된 CLI를 실행하려면 아래 예제의 `node ./bin/trustdex.mjs` 대신 `npx trustdex@0.7.0`을 사용하거나, 소스 체크아웃에서 명령을 직접 사용하세요.
10
10
 
11
11
  ## 지원되는 설정
12
12
 
@@ -61,6 +61,59 @@ claude --strict-mcp-config --mcp-config ./.trustdex/claude-mcp.json
61
61
 
62
62
  공식 참고 자료: [Claude Code MCP](https://code.claude.com/docs/en/mcp) 및 [CLI 플래그](https://code.claude.com/docs/en/cli-reference).
63
63
 
64
+ ## Claude Code 권한 설정
65
+
66
+ MCP 게이트는 노출되는 외부 서버를 제어합니다. Claude Code 자체 권한 규칙은 별도 확인 없이 실행되는 에이전트 작업을 따로 제어합니다. 사용자, 프로젝트, 로컬 또는 관리형 설정 파일을 별도 단계로 검사하세요.
67
+
68
+ ```bash
69
+ node ./bin/trustdex.mjs inspect-claude-settings \
70
+ ./.claude/settings.json \
71
+ --pack strict \
72
+ --json
73
+ ```
74
+
75
+ 어댑터는 문서화된 `permissions` 필드인 `allow`, `ask`, `deny`, `defaultMode`, `additionalDirectories`, `disableBypassPermissionsMode`, `disableAutoMode` 및 `blockReadsOutsideWorkingDirectories`를 검증합니다. 알 수 없는 권한 필드, 잘못된 규칙 배열, 빈 규칙, 지원하지 않는 모드, 고정되지 않은 와일드카드 허용 규칙 및 괄호가 있는 MCP 규칙은 안전하게 실패합니다.
76
+
77
+ 자동 권한은 값을 그대로 출력하는 대신 기능 종류에 따라 분류합니다.
78
+
79
+ | 관찰된 설정 | 엄격한 정책 결과 |
80
+ | --- | --- |
81
+ | 좁은 셸 자동 승인 | `BLOCK` |
82
+ | 광범위한 셸, 파일 시스템, 네트워크 또는 서브에이전트 자동 승인 | `BLOCK` |
83
+ | 파일 시스템, 네트워크, MCP 또는 서브에이전트 자동 승인 | 최소 `ASK` |
84
+ | `bypassPermissions` 기본 모드 | `BLOCK` |
85
+ | `auto` 또는 `acceptEdits` 기본 모드 | 최소 `ASK` |
86
+ | 추가 디렉터리 또는 명시적으로 허용된 작업 디렉터리 외부 읽기 | 최소 `ASK` |
87
+ | 훅 또는 API 키 도우미 | `BLOCK` |
88
+ | 환경, 샌드박스, 플러그인 또는 검사하지 않은 루트 설정 | 최소 `ASK` |
89
+
90
+ `ask`와 `deny` 규칙은 제한적이므로 그 자체로 위험 신호를 추가하지 않습니다. 보고서에는 규칙 개수와 기능 범주가 포함되지만 명령 패턴, 경로, 도메인, 훅 본문, 도우미 명령, 디렉터리 값, 환경 값 또는 플러그인 식별자는 포함되지 않습니다. 같은 이유로 이 첫 번째 어댑터는 설정 파일용 콘텐츠 지문이나 서명된 검토 기록을 만들지 않습니다.
91
+
92
+ 이 명령은 한 번에 파일 하나만 검사합니다. Claude Code는 여러 범위의 설정을 병합하고 명령줄 플래그가 세션 권한을 추가할 수 있으므로 이 결과가 실제 런타임 정책은 아닙니다. Claude Code에서 로드된 소스와 권한을 확인하고 강제 적용에는 운영체제 수준 샌드박싱을 사용하세요. 공식 참고 자료: [설정 파일 및 우선순위](https://code.claude.com/docs/en/settings), [권한](https://code.claude.com/docs/en/permissions), [보안](https://code.claude.com/docs/en/security).
93
+
94
+ ### 권한 상태 드리프트
95
+
96
+ 검토 후 기준 상태를 만들고 나중의 설정 상태와 비교하세요.
97
+
98
+ ```bash
99
+ node ./bin/trustdex.mjs snapshot-claude-settings \
100
+ ./.claude/settings.json \
101
+ --pack strict \
102
+ --out .trustdex/claude-posture.json
103
+
104
+ node ./bin/trustdex.mjs diff-permissions \
105
+ .trustdex/approved-claude-posture.json \
106
+ .trustdex/current-claude-posture.json
107
+ ```
108
+
109
+ 새 자동 도구 범주, 추가 규칙이나 디렉터리, 완화된 보호 스위치, 더 위험한 기본
110
+ 모드, 새 위험 신호 또는 정책 의미 변경은 `NEEDS_REVIEW`와 종료 코드 `1`을
111
+ 반환합니다. 제한적으로만 변한 경우 `RESTRICTED`와 종료 코드 `0`을 반환합니다.
112
+ 스냅샷은 소스 경로와 모든 권한, 훅, 디렉터리, 도메인, 자격 증명 도우미,
113
+ 플러그인 및 환경 값을 제외합니다. 제거된 규칙 내용을 의도적으로 지문화하지
114
+ 않으므로 같은 기능 범주 안에서 규칙 개수는 같고 내용만 바뀌는 경우에는 소스
115
+ 검토나 런타임 제어가 계속 필요합니다.
116
+
64
117
  ## 서명된 검토 및 드리프트
65
118
 
66
119
  검토 워크플로 전체에서 Claude 어댑터를 유지하세요. 일반 MCP 명령은 Claude 전용 제어를 검사하지 않습니다.