@orygn/opa-mcp 0.4.0 → 0.5.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 (146) hide show
  1. package/CHANGELOG.md +339 -3
  2. package/README.md +71 -72
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +8 -3
  5. package/dist/cli.js.map +1 -1
  6. package/dist/config.d.ts +1 -1
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +57 -15
  9. package/dist/config.js.map +1 -1
  10. package/dist/lib/bundle-signatures.d.ts +23 -0
  11. package/dist/lib/bundle-signatures.d.ts.map +1 -0
  12. package/dist/lib/bundle-signatures.js +152 -0
  13. package/dist/lib/bundle-signatures.js.map +1 -0
  14. package/dist/lib/child-env.d.ts +9 -2
  15. package/dist/lib/child-env.d.ts.map +1 -1
  16. package/dist/lib/child-env.js +38 -6
  17. package/dist/lib/child-env.js.map +1 -1
  18. package/dist/lib/conftest-cli.d.ts +25 -10
  19. package/dist/lib/conftest-cli.d.ts.map +1 -1
  20. package/dist/lib/conftest-cli.js +152 -33
  21. package/dist/lib/conftest-cli.js.map +1 -1
  22. package/dist/lib/install-id.d.ts.map +1 -1
  23. package/dist/lib/install-id.js +18 -3
  24. package/dist/lib/install-id.js.map +1 -1
  25. package/dist/lib/json-stream.d.ts +26 -0
  26. package/dist/lib/json-stream.d.ts.map +1 -0
  27. package/dist/lib/json-stream.js +69 -0
  28. package/dist/lib/json-stream.js.map +1 -0
  29. package/dist/lib/opa-cli.d.ts +64 -16
  30. package/dist/lib/opa-cli.d.ts.map +1 -1
  31. package/dist/lib/opa-cli.js +98 -28
  32. package/dist/lib/opa-cli.js.map +1 -1
  33. package/dist/lib/opa-paths.d.ts +24 -0
  34. package/dist/lib/opa-paths.d.ts.map +1 -0
  35. package/dist/lib/opa-paths.js +97 -0
  36. package/dist/lib/opa-paths.js.map +1 -0
  37. package/dist/lib/regal-cli.d.ts +16 -1
  38. package/dist/lib/regal-cli.d.ts.map +1 -1
  39. package/dist/lib/regal-cli.js +40 -6
  40. package/dist/lib/regal-cli.js.map +1 -1
  41. package/dist/lib/rego-ast-walker.d.ts.map +1 -1
  42. package/dist/lib/rego-ast-walker.js +141 -17
  43. package/dist/lib/rego-ast-walker.js.map +1 -1
  44. package/dist/lib/rego-counterexample.d.ts +1 -1
  45. package/dist/lib/rego-counterexample.d.ts.map +1 -1
  46. package/dist/lib/rego-counterexample.js +23 -5
  47. package/dist/lib/rego-counterexample.js.map +1 -1
  48. package/dist/lib/rego-ir.d.ts +32 -2
  49. package/dist/lib/rego-ir.d.ts.map +1 -1
  50. package/dist/lib/rego-smt-encoder.d.ts +53 -5
  51. package/dist/lib/rego-smt-encoder.d.ts.map +1 -1
  52. package/dist/lib/rego-smt-encoder.js +192 -26
  53. package/dist/lib/rego-smt-encoder.js.map +1 -1
  54. package/dist/lib/rego-type-inferencer.d.ts +1 -1
  55. package/dist/lib/rego-type-inferencer.d.ts.map +1 -1
  56. package/dist/lib/rego-type-inferencer.js +3 -3
  57. package/dist/lib/rego-type-inferencer.js.map +1 -1
  58. package/dist/lib/rego-verify-engine.d.ts.map +1 -1
  59. package/dist/lib/rego-verify-engine.js +109 -77
  60. package/dist/lib/rego-verify-engine.js.map +1 -1
  61. package/dist/lib/rego-z3.d.ts +10 -0
  62. package/dist/lib/rego-z3.d.ts.map +1 -1
  63. package/dist/lib/rego-z3.js +38 -0
  64. package/dist/lib/rego-z3.js.map +1 -1
  65. package/dist/lib/security.d.ts +8 -0
  66. package/dist/lib/security.d.ts.map +1 -1
  67. package/dist/lib/security.js +130 -54
  68. package/dist/lib/security.js.map +1 -1
  69. package/dist/resources/patterns.d.ts +1 -1
  70. package/dist/resources/patterns.d.ts.map +1 -1
  71. package/dist/resources/patterns.js +40 -12
  72. package/dist/resources/patterns.js.map +1 -1
  73. package/dist/server.d.ts.map +1 -1
  74. package/dist/server.js +10 -2
  75. package/dist/server.js.map +1 -1
  76. package/dist/tools/bundles/build.d.ts.map +1 -1
  77. package/dist/tools/bundles/build.js +12 -4
  78. package/dist/tools/bundles/build.js.map +1 -1
  79. package/dist/tools/bundles/sign.d.ts +9 -2
  80. package/dist/tools/bundles/sign.d.ts.map +1 -1
  81. package/dist/tools/bundles/sign.js +145 -19
  82. package/dist/tools/bundles/sign.js.map +1 -1
  83. package/dist/tools/bundles/verify.d.ts +1 -1
  84. package/dist/tools/bundles/verify.d.ts.map +1 -1
  85. package/dist/tools/bundles/verify.js +58 -19
  86. package/dist/tools/bundles/verify.js.map +1 -1
  87. package/dist/tools/conftest/pull.d.ts.map +1 -1
  88. package/dist/tools/conftest/pull.js +24 -10
  89. package/dist/tools/conftest/pull.js.map +1 -1
  90. package/dist/tools/conftest/push.d.ts.map +1 -1
  91. package/dist/tools/conftest/push.js +17 -7
  92. package/dist/tools/conftest/push.js.map +1 -1
  93. package/dist/tools/conftest/test.d.ts +10 -6
  94. package/dist/tools/conftest/test.d.ts.map +1 -1
  95. package/dist/tools/conftest/test.js +47 -24
  96. package/dist/tools/conftest/test.js.map +1 -1
  97. package/dist/tools/conftest/verify.d.ts +10 -6
  98. package/dist/tools/conftest/verify.d.ts.map +1 -1
  99. package/dist/tools/conftest/verify.js +30 -18
  100. package/dist/tools/conftest/verify.js.map +1 -1
  101. package/dist/tools/evaluation/bench.d.ts +16 -0
  102. package/dist/tools/evaluation/bench.d.ts.map +1 -1
  103. package/dist/tools/evaluation/bench.js +30 -5
  104. package/dist/tools/evaluation/bench.js.map +1 -1
  105. package/dist/tools/evaluation/exec.d.ts +16 -0
  106. package/dist/tools/evaluation/exec.d.ts.map +1 -1
  107. package/dist/tools/evaluation/exec.js +35 -2
  108. package/dist/tools/evaluation/exec.js.map +1 -1
  109. package/dist/tools/evaluation/test-multiroot.d.ts +4 -0
  110. package/dist/tools/evaluation/test-multiroot.d.ts.map +1 -1
  111. package/dist/tools/evaluation/test-multiroot.js +12 -2
  112. package/dist/tools/evaluation/test-multiroot.js.map +1 -1
  113. package/dist/tools/evaluation/test.d.ts +45 -0
  114. package/dist/tools/evaluation/test.d.ts.map +1 -1
  115. package/dist/tools/evaluation/test.js +146 -27
  116. package/dist/tools/evaluation/test.js.map +1 -1
  117. package/dist/tools/helpers/coverage-gaps.d.ts +11 -3
  118. package/dist/tools/helpers/coverage-gaps.d.ts.map +1 -1
  119. package/dist/tools/helpers/coverage-gaps.js +4 -3
  120. package/dist/tools/helpers/coverage-gaps.js.map +1 -1
  121. package/dist/tools/helpers/explain-undefined.d.ts +9 -3
  122. package/dist/tools/helpers/explain-undefined.d.ts.map +1 -1
  123. package/dist/tools/helpers/explain-undefined.js +83 -51
  124. package/dist/tools/helpers/explain-undefined.js.map +1 -1
  125. package/dist/tools/helpers/verify.d.ts.map +1 -1
  126. package/dist/tools/helpers/verify.js +5 -1
  127. package/dist/tools/helpers/verify.js.map +1 -1
  128. package/dist/tools/server-management/_shared.d.ts +15 -4
  129. package/dist/tools/server-management/_shared.d.ts.map +1 -1
  130. package/dist/tools/server-management/_shared.js +73 -12
  131. package/dist/tools/server-management/_shared.js.map +1 -1
  132. package/dist/tools/server-management/data.d.ts.map +1 -1
  133. package/dist/tools/server-management/data.js +88 -23
  134. package/dist/tools/server-management/data.js.map +1 -1
  135. package/dist/tools/server-management/decisions.d.ts.map +1 -1
  136. package/dist/tools/server-management/decisions.js +16 -3
  137. package/dist/tools/server-management/decisions.js.map +1 -1
  138. package/dist/tools/server-management/policies.d.ts.map +1 -1
  139. package/dist/tools/server-management/policies.js +44 -7
  140. package/dist/tools/server-management/policies.js.map +1 -1
  141. package/dist/tools/server-management/status.d.ts.map +1 -1
  142. package/dist/tools/server-management/status.js +80 -13
  143. package/dist/tools/server-management/status.js.map +1 -1
  144. package/dist/types.d.ts +9 -0
  145. package/dist/types.d.ts.map +1 -1
  146. package/package.json +2 -1
