@codyswann/lisa 8.6.1 → 8.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 (202) hide show
  1. package/dist/controls/attest-check.d.ts.map +1 -1
  2. package/dist/controls/attest-check.js +31 -18
  3. package/dist/controls/attest-check.js.map +1 -1
  4. package/dist/controls/attest-record.d.ts +3 -0
  5. package/dist/controls/attest-record.d.ts.map +1 -1
  6. package/dist/controls/attest-record.js +28 -5
  7. package/dist/controls/attest-record.js.map +1 -1
  8. package/dist/controls/checks-binding.d.ts.map +1 -1
  9. package/dist/controls/checks-binding.js +28 -1
  10. package/dist/controls/checks-binding.js.map +1 -1
  11. package/dist/controls/commands/attest-host-proof.d.ts +18 -0
  12. package/dist/controls/commands/attest-host-proof.d.ts.map +1 -0
  13. package/dist/controls/commands/attest-host-proof.js +168 -0
  14. package/dist/controls/commands/attest-host-proof.js.map +1 -0
  15. package/dist/controls/commands/attest-options.d.ts +4 -0
  16. package/dist/controls/commands/attest-options.d.ts.map +1 -1
  17. package/dist/controls/commands/attest.d.ts.map +1 -1
  18. package/dist/controls/commands/attest.js +52 -0
  19. package/dist/controls/commands/attest.js.map +1 -1
  20. package/dist/controls/commands/declaration-check.d.ts.map +1 -1
  21. package/dist/controls/commands/declaration-check.js +19 -5
  22. package/dist/controls/commands/declaration-check.js.map +1 -1
  23. package/dist/controls/commands/register.d.ts.map +1 -1
  24. package/dist/controls/commands/register.js +4 -1
  25. package/dist/controls/commands/register.js.map +1 -1
  26. package/dist/controls/evidence-document.d.ts.map +1 -1
  27. package/dist/controls/evidence-document.js +12 -0
  28. package/dist/controls/evidence-document.js.map +1 -1
  29. package/dist/controls/evidence-gather.d.ts +1 -0
  30. package/dist/controls/evidence-gather.d.ts.map +1 -1
  31. package/dist/controls/evidence-gather.js +5 -2
  32. package/dist/controls/evidence-gather.js.map +1 -1
  33. package/dist/controls/evidence-types.d.ts +19 -1
  34. package/dist/controls/evidence-types.d.ts.map +1 -1
  35. package/dist/controls/evidence-types.js +11 -0
  36. package/dist/controls/evidence-types.js.map +1 -1
  37. package/dist/controls/evidence-write.d.ts.map +1 -1
  38. package/dist/controls/evidence-write.js +7 -1
  39. package/dist/controls/evidence-write.js.map +1 -1
  40. package/dist/controls/exercise-declaration.d.ts +58 -0
  41. package/dist/controls/exercise-declaration.d.ts.map +1 -0
  42. package/dist/controls/exercise-declaration.js +138 -0
  43. package/dist/controls/exercise-declaration.js.map +1 -0
  44. package/dist/controls/exercise-observations.d.ts +32 -0
  45. package/dist/controls/exercise-observations.d.ts.map +1 -0
  46. package/dist/controls/exercise-observations.js +141 -0
  47. package/dist/controls/exercise-observations.js.map +1 -0
  48. package/dist/controls/exercise-record-shape.d.ts +10 -0
  49. package/dist/controls/exercise-record-shape.d.ts.map +1 -0
  50. package/dist/controls/exercise-record-shape.js +29 -0
  51. package/dist/controls/exercise-record-shape.js.map +1 -0
  52. package/dist/controls/exercise-records.d.ts +28 -0
  53. package/dist/controls/exercise-records.d.ts.map +1 -0
  54. package/dist/controls/exercise-records.js +113 -0
  55. package/dist/controls/exercise-records.js.map +1 -0
  56. package/dist/controls/exercise-result.d.ts +23 -0
  57. package/dist/controls/exercise-result.d.ts.map +1 -0
  58. package/dist/controls/exercise-result.js +186 -0
  59. package/dist/controls/exercise-result.js.map +1 -0
  60. package/dist/controls/host-proof-input.d.ts +53 -0
  61. package/dist/controls/host-proof-input.d.ts.map +1 -0
  62. package/dist/controls/host-proof-input.js +129 -0
  63. package/dist/controls/host-proof-input.js.map +1 -0
  64. package/dist/controls/host-proof-receipt.d.ts +47 -0
  65. package/dist/controls/host-proof-receipt.d.ts.map +1 -0
  66. package/dist/controls/host-proof-receipt.js +132 -0
  67. package/dist/controls/host-proof-receipt.js.map +1 -0
  68. package/dist/controls/host-proof-register.d.ts +37 -0
  69. package/dist/controls/host-proof-register.d.ts.map +1 -0
  70. package/dist/controls/host-proof-register.js +153 -0
  71. package/dist/controls/host-proof-register.js.map +1 -0
  72. package/dist/controls/host-proof-signature.d.ts +30 -0
  73. package/dist/controls/host-proof-signature.d.ts.map +1 -0
  74. package/dist/controls/host-proof-signature.js +49 -0
  75. package/dist/controls/host-proof-signature.js.map +1 -0
  76. package/dist/controls/host-proof-trust.d.ts +33 -0
  77. package/dist/controls/host-proof-trust.d.ts.map +1 -0
  78. package/dist/controls/host-proof-trust.js +124 -0
  79. package/dist/controls/host-proof-trust.js.map +1 -0
  80. package/dist/controls/pull-request-executor.d.ts +18 -6
  81. package/dist/controls/pull-request-executor.d.ts.map +1 -1
  82. package/dist/controls/pull-request-executor.js +19 -24
  83. package/dist/controls/pull-request-executor.js.map +1 -1
  84. package/dist/controls/register-types.d.ts +3 -4
  85. package/dist/controls/register-types.d.ts.map +1 -1
  86. package/dist/controls/register-types.js +3 -4
  87. package/dist/controls/register-types.js.map +1 -1
  88. package/dist/controls/register.d.ts +4 -7
  89. package/dist/controls/register.d.ts.map +1 -1
  90. package/dist/controls/register.js +17 -6
  91. package/dist/controls/register.js.map +1 -1
  92. package/dist/controls/verdict-answers.d.ts.map +1 -1
  93. package/dist/controls/verdict-answers.js +6 -2
  94. package/dist/controls/verdict-answers.js.map +1 -1
  95. package/dist/controls/verdict-types.d.ts +1 -1
  96. package/dist/controls/verdict-types.d.ts.map +1 -1
  97. package/dist/controls/verdict-types.js +2 -0
  98. package/dist/controls/verdict-types.js.map +1 -1
  99. package/dist/controls/verdict-wording.d.ts +2 -0
  100. package/dist/controls/verdict-wording.d.ts.map +1 -1
  101. package/dist/controls/verdict-wording.js +7 -0
  102. package/dist/controls/verdict-wording.js.map +1 -1
  103. package/dist/controls/verdict.d.ts +2 -0
  104. package/dist/controls/verdict.d.ts.map +1 -1
  105. package/dist/controls/verdict.js +17 -2
  106. package/dist/controls/verdict.js.map +1 -1
  107. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  108. package/dist/core/upstream-evidence-manifest.json +34 -3
  109. package/package.json +4 -4
  110. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  111. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  112. package/plugins/lisa/.codex-plugin/skills/lisa-attest/SKILL.md +1 -1
  113. package/plugins/lisa/.codex-plugin/skills/lisa-configure/SKILL.md +3 -2
  114. package/plugins/lisa/.codex-plugin/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  115. package/plugins/lisa/.codex-plugin/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  116. package/plugins/lisa/skills/lisa-attest/SKILL.md +1 -1
  117. package/plugins/lisa/skills/lisa-configure/SKILL.md +3 -2
  118. package/plugins/lisa/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  119. package/plugins/lisa/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  120. package/plugins/lisa-agy/plugin.json +1 -1
  121. package/plugins/lisa-agy/skills/lisa-attest/SKILL.md +1 -1
  122. package/plugins/lisa-agy/skills/lisa-configure/SKILL.md +3 -2
  123. package/plugins/lisa-agy/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  124. package/plugins/lisa-agy/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  125. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  126. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  127. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  128. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  129. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  130. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  131. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  132. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-copilot/skills/lisa-attest/SKILL.md +1 -1
  134. package/plugins/lisa-copilot/skills/lisa-configure/SKILL.md +3 -2
  135. package/plugins/lisa-copilot/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  136. package/plugins/lisa-copilot/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  137. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  138. package/plugins/lisa-cursor/skills/lisa-attest/SKILL.md +1 -1
  139. package/plugins/lisa-cursor/skills/lisa-configure/SKILL.md +3 -2
  140. package/plugins/lisa-cursor/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  141. package/plugins/lisa-cursor/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  142. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  143. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  144. package/plugins/lisa-devin/skills/lisa-attest/SKILL.md +1 -1
  145. package/plugins/lisa-devin/skills/lisa-configure/SKILL.md +3 -2
  146. package/plugins/lisa-devin/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  147. package/plugins/lisa-devin/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  148. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  149. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  150. package/plugins/lisa-expo-agy/plugin.json +1 -1
  151. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  152. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  153. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  154. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  155. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  156. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  157. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  158. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  159. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  160. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  161. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  162. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  163. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  164. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  165. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  166. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  167. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  168. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  169. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  170. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  171. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  172. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  173. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  174. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  175. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  176. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  177. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  178. package/plugins/lisa-rails-agy/plugin.json +1 -1
  179. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  180. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  181. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  183. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  184. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  185. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  186. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  187. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  188. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  189. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  190. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  191. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  192. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  193. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  194. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  195. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  196. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  197. package/plugins/src/base/skills/lisa-attest/SKILL.md +1 -1
  198. package/plugins/src/base/skills/lisa-configure/SKILL.md +3 -2
  199. package/plugins/src/base/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  200. package/plugins/src/base/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  201. package/schemas/control-evidence.schema.json +39 -1
  202. package/schemas/control-verdict.schema.json +1 -0
