@crediolabs/policy-synth 0.1.8 → 0.1.10

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 (51) hide show
  1. package/dist/adapters/interpreter/adapter.js +21 -3
  2. package/dist/adapters/oz/adapter.js +8 -0
  3. package/dist/ir/types.d.ts +9 -0
  4. package/dist/predicate/encode.js +9 -0
  5. package/dist/review-card/builder.js +32 -0
  6. package/dist/review-card/cross-check.js +40 -0
  7. package/dist/run/index.d.ts +8 -2
  8. package/dist/run/index.js +2 -1
  9. package/dist/run/schemas.d.ts +12 -0
  10. package/dist/run/schemas.js +14 -0
  11. package/dist/synth/compose-from-recording.js +89 -0
  12. package/dist/synth/deny-cases.js +89 -1
  13. package/dist/synth/evaluate.js +49 -0
  14. package/dist/synth/synthesize-from-mandate.d.ts +17 -2
  15. package/dist/synth/synthesize-from-mandate.js +27 -2
  16. package/dist/synth/synthesize-from-recording.d.ts +25 -1
  17. package/dist/synth/synthesize-from-recording.js +66 -1
  18. package/dist/types.d.ts +8 -0
  19. package/dist-cjs/adapters/interpreter/adapter.js +21 -3
  20. package/dist-cjs/adapters/oz/adapter.js +8 -0
  21. package/dist-cjs/ir/types.d.ts +9 -0
  22. package/dist-cjs/predicate/encode.js +9 -0
  23. package/dist-cjs/review-card/builder.js +32 -0
  24. package/dist-cjs/review-card/cross-check.js +40 -0
  25. package/dist-cjs/run/index.d.ts +8 -2
  26. package/dist-cjs/run/index.js +2 -1
  27. package/dist-cjs/run/schemas.d.ts +12 -0
  28. package/dist-cjs/run/schemas.js +14 -0
  29. package/dist-cjs/synth/compose-from-recording.js +89 -0
  30. package/dist-cjs/synth/deny-cases.js +89 -1
  31. package/dist-cjs/synth/evaluate.js +49 -0
  32. package/dist-cjs/synth/synthesize-from-mandate.d.ts +17 -2
  33. package/dist-cjs/synth/synthesize-from-mandate.js +27 -2
  34. package/dist-cjs/synth/synthesize-from-recording.d.ts +25 -1
  35. package/dist-cjs/synth/synthesize-from-recording.js +66 -1
  36. package/dist-cjs/types.d.ts +8 -0
  37. package/package.json +1 -1
  38. package/src/adapters/interpreter/adapter.ts +20 -4
  39. package/src/adapters/oz/adapter.ts +8 -0
  40. package/src/ir/types.ts +8 -0
  41. package/src/predicate/encode.ts +9 -0
  42. package/src/review-card/builder.ts +28 -0
  43. package/src/review-card/cross-check.ts +40 -0
  44. package/src/run/index.ts +16 -2
  45. package/src/run/schemas.ts +14 -0
  46. package/src/synth/compose-from-recording.ts +87 -0
  47. package/src/synth/deny-cases.ts +86 -1
  48. package/src/synth/evaluate.ts +41 -0
  49. package/src/synth/synthesize-from-mandate.ts +40 -4
  50. package/src/synth/synthesize-from-recording.ts +103 -4
  51. package/src/types.ts +10 -0
package/src/types.ts CHANGED
@@ -145,6 +145,16 @@ export type PredicateLeaf =
145
145
  | { kind: 'call_contract' }
146
146
  | { kind: 'call_fn' }
147
147
  | { kind: 'call_arg'; index: number }
148
+ // Length of a vec-typed argument as a u32. Binds the OUTER vec length so
149
+ // a caller cannot append a new element to defeat a per-element pin.
150
+ // Paired with `call_arg_field` per element - pinning only the field leaves
151
+ // an element-append vulnerability; this leaf closes it.
152
+ | { kind: 'call_arg_len'; index: number }
153
+ // Value of `field` in the map at `element` of the vec at argument `index`.
154
+ // Fixed-arity: index, element, field. The leaf is resolved against the
155
+ // recorded ScVal type. A non-vec arg, missing element, missing field, or
156
+ // type mismatch all DENY (fail-closed).
157
+ | { kind: 'call_arg_field'; index: number; element: number; field: string }
148
158
  // `call_sub_invocation[i]` is NOT in v1 grammar. OZ `Policy::enforce`
149
159
  // receives one `Context`, not a sub-invocation tree; sub-invocations live under
150
160
  // `InvokerContractAuthEntry::Contract(SubContractInvocation)`, not in the