package/README.md CHANGED
@@ -76,7 +76,7 @@ Once an MCP client is connected, an agent can:
76
76
  deployable bundle, optionally signing it. Output is a regular `.tar.gz`
77
77
  the agent can hand to your delivery system.
78
78
  - **Lint.** `rego_lint` runs Regal across a directory or a single file
79
- and returns categorized findings (style, bugs, performance, idioms).
79
+ and returns each finding with its category, level and location.
80
80
 
81
81
  A walk-through of a typical session lives in [Cookbook](#cookbook).
82
82
 
@@ -237,7 +237,8 @@ Get-Command opa, regal | Select-Object Source # Windows
237
237
 
238
238
  This does not affect the **Docker** install path, which ships `opa` and
239
239
  `regal` in the image and bypasses `PATH` entirely. The **MCPB** bundle
240
- carries neither and resolves `opa` the same way the npm install does.
240
+ carries neither, and unlike the npm install has no bundled fallback: set
241
+ `OPA_BINARY` or put `opa` on `PATH`.
241
242
  See [Troubleshooting](#troubleshooting) for full detail.
242
243
 
243
244
  ## Configuration
@@ -262,6 +263,7 @@ variable is optional; defaults are sensible for a local OPA on
262
263
  | `OPA_MCP_NO_TELEMETRY` | _(unset)_ | Set to `1` to disable the anonymous startup ping. The ping sends the server version, OS platform, and a random install ID. The install ID is stored at `~/.orygn/opa-mcp/install-id` and is generated once on first run. No policy content or file paths are ever sent. |
263
264
  | `OPA_MCP_MAX_SUBPROCESS_BYTES` | `33554432` (32 MiB) | Maximum bytes captured from a subprocess's stdout and stderr, counted separately. On overflow the stream is clamped, the child is stopped, and the tool returns `OUTPUT_TOO_LARGE`. Distinct from `OPA_MCP_MAX_RESPONSE_BYTES`, which trims the reply after the output is already in memory. |
264
265
  | `OPA_MCP_PASSTHROUGH_ENV` | _(unset)_ | Comma-separated variable names to pass through to `opa`, `regal` and `conftest`. Everything else is withheld. **Anything named here is readable by any policy the server evaluates**, via `opa.runtime().env`, so use it only for values that are safe in that position. |
266
+ | `OPA_MCP_BLOCK_ENV` | _(unset)_ | Comma-separated variable names to withhold from `opa`, `regal` and `conftest` even when they are on the built-in allow-list. Applied last, so it also overrides `OPA_MCP_PASSTHROUGH_ENV`. Use it to drop the proxy variables, which can carry credentials, at the cost of proxy support. |
265
267
 
266
268
  Paths in `OPA_MCP_ALLOWED_PATHS` and the `*_BINARY` variables must be
267
269
  absolute. Relative paths and missing binaries are rejected with structured
@@ -278,12 +280,10 @@ Every tool returns a JSON envelope:
278
280
 
279
281
  Stable error codes: `INVALID_INPUT`, `INVALID_REGO`, `INVALID_BUNDLE`,
280
282
  `EVAL_ERROR`, `OPA_BINARY_NOT_FOUND`, `REGAL_NOT_FOUND`,
281
- `REGAL_VERSION_TOO_OLD`, `CONFTEST_NOT_FOUND`, `OPA_UNREACHABLE`,
282
- `OPA_AUTH_FAILED`, `POLICY_NOT_FOUND`, `DATA_NOT_FOUND`, `PATH_NOT_ALLOWED`,
283
- `PATH_NOT_FOUND`, `DEPENDENCY_CONFLICT`, `NO_TESTS_FOUND`,
284
- `COVERAGE_BELOW_THRESHOLD`, `OPA_VERSION_UNSUPPORTED`, `VERIFY_INCONCLUSIVE`,
285
- `Z3_INIT_ERROR`, `GITHUB_TOKEN_MISSING`, `GIST_CREATE_FAILED`,
286
- `OUTPUT_TOO_LARGE`, `TIMEOUT`,
283
+ `CONFTEST_NOT_FOUND`, `OPA_UNREACHABLE`, `OPA_AUTH_FAILED`,
284
+ `POLICY_NOT_FOUND`, `DATA_NOT_FOUND`, `PATH_NOT_ALLOWED`, `PATH_NOT_FOUND`,
285
+ `NO_TESTS_FOUND`, `COVERAGE_BELOW_THRESHOLD`, `OPA_VERSION_UNSUPPORTED`,
286
+ `GITHUB_TOKEN_MISSING`, `GIST_CREATE_FAILED`, `OUTPUT_TOO_LARGE`, `TIMEOUT`,
287
287
  `CANCELLED`, `UNKNOWN_ERROR`.
288
288
 
289
289
  ### Category A: Authoring & static analysis
@@ -296,10 +296,10 @@ Operate on Rego source code without needing a running OPA server. Wrap
296
296
  | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
297
297
  | `rego_format` | Format Rego source. Wraps `opa fmt`. Idempotent. |
298
298
  | `rego_check` | Type-check and validate Rego. Wraps `opa check`. |
299
- | `rego_lint` | Run Regal across a file or directory. Returns findings grouped by category. **Requires `regal` on `PATH` or `REGAL_BINARY` set.** |
299
+ | `rego_lint` | Run Regal across a file or directory. Returns each violation with its category, level and location. **Requires `regal` on `PATH` or `REGAL_BINARY` set.** |
300
300
  | `rego_parse_ast` | Parse Rego to AST JSON. Wraps `opa parse`. |
301
301
  | `rego_inspect` | Inspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`. |
302
- | `rego_capabilities` | Return the capabilities (built-ins, future keywords) understood by the bundled OPA. |
302
+ | `rego_capabilities` | List the built-ins and features the resolved `opa` binary understands (`OPA_BINARY`, then `PATH`, then the bundled copy) |
303
303
  | `rego_deps` | Static dependency analysis: rule-level data references and cross-package calls. |
304
304
  | `rego_migrate_v1` | Migrate Rego v0 source to v1 syntax. Runs `opa fmt --rego-v1` then validates with `opa check --v1-compatible`. Returns `{ original, migrated, changed, valid, errors }`. |
305
305
  | `rego_check_schema` | Check Rego against a JSON Schema. Validates that every `input.*` field the policy reads exists in the schema using `opa check --schema`. Accepts inline schema or a path to a JSON Schema file on disk. |
@@ -352,17 +352,17 @@ Operate on Rego source code without needing a running OPA server. Wrap
352
352
  Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
353
353
  `opa bench`.
354
354
 
355
- | Tool | What it does |
356
- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
357
- | `rego_eval` | Evaluate a query against a policy and input. The bread-and-butter tool. |
358
- | `rego_eval_with_explain` | Evaluate with `--explain=full` and return a structured trace. |
359
- | `rego_eval_with_profile` | Evaluate with `--profile` and return per-rule timing and evaluation counts. |
360
- | `rego_eval_with_coverage` | Evaluate with `--coverage` and return per-line coverage. |
361
- | `rego_test` | Run `opa test` over a directory. Returns pass/fail per test, with optional coverage. |
362
- | `rego_bench` | Run `opa bench` and return statistical timing data. |
363
- | `rego_compile_query` | Partially evaluate a query against a policy. |
364
- | `opa_exec` | Batch-evaluate a decision against multiple input files. Returns per-file results with `successCount` and `errorCount`. |
365
- | `rego_test_multiroot` | Run Rego tests across multiple roots. Solves OPA's package-conflict problem for repos with multiple independent namespaces. Supports `explicit` root lists and `scan` mode (auto-discovers leaf test roots). |
355
+ | Tool | What it does |
356
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
357
+ | `rego_eval` | Evaluate a query against a policy and input. The bread-and-butter tool. |
358
+ | `rego_eval_with_explain` | Evaluate with `--explain=full` and return a structured trace. |
359
+ | `rego_eval_with_profile` | Evaluate with `--profile` and return per-rule timing and evaluation counts. |
360
+ | `rego_eval_with_coverage` | Evaluate with `--coverage` and return per-line coverage. |
361
+ | `rego_test` | Run Rego unit tests with `opa test`. Returns pass, fail, skip and error counts plus per-test records; `errored` counts tests OPA could not evaluate. With `coverage` or `threshold` OPA emits a coverage report instead of per-test records. |
362
+ | `rego_bench` | Run `opa bench` and return statistical timing data. |
363
+ | `rego_compile_query` | Partially evaluate a query against a policy. |
364
+ | `opa_exec` | Batch-evaluate a decision against multiple input files. Returns per-file results with `successCount` and `errorCount`. |
365
+ | `rego_test_multiroot` | Run `opa test` once per root and aggregate. Use when `opa test .` hits package conflicts. Totals include `totalErrored`. |
366
366
 
367
367
  #### Featured: `rego_eval`
368
368
 
@@ -385,55 +385,55 @@ Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
385
385
 
386
386
  ### Category C: Bundle operations
387
387
 
388
- Package and sign deployable bundles. Wrap `opa build` and `opa sign`.
388
+ Package, sign, and verify deployable bundles. Wrap `opa build`, `opa sign`, and `opa build --verification-key`.
389
389
 
390
- | Tool | What it does |
391
- | ------------------- | ------------------------------------------------------------------------------------------------- |
392
- | `opa_bundle_build` | Build a `.tar.gz` bundle from a policy directory. Supports `optimize` and `revision`. |
393
- | `opa_bundle_sign` | Sign a bundle with a private key. Returns `.signatures.json` content. |
394
- | `opa_bundle_verify` | Verify the signature of a signed bundle using a public key. Returns `{ bundle, verified: true }`. |
390
+ | Tool | What it does |
391
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
392
+ | `opa_bundle_build` | Build a `.tar.gz` bundle from a policy directory. Supports `optimize` and `revision`. |
393
+ | `opa_bundle_sign` | Sign a bundle directory in place, or an archive beside itself, with a private key. A directory signature stays valid wherever the directory is placed under the same name. Returns the path, algorithm, and file count. |
394
+ | `opa_bundle_verify` | Verify a signed bundle with a public key through `opa build --verification-key`. Failures name the reason: wrong key, scope, modified, added, missing or unparseable file, unsigned, or a bundle that does not load. |
395
395
 
396
396
  ### Category D: OPA server management
397
397
 
398
398
  Talk to a running OPA server over its REST API. Require `OPA_URL` to
399
399
  point at a reachable server.
400
400
 
401
- | Tool | What it does |
402
- | -------------------- | ------------------------------------------------------ |
403
- | `opa_list_policies` | List policies registered on the server. |
404
- | `opa_get_policy` | Get a single policy by ID. |
405
- | `opa_put_policy` | Upload or replace a policy. |
406
- | `opa_delete_policy` | Delete a policy by ID. |
407
- | `opa_get_data` | Read a path from the data hierarchy. |
408
- | `opa_put_data` | Write to a path in the data hierarchy. |
409
- | `opa_patch_data` | Apply a JSON Patch to the data hierarchy. |
410
- | `opa_delete_data` | Delete a document from the data hierarchy. |
411
- | `opa_query_decision` | POST to a `/v1/data/...` decision endpoint with input. |
412
- | `opa_compile_query` | Partially evaluate a query against the running server. |
413
- | `opa_health` | Liveness / readiness check. |
414
- | `opa_status` | Bundle / decision-log status. |
415
- | `opa_config` | Server configuration (without secrets). |
401
+ | Tool | What it does |
402
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
403
+ | `opa_list_policies` | List the policy IDs registered on the server, with a count. `includeSource` and `includeAst` add the Rego text or the parsed AST. |
404
+ | `opa_get_policy` | Get a single policy by ID. Returns the Rego source; `includeAst` adds OPA's parsed AST. |
405
+ | `opa_put_policy` | Upload or replace a policy. |
406
+ | `opa_delete_policy` | Delete a policy by ID. |
407
+ | `opa_get_data` | Read a path from the data hierarchy. |
408
+ | `opa_put_data` | Write to a path in the data hierarchy. |
409
+ | `opa_patch_data` | Apply a JSON Patch to the data hierarchy. |
410
+ | `opa_delete_data` | Delete a document from the data hierarchy. |
411
+ | `opa_query_decision` | POST to a `/v1/data/...` decision endpoint with input. |
412
+ | `opa_compile_query` | Partially evaluate a query against the running server. |
413
+ | `opa_health` | Liveness / readiness check. A server that answers reports `healthy: true` or `healthy: false` with OPA's reason; `OPA_UNREACHABLE` means it could not be reached at all. |
414
+ | `opa_status` | The same `GET /v1/config` document as `opa_config`, under a `status` key. Bundle and decision-log status (`/v1/status`) is not exposed. Service header values are redacted. |
415
+ | `opa_config` | Server configuration from `GET /v1/config`. OPA drops the `credentials` block but returns service headers verbatim, so header values are redacted here and the names kept. |
416
416
 
417
417
  ### Category E: Higher-level helpers
418
418
 
419
419
  The differentiation surface. These compose lower-level primitives into
420
420
  the tasks agents are actually asked to do.
421
421
 
422
- | Tool | What it does |
423
- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
424
- | `rego_explain_decision` | Walk through every rule that fired (and didn't) for a given query. Wraps `rego_eval_with_explain` and produces a step-by-step natural-language trace. |
425
- | `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule. |
426
- | `rego_describe_policy` | Summarize what a policy does, its inputs, decisions, and assumptions. |
427
- | `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose minimal patches. |
428
- | `rego_coverage_gaps` | Run `opa test --coverage` and return per-file uncovered line ranges, sorted worst first. Use `threshold` to focus on files below a target percentage. |
429
- | `rego_security_audit` | Run regal lint restricted to `security` and `bugs` categories across a directory. Returns severity-grouped findings with remediation guidance. |
430
- | `rego_infer_input_schema` | Statically analyse a policy (or directory of policies) with `opa parse` and return a JSON Schema describing every `input.*` field the policy reads. No running OPA required. Correct starting point for writing integration tests or configuring `opa check --schema`. |
431
- | `rego_fix` | Run `regal fix` to auto-apply mechanical fixes: `opa-fmt`, `use-rego-v1`, `use-assignment-operator`, `no-whitespace-comment`, and `directory-package-mismatch`. Use `dryRun: true` to preview changes first. Returns a per-file breakdown of which rules were applied and, for `directory-package-mismatch`, the new path the file was moved to. |
432
- | `rego_format_write` | Run `opa fmt --write` to canonically format one or more Rego files or directories in place. Use `dryRun: true` to list which files would change without modifying them. Validates all files parse successfully before writing any. Supports `regoV1`, `v0Compatible`, and `v1Compatible` flags. Only requires `opa`. |
433
- | `rego_policy_diff` | Evaluate the same query against two policies in parallel and compare the results. Returns `equal: true/false`, the raw value from each side (`resultA`/`resultB`), and `changedPaths` -- dot/bracket JSON paths that differ. Each side takes inline source or a file/directory path. Useful for verifying refactor equivalence or mapping divergence between two policy versions. |
434
- | `rego_verify` | Formally verify a property about a Rego rule using SMT solving (Microsoft Z3 via WASM). Unlike testing, this checks ALL possible inputs mathematically and either proves the property holds or returns a concrete counterexample. Supports `always_true`, `never_true`, and `satisfiable` property kinds. Handles equality, comparison, string built-ins (`startswith`, `endswith`, `contains`, `regex.match`), multi-clause rules, and cross-rule inlining. Reports `INCONCLUSIVE` for negation-as-failure and comprehensions. |
435
- | `rego_explain_undefined` | Explain why a Rego query is undefined. Combines a plain eval, a full-trace eval, and per-condition AST analysis to identify the exact body expression blocking each rule. Returns a structured breakdown of which conditions blocked each rule plus a human-readable summary. |
436
- | `rego_playground_share` | Publish a policy (and optional input) as a secret GitHub Gist and return the link, for sharing a reproduction. Requires `GITHUB_TOKEN` with the `gist` scope; returns `GITHUB_TOKEN_MISSING` otherwise. |
422
+ | Tool | What it does |
423
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
424
+ | `rego_explain_decision` | Turn an evaluation trace into a structured per-rule summary of what fired and what did not |
425
+ | `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule. |
426
+ | `rego_describe_policy` | Summarize a policy's package, imports and per-rule structure from its AST. For the input references a policy reads, use `rego_infer_input_schema` |
427
+ | `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose minimal patches. |
428
+ | `rego_coverage_gaps` | Run `opa test --coverage` and return per-file uncovered line ranges, sorted worst first. Use `threshold` to focus on files below a target percentage. |
429
+ | `rego_security_audit` | Run regal lint restricted to `security` and `bugs` categories across a directory. Returns severity-grouped findings with remediation guidance. |
430
+ | `rego_infer_input_schema` | Statically analyse a policy (or directory of policies) with `opa parse` and return a JSON Schema describing every `input.*` field the policy reads. No running OPA required. Correct starting point for writing integration tests or configuring `opa check --schema`. |
431
+ | `rego_fix` | Run `regal fix` to auto-apply mechanical fixes: `opa-fmt`, `use-rego-v1`, `use-assignment-operator`, `no-whitespace-comment`, and `directory-package-mismatch`. Use `dryRun: true` to preview changes first. Returns a per-file breakdown of which rules were applied and, for `directory-package-mismatch`, the new path the file was moved to. |
432
+ | `rego_format_write` | Run `opa fmt --write` to canonically format one or more Rego files or directories in place. Use `dryRun: true` to list which files would change without modifying them. Validates all files parse successfully before writing any. Supports `regoV1`, `v0Compatible`, and `v1Compatible` flags. Only requires `opa`. |
433
+ | `rego_policy_diff` | Evaluate the same query against two policies in parallel and compare the results. Returns `equal: true/false`, the raw value from each side (`resultA`/`resultB`), and `changedPaths` -- dot/bracket JSON paths that differ. Each side takes inline source or a file/directory path. Useful for verifying refactor equivalence or mapping divergence between two policy versions. |
434
+ | `rego_verify` | Formally verify a property about a Rego rule using SMT solving (Microsoft Z3 via WASM). Unlike testing, this checks ALL possible inputs mathematically and either proves the property holds or returns a concrete counterexample. Supports `always_true`, `never_true`, and `satisfiable` property kinds. Handles equality, comparison, string built-ins (`startswith`, `endswith`, `contains`, `regex.match`), multi-clause rules, rule defaults, non-boolean head values, and cross-rule inlining. Reports `INCONCLUSIVE` rather than guessing for negation-as-failure, comprehensions, partial set and object rules, functions, else chains, and complex regex. A body reading an absent field is undefined rather than true, so `always_true` requires the rule to hold for an empty input too. |
435
+ | `rego_explain_undefined` | Explain why a Rego query is undefined. Combines a plain eval, a full-trace eval, and per-condition AST analysis to identify the exact body expression blocking each rule. Returns a structured breakdown of which conditions blocked each rule plus a human-readable summary. |
436
+ | `rego_playground_share` | Publish a policy (and optional input) as a secret GitHub Gist and return the link, for sharing a reproduction. Requires `GITHUB_TOKEN` with the `gist` scope; returns `GITHUB_TOKEN_MISSING` otherwise. |
437
437
 
438
438
  ### Category F: Conftest (configuration policy testing)
439
439
 
@@ -442,12 +442,12 @@ YAML/JSON/HCL/TOML/INI against Rego policies using
442
442
  [conftest](https://www.conftest.dev/). Requires `conftest` on `PATH` or
443
443
  `CONFTEST_BINARY` set; all four tools return `CONFTEST_NOT_FOUND` otherwise.
444
444
 
445
- | Tool | What it does |
446
- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
447
- | `conftest_test` | Evaluate configuration files against policies with `conftest test`. Accepts file paths or `inlineConfig` (inline YAML/JSON/HCL/etc) and `policy` path or `inlinePolicy` source. Returns per-file pass/fail/warn results and a summary. |
448
- | `conftest_verify` | Run `test_*` rules inside `*_test.rego` files to verify the policies themselves are correct. Equivalent to `opa test` but using conftest's policy-loading machinery. |
449
- | `conftest_pull` | Pull a policy bundle from an OCI registry or Git repo into a local directory with `conftest pull`. The target directory need not exist; conftest creates it. |
450
- | `conftest_push` | Package a local policy directory as an OCI artifact and push to a registry with `conftest push`. Registry credentials come from the host environment (`docker login`, ORAS keychain, etc.) -- credentials are never passed through tools. |
445
+ | Tool | What it does |
446
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
447
+ | `conftest_test` | Evaluate config files or an inline document against Rego policies with `conftest test`. Per-file, per-namespace results with arrays always present, and a summary that counts files by name. Parser names are a closed set. |
448
+ | `conftest_verify` | Run the `test_*` rules in a conftest policy directory with `conftest verify`. Reports per-rule results and `NO_TESTS_FOUND` when there are none. |
449
+ | `conftest_pull` | Pull a policy bundle from an OCI registry or Git repo into a local directory with `conftest pull`. The target directory need not exist; conftest creates it, and empties it first, so do not point it at one holding anything else. Omitting `policy` uses the conftest default, which must itself sit inside an allowed root. |
450
+ | `conftest_push` | Package a local policy directory as an OCI artifact and push to a registry with `conftest push`. Registry credentials come from the host environment (`docker login`, ORAS keychain, etc.) -- credentials are never passed through tools. |
451
451
 
452
452
  #### Featured: `conftest_test` with inline config
453
453
 
@@ -602,7 +602,8 @@ Four things worth knowing if you're going to operate this:
602
602
  4. **Children do not inherit the server's environment.** `lib/child-env.ts`
603
603
  builds an explicit allow-list instead. Rego can read its interpreter's
604
604
  environment through `opa.runtime().env`, so anything passed down is
605
- readable by any policy the server evaluates.
605
+ readable by any policy the server evaluates, the proxy variables on the
606
+ list included.
606
607
 
607
608
  ## Security
608
609
 
@@ -620,7 +621,11 @@ be exposed on the network.
620
621
  other variable to any policy it evaluated. Since `rego_eval` accepts inline
621
622
  source, no filesystem access is needed to reach that, which puts it one
622
623
  prompt injection away from any untrusted Rego an agent reads. Children get an
623
- explicit allow-list instead (`lib/child-env.ts`), containing no secret.
624
+ explicit allow-list instead (`lib/child-env.ts`). The list holds no cloud or
625
+ repository token, but it is not free of credentials: `HTTP_PROXY` and its
626
+ siblings are on it, and a proxy URL can embed a username and password.
627
+ They are there because dropping them breaks everyone behind a corporate
628
+ proxy. Name them in `OPA_MCP_BLOCK_ENV` to withhold them anyway.
624
629
  `OPA_MCP_PASSTHROUGH_ENV` opts individual variables back in.
625
630
  - `OPA_TOKEN` is never echoed in tool responses or log entries, and is not
626
631
  passed to any child process.
@@ -689,12 +694,6 @@ path(s) you want the server to read from, comma-separated.
689
694
  `OPA_URL` (default `http://localhost:8181`) must point at a running OPA
690
695
  server (`opa run --server ...`). Check with `curl $OPA_URL/health`.
691
696
 
692
- **Regal "version too old."**
693
-
694
- We track the current Regal release. If `REGAL_VERSION_TOO_OLD` fires,
695
- upgrade Regal: `brew upgrade regal` or download from the
696
- [Regal releases](https://github.com/StyraInc/regal/releases) page.
697
-
698
697
  **`directory-package-mismatch` violation when linting inline source.**
699
698
 
700
699
  Since v0.1.1, the server auto-disables this rule for inline-source calls.
@@ -730,7 +729,7 @@ npm run build # compile to dist/
730
729
  ```
731
730
 
732
731
  CI runs lint, typecheck, build, and unit tests on every push and PR
733
- across Ubuntu, macOS, and Windows on Node 20, 22, and 24. Integration
732
+ across Ubuntu and Windows on Node 20, 22 and 24, plus macOS on Node 22. Integration
734
733
  tests run on Linux against pinned `opa` and `regal` releases.
735
734
 
736
735
  For the full contributor workflow (adding tools, naming conventions,
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAiD/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAgBxE;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAMA"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAsD/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAgBxE;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAMA"}
package/dist/cli.js CHANGED
@@ -39,12 +39,17 @@ export function formatHelp(col) {
39
39
  ['OPA_MCP_LOG_FILE', 'log file path', '<tmpdir>/orygn-opa-mcp.log'],
40
40
  ['OPA_MCP_LOG_LEVEL', 'log level (debug|info|warn|error)', 'info'],
41
41
  ['OPA_MCP_MAX_RESPONSE_BYTES', 'max response size in bytes', '100000'],
42
+ ['OPA_MCP_MAX_SUBPROCESS_BYTES', 'max bytes captured per stream', '33554432'],
43
+ ['OPA_MCP_PASSTHROUGH_ENV', 'extra env names to pass to child processes', ''],
44
+ ['OPA_MCP_NO_TELEMETRY', 'set to 1 to disable the anonymous startup ping', ''],
42
45
  ];
43
- // Pad name to 28 and description to 38 so the default column lines up.
46
+ // Pad the name to 30 and the description to 40 so the default column lines
47
+ // up. The widest entries are OPA_MCP_MAX_SUBPROCESS_BYTES (28) and its
48
+ // description (39).
44
49
  const envLines = rows
45
50
  .map(([name, desc, def]) => {
46
- const namePad = name.padEnd(28);
47
- const descPad = desc.padEnd(38);
51
+ const namePad = name.padEnd(30);
52
+ const descPad = desc.padEnd(40);
48
53
  const defStr = def ? `${d('default: ' + def)}` : '';
49
54
  return ` ${namePad}${descPad}${defStr}`;
50
55
  })
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,iFAAiF;AAEjF,MAAM,CAAC,GAAG,SAAS,CAAC;AACpB,MAAM,CAAC,GAAG,SAAS,CAAC;AACpB,MAAM,CAAC,GAAG,SAAS,CAAC;A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AAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC"}
package/dist/config.d.ts CHANGED
@@ -20,7 +20,7 @@ declare const ConfigSchema: z.ZodObject<{
20
20
  * default -- file-based tools refuse to read from disk until the
21
21
  * operator explicitly opts in via `OPA_MCP_ALLOWED_PATHS`.
22
22
  */
23
- allowedPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
23
+ allowedPaths: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
24
24
  /** Path to the log file. Defaults to OS tmpdir + orygn-opa-mcp.log. */
25
25
  logFile: z.ZodDefault<z.ZodString>;
26
26
  /** Log level for the file logger. */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,QAAA,MAAM,YAAY;IAChB,wEAAwE;;IASxE,2EAA2E;;IAG3E,2DAA2D;;IAG3D,+DAA+D;;IAG/D,qEAAqE;;IAGrE,kEAAkE;;IAGlE,mDAAmD;;IAGnD;;;;;OAKG;;IAGH,uEAAuE;;IAGvE,qCAAqC;;IAGrC;;;;OAIG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUH,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AA0BlD,wBAAgB,UAAU,IAAI,MAAM,CAsCnC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,YAAY;IAChB,wEAAwE;;IASxE,2EAA2E;;IAG3E,2DAA2D;;IAG3D,+DAA+D;;IAG/D,qEAAqE;;IAGrE,kEAAkE;;IAQlE,mDAAmD;;IAQnD;;;;;OAKG;;IAcH,uEAAuE;;IAGvE,qCAAqC;;IAGrC;;;;OAIG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUH,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAyClD,wBAAgB,UAAU,IAAI,MAAM,CAsCnC"}
package/dist/config.js CHANGED
@@ -6,10 +6,17 @@
6
6
  * Cursor, VS Code) pass config via the `env` object in their JSON.
7
7
  */
8
8
  import { tmpdir } from 'node:os';
9
- import { join } from 'node:path';
9
+ import { isAbsolute, join } from 'node:path';
10
10
  import { z } from 'zod';
11
11
  import { resolveOpaBinary } from './lib/resolve-binary.js';
12
12
  import { DEFAULT_MAX_OUTPUT_BYTES } from './lib/subprocess.js';
13
+ /**
14
+ * Node clamps a timer of 2^31 ms or more to 1 ms, with only a process warning.
15
+ * A large value reads as "effectively no timeout" and produced the opposite:
16
+ * every subprocess and every HTTP call timed out immediately.
17
+ */
18
+ const MAX_TIMER_MS = 2_147_483_647;
19
+ const TIMER_TOO_LARGE = 'Timeout must be below 2147483647 ms (about 24 days). Node clamps anything larger to 1 ms, which times out every call immediately.';
13
20
  const ConfigSchema = z.object({
14
21
  /** Base URL of a running OPA server (used by `opa_*` runtime tools). */
15
22
  opaUrl: z
@@ -28,16 +35,36 @@ const ConfigSchema = z.object({
28
35
  /** Path to the `conftest` binary. Defaults to `conftest` on PATH. */
29
36
  conftestBinary: z.string().default('conftest'),
30
37
  /** Hard timeout in ms for any spawned subprocess (opa, regal). */
31
- subprocessTimeoutMs: z.coerce.number().int().positive().default(30_000),
38
+ subprocessTimeoutMs: z.coerce
39
+ .number()
40
+ .int()
41
+ .positive()
42
+ .max(MAX_TIMER_MS, TIMER_TOO_LARGE)
43
+ .default(30_000),
32
44
  /** HTTP request timeout for OPA REST API calls. */
33
- httpTimeoutMs: z.coerce.number().int().positive().default(15_000),
45
+ httpTimeoutMs: z.coerce
46
+ .number()
47
+ .int()
48
+ .positive()
49
+ .max(MAX_TIMER_MS, TIMER_TOO_LARGE)
50
+ .default(15_000),
34
51
  /**
35
52
  * Allow-listed root directories for file path inputs. Tools that accept
36
53
  * filesystem paths reject anything outside these roots. Empty by
37
54
  * default -- file-based tools refuse to read from disk until the
38
55
  * operator explicitly opts in via `OPA_MCP_ALLOWED_PATHS`.
39
56
  */
40
- allowedPaths: z.array(z.string()).default([]),
57
+ allowedPaths: z
58
+ .array(
59
+ // A relative root is resolved against the server's working directory,
60
+ // which for a stdio server is wherever the client happened to launch it.
61
+ // The same configuration would then permit different directories on
62
+ // different machines, so it is refused rather than guessed at, which is
63
+ // what the documentation has always said happens.
64
+ z.string().refine(isAbsolute, {
65
+ message: 'must be an absolute path',
66
+ }))
67
+ .default([]),
41
68
  /** Path to the log file. Defaults to OS tmpdir + orygn-opa-mcp.log. */
42
69
  logFile: z.string().default(join(tmpdir(), 'orygn-opa-mcp.log')),
43
70
  /** Log level for the file logger. */
@@ -87,21 +114,36 @@ const ENV_VAR_NAMES = {
87
114
  maxResponseBytes: 'OPA_MCP_MAX_RESPONSE_BYTES',
88
115
  maxSubprocessBytes: 'OPA_MCP_MAX_SUBPROCESS_BYTES',
89
116
  };
117
+ /**
118
+ * Read an environment variable, treating an empty or blank value as unset.
119
+ *
120
+ * A shell that expands an unset variable leaves an empty string behind, and
121
+ * `OPA_BINARY=""` was taken as a real path: it is not the literal default
122
+ * `opa`, so binary resolution skipped the bundled build and every tool call
123
+ * tried to spawn nothing. Blank means "not configured" for every variable here.
124
+ */
125
+ function env(name) {
126
+ const raw = process.env[name];
127
+ if (raw === undefined)
128
+ return undefined;
129
+ const trimmed = raw.trim();
130
+ return trimmed.length > 0 ? trimmed : undefined;
131
+ }
90
132
  export function loadConfig() {
91
133
  const allowedPaths = parseAllowedPaths(process.env['OPA_MCP_ALLOWED_PATHS']);
92
134
  const parsed = ConfigSchema.safeParse({
93
- opaUrl: process.env['OPA_URL'],
94
- opaToken: process.env['OPA_TOKEN'],
95
- opaBinary: process.env['OPA_BINARY'],
96
- regalBinary: process.env['REGAL_BINARY'],
97
- conftestBinary: process.env['CONFTEST_BINARY'],
98
- subprocessTimeoutMs: process.env['OPA_MCP_TIMEOUT_MS'],
99
- httpTimeoutMs: process.env['OPA_MCP_HTTP_TIMEOUT_MS'],
135
+ opaUrl: env('OPA_URL'),
136
+ opaToken: env('OPA_TOKEN'),
137
+ opaBinary: env('OPA_BINARY'),
138
+ regalBinary: env('REGAL_BINARY'),
139
+ conftestBinary: env('CONFTEST_BINARY'),
140
+ subprocessTimeoutMs: env('OPA_MCP_TIMEOUT_MS'),
141
+ httpTimeoutMs: env('OPA_MCP_HTTP_TIMEOUT_MS'),
100
142
  allowedPaths,
101
- logFile: process.env['OPA_MCP_LOG_FILE'],
102
- logLevel: process.env['OPA_MCP_LOG_LEVEL'],
103
- maxResponseBytes: process.env['OPA_MCP_MAX_RESPONSE_BYTES'],
104
- maxSubprocessBytes: process.env['OPA_MCP_MAX_SUBPROCESS_BYTES'],
143
+ logFile: env('OPA_MCP_LOG_FILE'),
144
+ logLevel: env('OPA_MCP_LOG_LEVEL'),
145
+ maxResponseBytes: env('OPA_MCP_MAX_RESPONSE_BYTES'),
146
+ maxSubprocessBytes: env('OPA_MCP_MAX_SUBPROCESS_BYTES'),
105
147
  });
106
148
  if (!parsed.success) {
107
149
  console.error('opa-mcp: invalid configuration');
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM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C,MAAM,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;YACjC,OAAO,CAAC,KAAK,CAAC,KAAK,MAAM,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAC3B,oEAAoE;IACpE,uEAAuE;IACvE,kEAAkE;IAClE,MAAM,CAAC,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,23 @@
1
+ export interface SignaturesSummary {
2
+ /** JWT `alg` header, e.g. `RS256`. */
3
+ algorithm: string;
4
+ /** Number of files the signature covers. */
5
+ filesSigned: number;
6
+ keyId?: string;
7
+ scope?: string;
8
+ }
9
+ /**
10
+ * Read the summary of a `.signatures.json` file. Throws on any shape OPA
11
+ * would not have written, so a caller never reports a file it cannot read.
12
+ */
13
+ export declare function readSignaturesSummary(path: string): Promise<SignaturesSummary>;
14
+ export declare function isKeyOrAlgorithmError(output: string): boolean;
15
+ export type VerificationFailureReason = 'key_invalid' | 'not_a_bundle' | 'signature_invalid' | 'scope_mismatch' | 'file_modified' | 'file_missing' | 'file_added' | 'unsigned' | 'signatures_malformed' | 'file_unparseable' | 'bundle_load_error' | 'unknown';
16
+ export interface VerificationFailure {
17
+ reason: VerificationFailureReason;
18
+ summary: string;
19
+ hint?: string;
20
+ }
21
+ /** Classify OPA's stdout+stderr from a failed verification. */
22
+ export declare function classifyVerificationFailure(output: string): VerificationFailure;
23
+ //# sourceMappingURL=bundle-signatures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-signatures.d.ts","sourceRoot":"","sources":["../../src/lib/bundle-signatures.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA0BpF;AASD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,MAAM,MAAM,yBAAyB,GACjC,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,cAAc,GACd,YAAY,GACZ,UAAU,GACV,sBAAsB,GACtB,kBAAkB,GAClB,mBAAmB,GACnB,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,yBAAyB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAuFD,+DAA+D;AAC/D,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAW/E"}