@@ -0,0 +1,23 @@
1
+ import { type ExerciseTarget } from "./exercise-declaration.js";
2
+ import type { ControlRegister } from "./register-types.js";
3
+ /** The inputs attest can verify against the same signed statement later. */
4
+ export interface ExerciseBinding {
5
+ readonly repository: string;
6
+ readonly environment: string;
7
+ readonly checksDigest: string;
8
+ readonly now: Date;
9
+ readonly register: ControlRegister;
10
+ }
11
+ /** What a valid result establishes without including any raw command log. */
12
+ export interface AcceptedExercise {
13
+ readonly completedAt: string;
14
+ }
15
+ /**
16
+ * Bind an authenticated result to the exact target, environment, and current checks.
17
+ * @param target - The applicable criterion and declared surface
18
+ * @param result - A statement whose signer has already been checked
19
+ * @param binding - The current evidence context
20
+ * @returns The result's durable identity and completion time, or a fixed refusal
21
+ */
22
+ export declare function acceptExercise(target: ExerciseTarget, result: Readonly<Record<string, unknown>>, binding: ExerciseBinding): AcceptedExercise | string;
23
+ //# sourceMappingURL=exercise-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-result.d.ts","sourceRoot":"","sources":["../../src/controls/exercise-result.ts"],"names":[],"mappings":"AAQA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhF,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,qBAAqB,CAAC;AAE7B,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAED,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAoMD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,eAAe,GACvB,gBAAgB,GAAG,MAAM,CA+B3B"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Validate the producer's independently reviewed result for one exercise.
3
+ * @module controls/exercise-result
4
+ */
5
+ import { isJsonObject } from "../sync/json-path.js";
6
+ import { isCanonicalUtc, isEvidenceFresh } from "./evidence.js";
7
+ import { isSha256 } from "./evidence-binding.js";
8
+ import { DEFAULT_FRESHNESS_SECONDS } from "./evidence-types.js";
9
+ import { isExerciseName } from "./exercise-declaration.js";
10
+ import { declaredFailureText } from "./proof-plan.js";
11
+ import { isRequiredBeyondTheAuthor } from "./register-tier-rule.js";
12
+ /** A versioned source locator names a file at an exact Git object. */
13
+ const IMMUTABLE_SOURCE = /^git:[0-9a-f]{40}(?:[0-9a-f]{24})?:[^\r\n]{1,160}$/u;
14
+ /** A verified principal can be a service name, email address, or provider role id. */
15
+ const PRINCIPAL = /^[a-zA-Z0-9][a-zA-Z0-9._@:/-]{0,159}$/u;
16
+ /**
17
+ * Check the signed artifact's hash or immutable source locator.
18
+ * @param artifact - The claimed result's immutable identity
19
+ * @returns Whether it identifies immutable evidence
20
+ */
21
+ function isImmutableArtifact(artifact) {
22
+ return (isJsonObject(artifact) &&
23
+ Object.keys(artifact).length === 1 &&
24
+ (isSha256(artifact.sha256) ||
25
+ (typeof artifact.locator === "string" &&
26
+ IMMUTABLE_SOURCE.test(artifact.locator))));
27
+ }
28
+ /**
29
+ * The control gate exercise must reach the real declaration and named scope.
30
+ * @param target - The declared gate and moment to exercise
31
+ * @param register - The repository's current control register
32
+ * @returns Its authoritative entry for that scope and moment, if any
33
+ */
34
+ function authoritativeGate(target, register) {
35
+ return register.entries.find(entry => entry.gate === target.gate &&
36
+ entry.scope === target.scope &&
37
+ entry.tier === "authoritative" &&
38
+ isRequiredBeyondTheAuthor(entry.enforcement_points.filter(point => point.moment === target.moment)));
39
+ }
40
+ /**
41
+ * Validate the gate runner's refusal and the clean result when the gate declares one.
42
+ * @param target - Gate identity and the expected moment
43
+ * @param outcome - Signed observation from the authoritative gate runner
44
+ * @param register - Current declaration-derived register
45
+ * @returns Whether the observed results fit the declared failure
46
+ */
47
+ function gateExercise(target, outcome, register) {
48
+ const entry = authoritativeGate(target, register);
49
+ if (entry === undefined ||
50
+ outcome.gate !== target.gate ||
51
+ outcome.moment !== target.moment)
52
+ return false;
53
+ const { violation_exit, violation_output, clean_exit } = outcome;
54
+ const declared = declaredFailureText(entry);
55
+ const shape = declared.length === 0 ? [`required gate FAILED: ${entry.gate}`] : declared;
56
+ if (typeof violation_exit !== "number" ||
57
+ !Number.isInteger(violation_exit) ||
58
+ violation_exit <= 0 ||
59
+ violation_exit > 255 ||
60
+ typeof violation_output !== "string" ||
61
+ violation_output.length > 16_384 ||
62
+ !shape.some(line => violation_output.includes(line)))
63
+ return false;
64
+ const paired = entry.proof.clean !== null || entry.proof.violation !== null;
65
+ return paired || clean_exit !== undefined
66
+ ? Object.keys(outcome).length === 5 && clean_exit === 0
67
+ : Object.keys(outcome).length === 4;
68
+ }
69
+ /**
70
+ * Verify the declared connection and execution surface with an identified principal.
71
+ * @param target - The expected connection and surface
72
+ * @param outcome - Signed identity check result
73
+ * @returns Whether the result proves identity on that exact surface
74
+ */
75
+ function credentialExercise(target, outcome) {
76
+ return (Object.keys(outcome).length === 4 &&
77
+ outcome.connection === target.connection &&
78
+ outcome.surface === target.surface &&
79
+ outcome.identity_verified === true &&
80
+ typeof outcome.principal === "string" &&
81
+ PRINCIPAL.test(outcome.principal));
82
+ }
83
+ /**
84
+ * Confirm that the documented incident exercise reached the restored generation.
85
+ * @param target - The release track in the plan
86
+ * @param outcome - Signed incident and rollback result
87
+ * @param completed - When the full exercise finished
88
+ * @returns Whether the result contains an ordered, verified recovery
89
+ */
90
+ function rollbackExercise(target, outcome, completed) {
91
+ const { detected_at, rolled_back_at, verified_at } = outcome;
92
+ return (Object.keys(outcome).length === 11 &&
93
+ outcome.release_track === target.release_track &&
94
+ [
95
+ outcome.incident,
96
+ outcome.actor,
97
+ outcome.finding,
98
+ outcome.previous_generation,
99
+ outcome.rolled_back_from,
100
+ ].every(isExerciseName) &&
101
+ outcome.restored_generation === outcome.previous_generation &&
102
+ outcome.rolled_back_from !== outcome.previous_generation &&
103
+ outcome.recovery_verified === true &&
104
+ isCanonicalUtc(detected_at) &&
105
+ isCanonicalUtc(rolled_back_at) &&
106
+ isCanonicalUtc(verified_at) &&
107
+ detected_at <= rolled_back_at &&
108
+ rolled_back_at <= verified_at &&
109
+ verified_at <= completed);
110
+ }
111
+ /**
112
+ * Confirm independent shadow comparisons and adversarial staff qualification.
113
+ * @param target - The declared role and minimum shadow period
114
+ * @param outcome - Signed qualification result
115
+ * @param completed - When the full exercise finished
116
+ * @returns Whether the required period and both checks are present
117
+ */
118
+ function staffExercise(target, outcome, completed) {
119
+ const { shadow_started_at, shadow_completed_at, comparisons } = outcome;
120
+ return (Object.keys(outcome).length === 9 &&
121
+ outcome.role === target.role &&
122
+ isExerciseName(outcome.actor) &&
123
+ isSha256(outcome.roster_sha256) &&
124
+ isCanonicalUtc(shadow_started_at) &&
125
+ isCanonicalUtc(shadow_completed_at) &&
126
+ shadow_completed_at <= completed &&
127
+ Date.parse(shadow_completed_at) - Date.parse(shadow_started_at) >=
128
+ target.minimum_shadow_seconds * 1000 &&
129
+ typeof comparisons === "number" &&
130
+ Number.isSafeInteger(comparisons) &&
131
+ comparisons > 0 &&
132
+ outcome.shadow_agreed === true &&
133
+ outcome.adversarial_passed === true &&
134
+ outcome.qualification === "qualified");
135
+ }
136
+ /**
137
+ * Apply the exact schema and completion test for the declared criterion.
138
+ * @param target - The typed target from the repository's plan
139
+ * @param outcome - The independently reviewed result fields
140
+ * @param register - Current gate declaration and scope
141
+ * @param completed - The signed completion timestamp
142
+ * @returns Whether the exercise measured what its target requires
143
+ */
144
+ function acceptedOutcome(target, outcome, register, completed) {
145
+ switch (target.criterion) {
146
+ case "AC5.5":
147
+ return gateExercise(target, outcome, register);
148
+ case "AC6.4":
149
+ return credentialExercise(target, outcome);
150
+ case "AC7.2":
151
+ return rollbackExercise(target, outcome, completed);
152
+ case "AC8.9":
153
+ return staffExercise(target, outcome, completed);
154
+ }
155
+ }
156
+ /**
157
+ * Bind an authenticated result to the exact target, environment, and current checks.
158
+ * @param target - The applicable criterion and declared surface
159
+ * @param result - A statement whose signer has already been checked
160
+ * @param binding - The current evidence context
161
+ * @returns The result's durable identity and completion time, or a fixed refusal
162
+ */
163
+ export function acceptExercise(target, result, binding) {
164
+ if (Object.keys(result).length !== 12 ||
165
+ result.schema_version !== 1 ||
166
+ result.repository !== binding.repository ||
167
+ result.environment !== binding.environment ||
168
+ result.checks_digest !== binding.checksDigest ||
169
+ result.target_id !== target.id ||
170
+ result.criterion !== target.criterion ||
171
+ result.scope !== target.scope ||
172
+ result.producer !== target.producer ||
173
+ result.adjudicator !== target.adjudicator)
174
+ return "The exercise is bound to a different target, environment, check definition, or authority.";
175
+ const { artifact, completed_at: completed, outcome } = result;
176
+ if (!isImmutableArtifact(artifact) ||
177
+ !isCanonicalUtc(completed) ||
178
+ !isJsonObject(outcome))
179
+ return "The exercise needs an immutable artifact identity, a UTC completion time, and a typed result.";
180
+ if (!isEvidenceFresh({ completed_at: completed, freshness_seconds: DEFAULT_FRESHNESS_SECONDS }, binding.now))
181
+ return "The exercise is outside its evidence lifetime.";
182
+ return acceptedOutcome(target, outcome, binding.register, completed)
183
+ ? { completedAt: completed }
184
+ : "The result does not establish the declared exercise.";
185
+ }
186
+ //# sourceMappingURL=exercise-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-result.js","sourceRoot":"","sources":["../../src/controls/exercise-result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAuB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAoBpE,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,qDAAqD,CAAC;AAE/E,sFAAsF;AACtF,MAAM,SAAS,GAAG,wCAAwC,CAAC;AAE3D;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,QAAiB;IAC5C,OAAO,CACL,YAAY,CAAC,QAAQ,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAClC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxB,CAAC,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;gBACnC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CA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AAC,mBAAmB,CAAC,QAAQ,CAAC;QAC9B,CAAC,cAAc,CAAC,SAAS,CAAC;QAC1B,CAAC,YAAY,CAAC,OAAO,CAAC;QAEtB,OAAO,+FAA+F,CAAC;IACzG,IACE,CAAC,eAAe,CACd,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,EACzE,OAAO,CAAC,GAAG,CACZ;QAED,OAAO,gDAAgD,CAAC;IAC1D,OAAO,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC;QAClE,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE;QAC5B,CAAC,CAAC,sDAAsD,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,53 @@
1
+ /** What both halves of the check were tied to in the host. */
2
+ export interface HostProofSubject {
3
+ readonly repository: string;
4
+ readonly environment: string;
5
+ readonly work_item: string;
6
+ readonly entry_id: string;
7
+ readonly platform: string;
8
+ readonly executor_path: string;
9
+ readonly checks_digest: string;
10
+ }
11
+ /** The identity retained when a run's output is kept separately. */
12
+ export interface HostProofRunIdentity {
13
+ readonly run_id: string;
14
+ readonly run_url: string;
15
+ readonly commit: string;
16
+ readonly artifact_sha256: string;
17
+ }
18
+ /** One immutable platform run and the end of its check output. */
19
+ interface HostProofRun extends HostProofRunIdentity {
20
+ readonly started_at: string;
21
+ readonly completed_at: string;
22
+ readonly exit_status: number;
23
+ readonly output_excerpt: string;
24
+ }
25
+ /** A signed input stays distinct from the receipt that attest writes. */
26
+ export interface HostProofInput {
27
+ readonly schema_version: 1;
28
+ readonly subject: HostProofSubject;
29
+ readonly producer: string;
30
+ readonly adjudicator: string;
31
+ readonly clean: HostProofRun;
32
+ readonly violation: HostProofRun;
33
+ }
34
+ /**
35
+ * Validate the target of a paired proof.
36
+ * @param value - The signed subject
37
+ * @returns Whether it names the specific repository, entry and check files
38
+ */
39
+ export declare function isHostProofSubject(value: unknown): value is HostProofSubject;
40
+ /**
41
+ * Validate the provenance fields shared between an input run and its receipt.
42
+ * @param value - A run record supplied by either authorized role
43
+ * @returns Whether it identifies one hosted run and its artifact
44
+ */
45
+ export declare function isHostProofRunIdentity(value: unknown): value is HostProofRunIdentity;
46
+ /**
47
+ * Read the two halves and their common binding from an authenticated input.
48
+ * @param value - The body of an authorized signed envelope
49
+ * @returns The well-formed pair, or null when the declaration cannot be used
50
+ */
51
+ export declare function hostProofInput(value: unknown): HostProofInput | null;
52
+ export {};
53
+ //# sourceMappingURL=host-proof-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-proof-input.d.ts","sourceRoot":"","sources":["../../src/controls/host-proof-input.ts"],"names":[],"mappings":"AAQA,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,oEAAoE;AACpE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,kEAAkE;AAClE,UAAU,YAAa,SAAQ,oBAAoB;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;CAClC;AAuDD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAO5E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,oBAAoB,CAS/B;AAwBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAgCpE"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * The independent adjudicator's account of two pull-request runs.
3
+ * @module
4
+ */
5
+ import { isJsonObject } from "../sync/json-path.js";
6
+ import { isCanonicalUtc } from "./evidence.js";
7
+ import { isSha256 } from "./evidence-binding.js";
8
+ /** Fields describing which declared check the proof ran. */
9
+ const SUBJECT_LABELS = [
10
+ "repository",
11
+ "environment",
12
+ "work_item",
13
+ "entry_id",
14
+ "platform",
15
+ "executor_path",
16
+ ];
17
+ /** Git object ids may be SHA-1 or SHA-256, according to the host repository. */
18
+ const OBJECT_ID = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
19
+ /** Limit prose to the evidence document's role as a short record. */
20
+ const EXCERPT_LIMIT = 16_384;
21
+ /**
22
+ * Tell whether a name or identifier fits on one line.
23
+ * @param value - A name supplied by the adjudicator
24
+ * @returns Whether it can be used as a label
25
+ */
26
+ function label(value) {
27
+ return (typeof value === "string" &&
28
+ value.length <= 512 &&
29
+ value.trim() === value &&
30
+ value !== "" &&
31
+ !/[\r\n\t]/u.test(value));
32
+ }
33
+ /**
34
+ * A proof refers to a hosted run without including authentication material.
35
+ * @param value - The recorded run locator
36
+ * @returns Whether it is an HTTPS resource with a path and no credentials
37
+ */
38
+ function runLocator(value) {
39
+ if (!label(value))
40
+ return false;
41
+ try {
42
+ const url = new URL(value);
43
+ return (url.protocol === "https:" &&
44
+ url.pathname !== "/" &&
45
+ url.username === "" &&
46
+ url.password === "" &&
47
+ url.search === "" &&
48
+ url.hash === "");
49
+ }
50
+ catch {
51
+ return false;
52
+ }
53
+ }
54
+ /**
55
+ * Validate the target of a paired proof.
56
+ * @param value - The signed subject
57
+ * @returns Whether it names the specific repository, entry and check files
58
+ */
59
+ export function isHostProofSubject(value) {
60
+ return (isJsonObject(value) &&
61
+ Object.keys(value).length === SUBJECT_LABELS.length + 1 &&
62
+ SUBJECT_LABELS.every(key => label(value[key])) &&
63
+ isSha256(value.checks_digest));
64
+ }
65
+ /**
66
+ * Validate the provenance fields shared between an input run and its receipt.
67
+ * @param value - A run record supplied by either authorized role
68
+ * @returns Whether it identifies one hosted run and its artifact
69
+ */
70
+ export function isHostProofRunIdentity(value) {
71
+ return (isJsonObject(value) &&
72
+ label(value.run_id) &&
73
+ runLocator(value.run_url) &&
74
+ typeof value.commit === "string" &&
75
+ OBJECT_ID.test(value.commit) &&
76
+ isSha256(value.artifact_sha256));
77
+ }
78
+ /**
79
+ * Validate the result of one platform run.
80
+ * @param value - The signed account of the run
81
+ * @returns Whether the run carries all data needed to record what it measured
82
+ */
83
+ function hostRun(value) {
84
+ return (isJsonObject(value) &&
85
+ Object.keys(value).length === 8 &&
86
+ isCanonicalUtc(value.started_at) &&
87
+ isCanonicalUtc(value.completed_at) &&
88
+ value.started_at <= value.completed_at &&
89
+ typeof value.exit_status === "number" &&
90
+ Number.isInteger(value.exit_status) &&
91
+ value.exit_status >= 0 &&
92
+ value.exit_status <= 255 &&
93
+ typeof value.output_excerpt === "string" &&
94
+ value.output_excerpt.length <= EXCERPT_LIMIT &&
95
+ isHostProofRunIdentity(value));
96
+ }
97
+ /**
98
+ * Read the two halves and their common binding from an authenticated input.
99
+ * @param value - The body of an authorized signed envelope
100
+ * @returns The well-formed pair, or null when the declaration cannot be used
101
+ */
102
+ export function hostProofInput(value) {
103
+ if (!isJsonObject(value) ||
104
+ Object.keys(value).length !== 6 ||
105
+ value.schema_version !== 1 ||
106
+ !isHostProofSubject(value.subject) ||
107
+ !label(value.producer) ||
108
+ !label(value.adjudicator) ||
109
+ !hostRun(value.clean) ||
110
+ !hostRun(value.violation))
111
+ return null;
112
+ const { subject, producer, adjudicator, clean, violation } = value;
113
+ if (producer === adjudicator ||
114
+ clean.run_id === violation.run_id ||
115
+ clean.run_url === violation.run_url ||
116
+ clean.commit === violation.commit ||
117
+ clean.exit_status !== 0 ||
118
+ violation.exit_status === 0)
119
+ return null;
120
+ return {
121
+ schema_version: 1,
122
+ subject,
123
+ producer,
124
+ adjudicator,
125
+ clean,
126
+ violation,
127
+ };
128
+ }
129
+ //# sourceMappingURL=host-proof-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-proof-input.js","sourceRoot":"","sources":["../../src/controls/host-proof-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAuCjD,4DAA4D;AAC5D,MAAM,cAAc,GAAG;IACrB,YAAY;IACZ,aAAa;IACb,WAAW;IACX,UAAU;IACV,UAAU;IACV,eAAe;CACP,CAAC;AAEX,gFAAgF;AAChF,MAAM,SAAS,GAAG,kCAAkC,CAAC;AAErD,qEAAqE;AACrE,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B;;;;GAIG;AACH,SAAS,KAAK,CAAC,KAAc;IAC3B,OAAO,CACL,OAAO,KAAK,KAAK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d,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACnE,IACE,QAAQ,KAAK,WAAW;QACxB,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QACjC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO;QACnC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QACjC,KAAK,CAAC,WAAW,KAAK,CAAC;QACvB,SAAS,CAAC,WAAW,KAAK,CAAC;QAE3B,OAAO,IAAI,CAAC;IAEd,OAAO;QACL,cAAc,EAAE,CAAC;QACjB,OAAO;QACP,QAAQ;QACR,WAAW;QACX,KAAK;QACL,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ /** Receipts authenticate what attest recorded for a specific hosted check. */
2
+ import type { KeyObject } from "node:crypto";
3
+ import type { EvidenceDocument } from "./evidence-types.js";
4
+ import { type HostProofInput, type HostProofRunIdentity, type HostProofSubject } from "./host-proof-input.js";
5
+ import type { HostProofTrust } from "./host-proof-trust.js";
6
+ import type { PullRequestExecutor } from "./register-types.js";
7
+ /** Where the attest writer places its authenticated receipts. */
8
+ export declare const HOST_PROOF_RECEIPTS_PATH = ".lisa/controls/host-proof-receipts.json";
9
+ /** A checked receipt binds the exact records written for both runs. */
10
+ interface HostProofReceipt {
11
+ readonly schema_version: 1;
12
+ readonly subject: HostProofSubject;
13
+ readonly adjudicator: string;
14
+ readonly attestor: string;
15
+ readonly issued_at: string;
16
+ readonly input_digest: string;
17
+ readonly records_digest: string;
18
+ readonly runs: Readonly<Record<"clean" | "violation", HostProofRunIdentity>>;
19
+ }
20
+ /**
21
+ * Sign the passed pair that attest is about to write, using the protected issuer.
22
+ * @param source - The independently adjudicated input
23
+ * @param evidence - The exact evidence text's parsed data
24
+ * @param trust - The external authorization for this repository
25
+ * @param signer - The matching private key, available only to the attestor
26
+ * @param now - When these records are written
27
+ * @returns A signed receipt, or null when the completed pair did not hold
28
+ */
29
+ export declare function sealHostProof(source: HostProofInput, evidence: EvidenceDocument, trust: HostProofTrust, signer: KeyObject, now: Date): import("./host-proof-signature.js").SignedHostProof<HostProofReceipt> | null;
30
+ /** All information needed to check one receipt against current evidence. */
31
+ interface ReceiptCheck {
32
+ readonly evidence: EvidenceDocument;
33
+ readonly checkedDigest: string;
34
+ readonly trust: HostProofTrust;
35
+ readonly entry: string;
36
+ readonly executor: PullRequestExecutor;
37
+ readonly now: Date;
38
+ }
39
+ /**
40
+ * Check the attestor, target, written records and evidence age together.
41
+ * @param envelope - A candidate receipt read from the checkout
42
+ * @param check - The actual repository, authority, entry and current evidence
43
+ * @returns Why the receipt cannot clear the mark, or null when it can
44
+ */
45
+ export declare function hostProofReceiptProblem(envelope: unknown, check: ReceiptCheck): string | null;
46
+ export {};
47
+ //# sourceMappingURL=host-proof-receipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-proof-receipt.d.ts","sourceRoot":"","sources":["../../src/controls/host-proof-receipt.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAK7C,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,4CACM,CAAC;AAK5C,uEAAuE;AACvE,UAAU,gBAAgB;IACxB,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,GAAG,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAC9E;AAgED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,IAAI,gFAoBV;AAED,4EAA4E;AAC5E,UAAU,YAAY;IACpB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;CACpB;AAqBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,YAAY,GAClB,MAAM,GAAG,IAAI,CAkCf"}
@@ -0,0 +1,132 @@
1
+ import { isJsonObject } from "../sync/json-path.js";
2
+ import { isCanonicalUtc, isEvidenceFresh } from "./evidence.js";
3
+ import { isSha256 } from "./evidence-binding.js";
4
+ import { isHostProofRunIdentity, isHostProofSubject, } from "./host-proof-input.js";
5
+ import { signHostProof, verifyHostProof } from "./host-proof-signature.js";
6
+ import { digestOf } from "./verdict-digest.js";
7
+ /** Where the attest writer places its authenticated receipts. */
8
+ export const HOST_PROOF_RECEIPTS_PATH = ".lisa/controls/host-proof-receipts.json";
9
+ /** Do not let an input signature stand in for this receipt's signature. */
10
+ const RECEIPT = "host-proof-receipt";
11
+ /**
12
+ * Hide the raw captured text while retaining the evidence identity.
13
+ * @param run - One authorized run
14
+ * @returns Its host identifier, locator, commit, and artifact hash
15
+ */
16
+ function runIdentity(run) {
17
+ const { run_id, run_url, commit, artifact_sha256 } = run;
18
+ return { run_id, run_url, commit, artifact_sha256 };
19
+ }
20
+ /**
21
+ * Select the finalized exercised evidence for one entry and moment.
22
+ * @param evidence - The complete evidence document
23
+ * @param entry - The register entry whose records are being sealed or checked
24
+ * @returns The exact records, in evidence order
25
+ */
26
+ function recordsFor(evidence, entry) {
27
+ return evidence.records.filter(record => record.entry_id === entry &&
28
+ record.moment === "pull-request" &&
29
+ record.rung === "exercised");
30
+ }
31
+ /**
32
+ * Tell whether the paired records both held while the approved binding was current.
33
+ * @param records - All exercised records of the entry
34
+ * @param checksDigest - The digest of the currently bound check definitions
35
+ * @param now - The clock used by attest and register
36
+ * @returns The reason the pair cannot be relied on, or null
37
+ */
38
+ function pairProblem(records, checksDigest, now) {
39
+ const clean = records.filter(record => record.half === "clean");
40
+ const violating = new Set(records
41
+ .filter(record => record.half === "violation")
42
+ .map(record => record.criterion));
43
+ if (clean.length === 0 ||
44
+ records.length !== 2 * clean.length ||
45
+ violating.size !== clean.length ||
46
+ clean.some(record => !violating.has(record.criterion)) ||
47
+ records.some(record => record.result !== "held" || record.checks_digest !== checksDigest))
48
+ return "The evidence does not contain both held halves for the current check definitions.";
49
+ return records.every(record => isEvidenceFresh(record, now))
50
+ ? null
51
+ : "At least one half of the recorded proof is outside its evidence lifetime.";
52
+ }
53
+ /**
54
+ * Sign the passed pair that attest is about to write, using the protected issuer.
55
+ * @param source - The independently adjudicated input
56
+ * @param evidence - The exact evidence text's parsed data
57
+ * @param trust - The external authorization for this repository
58
+ * @param signer - The matching private key, available only to the attestor
59
+ * @param now - When these records are written
60
+ * @returns A signed receipt, or null when the completed pair did not hold
61
+ */
62
+ export function sealHostProof(source, evidence, trust, signer, now) {
63
+ const { subject, clean, violation } = source;
64
+ const records = recordsFor(evidence, subject.entry_id);
65
+ if (subject.checks_digest !== evidence.checks.digest ||
66
+ pairProblem(records, subject.checks_digest, now) !== null)
67
+ return null;
68
+ const receipt = {
69
+ schema_version: 1,
70
+ subject,
71
+ adjudicator: trust.adjudicator.id,
72
+ attestor: trust.attestor.id,
73
+ issued_at: now.toISOString(),
74
+ input_digest: digestOf(source),
75
+ records_digest: digestOf(records),
76
+ runs: { clean: runIdentity(clean), violation: runIdentity(violation) },
77
+ };
78
+ return signHostProof(RECEIPT, receipt, signer);
79
+ }
80
+ /**
81
+ * Check the shape of both immutable run identities recorded by the attestor.
82
+ * @param runs - Run fields in the signed receipt
83
+ * @returns Whether the receipt describes two distinct commits and runs
84
+ */
85
+ function receiptRuns(runs) {
86
+ return (isJsonObject(runs) &&
87
+ Object.keys(runs).length === 2 &&
88
+ isHostProofRunIdentity(runs.clean) &&
89
+ isHostProofRunIdentity(runs.violation) &&
90
+ Object.keys(runs.clean).length === 4 &&
91
+ Object.keys(runs.violation).length === 4 &&
92
+ runs.clean.run_id !== runs.violation.run_id &&
93
+ runs.clean.run_url !== runs.violation.run_url &&
94
+ runs.clean.commit !== runs.violation.commit);
95
+ }
96
+ /**
97
+ * Check the attestor, target, written records and evidence age together.
98
+ * @param envelope - A candidate receipt read from the checkout
99
+ * @param check - The actual repository, authority, entry and current evidence
100
+ * @returns Why the receipt cannot clear the mark, or null when it can
101
+ */
102
+ export function hostProofReceiptProblem(envelope, check) {
103
+ const { evidence, checkedDigest, trust, entry, executor, now } = check;
104
+ const receipt = verifyHostProof(envelope, RECEIPT, trust.attestor.key);
105
+ if (receipt === null)
106
+ return "The receipt signature could not be verified with the authorized attestor key.";
107
+ if (Object.keys(receipt).length !== 8 ||
108
+ receipt.schema_version !== 1 ||
109
+ receipt.adjudicator !== trust.adjudicator.id ||
110
+ receipt.attestor !== trust.attestor.id ||
111
+ !isCanonicalUtc(receipt.issued_at) ||
112
+ Date.parse(receipt.issued_at) > now.getTime() ||
113
+ !isSha256(receipt.input_digest) ||
114
+ !isSha256(receipt.records_digest) ||
115
+ !isHostProofSubject(receipt.subject) ||
116
+ !receiptRuns(receipt.runs))
117
+ return "The signed receipt has an invalid schema, run identity, or issuing authority.";
118
+ const { subject } = receipt;
119
+ if (subject.repository !== trust.repository ||
120
+ subject.environment !== trust.environment ||
121
+ subject.entry_id !== entry ||
122
+ subject.platform !== executor.platform ||
123
+ subject.executor_path !== executor.path ||
124
+ subject.checks_digest !== checkedDigest ||
125
+ evidence.checks.digest !== checkedDigest)
126
+ return "The receipt targets a different repository, environment, entry, executor, or check definition.";
127
+ const records = recordsFor(evidence, entry);
128
+ return receipt.records_digest === digestOf(records)
129
+ ? pairProblem(records, checkedDigest, now)
130
+ : "The recorded evidence does not match the signed receipt.";
131
+ }
132
+ //# sourceMappingURL=host-proof-receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-proof-receipt.js","sourceRoot":"","sources":["../../src/controls/host-proof-receipt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GAInB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GACnC,yCAAyC,CAAC;AAE5C,2EAA2E;AAC3E,MAAM,OAAO,GAAG,oBAAoB,CAAC;AAcrC;;;;GAIG;AACH,SAAS,WAAW,CAAC,GAA4B;IAC/C,MAAM,EAAE,MAAM,EAAE,OAAO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AAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC;QACjC,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;QACpC,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;QAE1B,OAAO,+EAA+E,CAAC;IAEzF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,IACE,OAAO,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;QACvC,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW;QACzC,OAAO,CAAC,QAAQ,KAAK,KAAK;QAC1B,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;QACtC,OAAO,CAAC,aAAa,KAAK,QAAQ,CAAC,IAAI;QACvC,OAAO,CAAC,aAAa,KAAK,aAAa;QACvC,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,aAAa;QAExC,OAAO,gGAAgG,CAAC;IAC1G,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC,cAAc,KAAK,QAAQ,CAAC,OAAO,CAAC;QACjD,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC;QAC1C,CAAC,CAAC,0DAA0D,CAAC;AACjE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /** Resolve which hosted checks have a current receipt from an authorized attestor. */
2
+ import type { KeyObject } from "node:crypto";
3
+ import type { EvidenceDocument } from "./evidence-types.js";
4
+ import type { HostProofInput } from "./host-proof-input.js";
5
+ import { type HostProofTrust } from "./host-proof-trust.js";
6
+ import type { ControlRegisterEntry } from "./register-types.js";
7
+ /** The verified input and protected issuer of the next receipt. */
8
+ export interface PendingHostReceipt {
9
+ readonly source: HostProofInput;
10
+ readonly trust: HostProofTrust;
11
+ readonly signer: KeyObject;
12
+ }
13
+ /** Current entry ids and fixed diagnostic text for any remaining gaps. */
14
+ interface HostProofStatus {
15
+ readonly current: ReadonlySet<string>;
16
+ readonly notes: readonly string[];
17
+ }
18
+ /**
19
+ * Seal only the records the next attest write will actually store.
20
+ * @param root - Real checkout path
21
+ * @param evidence - The finalized evidence to be written with the receipt
22
+ * @param pending - The approved input and private attestor identity
23
+ * @param now - When the proof was recorded
24
+ * @returns The receipt file text, or null if the update could not be produced
25
+ */
26
+ export declare function hostReceiptText(root: string, evidence: EvidenceDocument, pending: PendingHostReceipt, now: Date): Promise<string | null>;
27
+ /**
28
+ * Recompute the current binding and check the attest signature for each entry.
29
+ * @param root - Real checkout path
30
+ * @param entries - Register entries marked unproved before checking receipts
31
+ * @param now - The same clock used to assess the evidence's expiry
32
+ * @param trustPath - Externally selected trust configuration for this process
33
+ * @returns Entries whose exact stored proof is current and notes for the other entries
34
+ */
35
+ export declare function evaluateHostReceipts(root: string, entries: readonly ControlRegisterEntry[], now: Date, trustPath?: string | undefined): Promise<HostProofStatus>;
36
+ export {};
37
+ //# sourceMappingURL=host-proof-register.d.ts.map