@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.
- package/dist/controls/attest-check.d.ts.map +1 -1
- package/dist/controls/attest-check.js +31 -18
- package/dist/controls/attest-check.js.map +1 -1
- package/dist/controls/attest-record.d.ts +3 -0
- package/dist/controls/attest-record.d.ts.map +1 -1
- package/dist/controls/attest-record.js +28 -5
- package/dist/controls/attest-record.js.map +1 -1
- package/dist/controls/checks-binding.d.ts.map +1 -1
- package/dist/controls/checks-binding.js +28 -1
- package/dist/controls/checks-binding.js.map +1 -1
- package/dist/controls/commands/attest-host-proof.d.ts +18 -0
- package/dist/controls/commands/attest-host-proof.d.ts.map +1 -0
- package/dist/controls/commands/attest-host-proof.js +168 -0
- package/dist/controls/commands/attest-host-proof.js.map +1 -0
- package/dist/controls/commands/attest-options.d.ts +4 -0
- package/dist/controls/commands/attest-options.d.ts.map +1 -1
- package/dist/controls/commands/attest.d.ts.map +1 -1
- package/dist/controls/commands/attest.js +52 -0
- package/dist/controls/commands/attest.js.map +1 -1
- package/dist/controls/commands/declaration-check.d.ts.map +1 -1
- package/dist/controls/commands/declaration-check.js +19 -5
- package/dist/controls/commands/declaration-check.js.map +1 -1
- package/dist/controls/commands/register.d.ts.map +1 -1
- package/dist/controls/commands/register.js +4 -1
- package/dist/controls/commands/register.js.map +1 -1
- package/dist/controls/evidence-document.d.ts.map +1 -1
- package/dist/controls/evidence-document.js +12 -0
- package/dist/controls/evidence-document.js.map +1 -1
- package/dist/controls/evidence-gather.d.ts +1 -0
- package/dist/controls/evidence-gather.d.ts.map +1 -1
- package/dist/controls/evidence-gather.js +5 -2
- package/dist/controls/evidence-gather.js.map +1 -1
- package/dist/controls/evidence-types.d.ts +19 -1
- package/dist/controls/evidence-types.d.ts.map +1 -1
- package/dist/controls/evidence-types.js +11 -0
- package/dist/controls/evidence-types.js.map +1 -1
- package/dist/controls/evidence-write.d.ts.map +1 -1
- package/dist/controls/evidence-write.js +7 -1
- package/dist/controls/evidence-write.js.map +1 -1
- package/dist/controls/exercise-declaration.d.ts +58 -0
- package/dist/controls/exercise-declaration.d.ts.map +1 -0
- package/dist/controls/exercise-declaration.js +138 -0
- package/dist/controls/exercise-declaration.js.map +1 -0
- package/dist/controls/exercise-observations.d.ts +32 -0
- package/dist/controls/exercise-observations.d.ts.map +1 -0
- package/dist/controls/exercise-observations.js +141 -0
- package/dist/controls/exercise-observations.js.map +1 -0
- package/dist/controls/exercise-record-shape.d.ts +10 -0
- package/dist/controls/exercise-record-shape.d.ts.map +1 -0
- package/dist/controls/exercise-record-shape.js +29 -0
- package/dist/controls/exercise-record-shape.js.map +1 -0
- package/dist/controls/exercise-records.d.ts +28 -0
- package/dist/controls/exercise-records.d.ts.map +1 -0
- package/dist/controls/exercise-records.js +113 -0
- package/dist/controls/exercise-records.js.map +1 -0
- package/dist/controls/exercise-result.d.ts +23 -0
- package/dist/controls/exercise-result.d.ts.map +1 -0
- package/dist/controls/exercise-result.js +186 -0
- package/dist/controls/exercise-result.js.map +1 -0
- package/dist/controls/host-proof-input.d.ts +53 -0
- package/dist/controls/host-proof-input.d.ts.map +1 -0
- package/dist/controls/host-proof-input.js +129 -0
- package/dist/controls/host-proof-input.js.map +1 -0
- package/dist/controls/host-proof-receipt.d.ts +47 -0
- package/dist/controls/host-proof-receipt.d.ts.map +1 -0
- package/dist/controls/host-proof-receipt.js +132 -0
- package/dist/controls/host-proof-receipt.js.map +1 -0
- package/dist/controls/host-proof-register.d.ts +37 -0
- package/dist/controls/host-proof-register.d.ts.map +1 -0
- package/dist/controls/host-proof-register.js +153 -0
- package/dist/controls/host-proof-register.js.map +1 -0
- package/dist/controls/host-proof-signature.d.ts +30 -0
- package/dist/controls/host-proof-signature.d.ts.map +1 -0
- package/dist/controls/host-proof-signature.js +49 -0
- package/dist/controls/host-proof-signature.js.map +1 -0
- package/dist/controls/host-proof-trust.d.ts +33 -0
- package/dist/controls/host-proof-trust.d.ts.map +1 -0
- package/dist/controls/host-proof-trust.js +124 -0
- package/dist/controls/host-proof-trust.js.map +1 -0
- package/dist/controls/pull-request-executor.d.ts +18 -6
- package/dist/controls/pull-request-executor.d.ts.map +1 -1
- package/dist/controls/pull-request-executor.js +19 -24
- package/dist/controls/pull-request-executor.js.map +1 -1
- package/dist/controls/register-types.d.ts +3 -4
- package/dist/controls/register-types.d.ts.map +1 -1
- package/dist/controls/register-types.js +3 -4
- package/dist/controls/register-types.js.map +1 -1
- package/dist/controls/register.d.ts +4 -7
- package/dist/controls/register.d.ts.map +1 -1
- package/dist/controls/register.js +17 -6
- package/dist/controls/register.js.map +1 -1
- package/dist/controls/verdict-answers.d.ts.map +1 -1
- package/dist/controls/verdict-answers.js +6 -2
- package/dist/controls/verdict-answers.js.map +1 -1
- package/dist/controls/verdict-types.d.ts +1 -1
- package/dist/controls/verdict-types.d.ts.map +1 -1
- package/dist/controls/verdict-types.js +2 -0
- package/dist/controls/verdict-types.js.map +1 -1
- package/dist/controls/verdict-wording.d.ts +2 -0
- package/dist/controls/verdict-wording.d.ts.map +1 -1
- package/dist/controls/verdict-wording.js +7 -0
- package/dist/controls/verdict-wording.js.map +1 -1
- package/dist/controls/verdict.d.ts +2 -0
- package/dist/controls/verdict.d.ts.map +1 -1
- package/dist/controls/verdict.js +17 -2
- package/dist/controls/verdict.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.json +34 -3
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/plugins/lisa/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/lisa/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/lisa/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/lisa-agy/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/lisa-agy/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/lisa-copilot/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/lisa-copilot/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/lisa-cursor/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/lisa-cursor/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/lisa-devin/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/lisa-devin/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-attest/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-configure/SKILL.md +3 -2
- package/plugins/src/base/skills/lisa-configure/references/exercised-artifacts.md +55 -0
- package/plugins/src/base/skills/lisa-enforce/references/pull-request-executor.md +34 -10
- package/schemas/control-evidence.schema.json +39 -1
- package/schemas/control-verdict.schema.json +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-proof-register.d.ts","sourceRoot":"","sources":["../../src/controls/host-proof-register.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAS7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,mEAAmE;AACnE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;CAC5B;AAED,0EAA0E;AAC1E,UAAU,eAAe;IACvB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAyED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBxB;AA+BD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,GAAG,EAAE,IAAI,EACT,SAAS,qBAAiC,GACzC,OAAO,CAAC,eAAe,CAAC,CAkC1B"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { isJsonObject } from "../sync/json-path.js";
|
|
2
|
+
import { readEnv } from "../utils/process-environment.js";
|
|
3
|
+
import { canonicalFileText } from "./canonical-json.js";
|
|
4
|
+
import { bindChecks } from "./checks-binding.js";
|
|
5
|
+
import { readControlFile } from "./control-files.js";
|
|
6
|
+
import { EVIDENCE_PATH } from "./evidence.js";
|
|
7
|
+
import { parseEvidenceDocument } from "./evidence-document.js";
|
|
8
|
+
import { HOST_PROOF_RECEIPTS_PATH, hostProofReceiptProblem, sealHostProof, } from "./host-proof-receipt.js";
|
|
9
|
+
import { HOST_PROOF_TRUST_FILE, loadHostProofTrust, } from "./host-proof-trust.js";
|
|
10
|
+
import { readOriginUrl } from "./protect-platform.js";
|
|
11
|
+
import { unwrittenExecutor } from "./pull-request-executor.js";
|
|
12
|
+
/**
|
|
13
|
+
* Read the receipt list without assuming any row is trustworthy.
|
|
14
|
+
* @param root - Real checkout path
|
|
15
|
+
* @returns The proposed receipts, or null when the file cannot be used
|
|
16
|
+
*/
|
|
17
|
+
async function readHostProofReceipts(root) {
|
|
18
|
+
const file = await readControlFile(root, HOST_PROOF_RECEIPTS_PATH);
|
|
19
|
+
if (file.kind === "missing")
|
|
20
|
+
return [];
|
|
21
|
+
if (file.kind !== "text")
|
|
22
|
+
return null;
|
|
23
|
+
try {
|
|
24
|
+
const value = JSON.parse(file.text);
|
|
25
|
+
return Array.isArray(value) ? value : null;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find the reason this entry's signed record cannot be used.
|
|
33
|
+
* @param entry - A hosted register entry
|
|
34
|
+
* @param evidence - The exact stored evidence, bound to the current files
|
|
35
|
+
* @param receipts - Candidate receipts from the checkout
|
|
36
|
+
* @param trust - The authorized parties for the checkout
|
|
37
|
+
* @param now - The same clock used to check the evidence lifetime
|
|
38
|
+
* @returns A fixed diagnostic, or null when the receipt is current
|
|
39
|
+
*/
|
|
40
|
+
function entryProofProblem(entry, evidence, receipts, trust, now) {
|
|
41
|
+
const executor = unwrittenExecutor(entry);
|
|
42
|
+
if (executor === null ||
|
|
43
|
+
!evidence.checks.covered.some(file => file.path === executor.path))
|
|
44
|
+
return "The evidence does not cover the declared executor file.";
|
|
45
|
+
const candidates = receipts.filter(receipt => receiptEntry(receipt) === entry.id);
|
|
46
|
+
const problems = candidates.map(receipt => hostProofReceiptProblem(receipt, {
|
|
47
|
+
evidence,
|
|
48
|
+
checkedDigest: evidence.checks.digest,
|
|
49
|
+
trust,
|
|
50
|
+
entry: entry.id,
|
|
51
|
+
executor,
|
|
52
|
+
now,
|
|
53
|
+
}));
|
|
54
|
+
if (problems.includes(null))
|
|
55
|
+
return null;
|
|
56
|
+
return problems[0] ?? "There is no signed receipt for this entry.";
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Read the entry name out of an existing list slot so attest can replace it.
|
|
60
|
+
* @param value - A receipt candidate that may have been edited
|
|
61
|
+
* @returns The claimed entry, or undefined when there is none
|
|
62
|
+
*/
|
|
63
|
+
function receiptEntry(value) {
|
|
64
|
+
return isJsonObject(value) &&
|
|
65
|
+
isJsonObject(value.body) &&
|
|
66
|
+
isJsonObject(value.body.subject)
|
|
67
|
+
? value.body.subject.entry_id
|
|
68
|
+
: undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Seal only the records the next attest write will actually store.
|
|
72
|
+
* @param root - Real checkout path
|
|
73
|
+
* @param evidence - The finalized evidence to be written with the receipt
|
|
74
|
+
* @param pending - The approved input and private attestor identity
|
|
75
|
+
* @param now - When the proof was recorded
|
|
76
|
+
* @returns The receipt file text, or null if the update could not be produced
|
|
77
|
+
*/
|
|
78
|
+
export async function hostReceiptText(root, evidence, pending, now) {
|
|
79
|
+
const receipt = sealHostProof(pending.source, evidence, pending.trust, pending.signer, now);
|
|
80
|
+
if (receipt === null)
|
|
81
|
+
return null;
|
|
82
|
+
const earlier = await readHostProofReceipts(root);
|
|
83
|
+
if (earlier === null)
|
|
84
|
+
return null;
|
|
85
|
+
return canonicalFileText([
|
|
86
|
+
...earlier.filter(row => receiptEntry(row) !== pending.source.subject.entry_id),
|
|
87
|
+
receipt,
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Read the evidence and candidate receipts with a current binding.
|
|
92
|
+
* @param root - Real checkout path
|
|
93
|
+
* @returns The current evidence and candidate receipts, or why they cannot be used
|
|
94
|
+
*/
|
|
95
|
+
async function currentReceiptInputs(root) {
|
|
96
|
+
const [evidenceFile, receipts] = await Promise.all([
|
|
97
|
+
readControlFile(root, EVIDENCE_PATH),
|
|
98
|
+
readHostProofReceipts(root),
|
|
99
|
+
]);
|
|
100
|
+
if (receipts === null)
|
|
101
|
+
return "The host proof receipt file is unreadable or invalid.";
|
|
102
|
+
if (receipts.length === 0)
|
|
103
|
+
return "No signed host proof receipt is on record.";
|
|
104
|
+
if (evidenceFile.kind !== "text")
|
|
105
|
+
return "The signed receipts have no readable evidence file.";
|
|
106
|
+
const parsed = parseEvidenceDocument(JSON.parse(evidenceFile.text));
|
|
107
|
+
if (parsed.problems !== null)
|
|
108
|
+
return "The evidence file does not match the required schema.";
|
|
109
|
+
const evidence = parsed.document;
|
|
110
|
+
const covered = evidence.checks.covered.map(file => file.path);
|
|
111
|
+
const binding = await bindChecks({ repository: root, also: covered });
|
|
112
|
+
return binding.digest === evidence.checks.digest
|
|
113
|
+
? { evidence, receipts }
|
|
114
|
+
: "The check definitions changed after the host proof was recorded.";
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Recompute the current binding and check the attest signature for each entry.
|
|
118
|
+
* @param root - Real checkout path
|
|
119
|
+
* @param entries - Register entries marked unproved before checking receipts
|
|
120
|
+
* @param now - The same clock used to assess the evidence's expiry
|
|
121
|
+
* @param trustPath - Externally selected trust configuration for this process
|
|
122
|
+
* @returns Entries whose exact stored proof is current and notes for the other entries
|
|
123
|
+
*/
|
|
124
|
+
export async function evaluateHostReceipts(root, entries, now, trustPath = readEnv(HOST_PROOF_TRUST_FILE)) {
|
|
125
|
+
const wanted = entries.filter(entry => entry.status === "unproved");
|
|
126
|
+
const unresolved = (message) => ({
|
|
127
|
+
current: new Set(),
|
|
128
|
+
notes: [message],
|
|
129
|
+
});
|
|
130
|
+
if (wanted.length === 0 || trustPath === undefined)
|
|
131
|
+
return { current: new Set(), notes: [] };
|
|
132
|
+
try {
|
|
133
|
+
const trust = await loadHostProofTrust(root, trustPath);
|
|
134
|
+
if (trust === null || (await readOriginUrl(root)) !== trust.repository)
|
|
135
|
+
return unresolved("The external host proof trust file is invalid or does not match this repository's origin.");
|
|
136
|
+
const inputs = await currentReceiptInputs(root);
|
|
137
|
+
if (typeof inputs === "string")
|
|
138
|
+
return unresolved(inputs);
|
|
139
|
+
const { evidence, receipts } = inputs;
|
|
140
|
+
const outcomes = wanted.map(entry => ({
|
|
141
|
+
id: entry.id,
|
|
142
|
+
problem: entryProofProblem(entry, evidence, receipts, trust, now),
|
|
143
|
+
}));
|
|
144
|
+
return {
|
|
145
|
+
current: new Set(outcomes.flatMap(({ id, problem }) => (problem === null ? [id] : []))),
|
|
146
|
+
notes: outcomes.flatMap(({ id, problem }) => problem === null ? [] : [`${id}: ${problem}`]),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return unresolved("The host proof receipt or evidence could not be checked.");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=host-proof-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-proof-register.js","sourceRoot":"","sources":["../../src/controls/host-proof-register.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,E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iB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC;SAClE,CAAC,CAAC,CAAC;QACJ,OAAO;YACL,OAAO,EAAE,IAAI,GAAG,CACd,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CACtE;YACD,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAC1C,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,OAAO,EAAE,CAAC,CAC9C;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CACf,0DAA0D,CAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Sign adjudicated host proof input and the receipts generated by attest. */
|
|
2
|
+
import { type KeyObject } from "node:crypto";
|
|
3
|
+
/** Each signed statement is valid only for its intended proof route. */
|
|
4
|
+
type ProofPurpose = "host-proof-import" | "host-proof-receipt" | "artifact-exercise";
|
|
5
|
+
/** The canonical output covers the phase as well as the evidence body. */
|
|
6
|
+
export interface SignedHostProof<Body> {
|
|
7
|
+
readonly purpose: ProofPurpose;
|
|
8
|
+
readonly body: Body;
|
|
9
|
+
readonly signature: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Sign the canonical body and its intended use with a trusted private key.
|
|
13
|
+
* @param purpose - Whether this is an adjudicated input or an attest receipt
|
|
14
|
+
* @param body - The validated statement
|
|
15
|
+
* @param key - The signer's private Ed25519 key
|
|
16
|
+
* @returns A signed envelope
|
|
17
|
+
* @throws {TypeError} When the supplied key cannot sign this envelope
|
|
18
|
+
*/
|
|
19
|
+
export declare function signHostProof<Body extends object>(purpose: ProofPurpose, body: Body, key: KeyObject): SignedHostProof<Body>;
|
|
20
|
+
/**
|
|
21
|
+
* Return a signed statement only when the authorized signer and phase match.
|
|
22
|
+
* The caller validates the authenticated body's structure and applicability.
|
|
23
|
+
* @param envelope - The untrusted statement and its signature
|
|
24
|
+
* @param purpose - The expected use of the signed statement
|
|
25
|
+
* @param key - The trusted public Ed25519 key for that use
|
|
26
|
+
* @returns The authenticated body, or null when the signature cannot be used
|
|
27
|
+
*/
|
|
28
|
+
export declare function verifyHostProof(envelope: unknown, purpose: ProofPurpose, key: KeyObject): Readonly<Record<string, unknown>> | null;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=host-proof-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-proof-signature.d.ts","sourceRoot":"","sources":["../../src/controls/host-proof-signature.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAK3D,wEAAwE;AACxE,KAAK,YAAY,GACb,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,CAAC;AAExB,0EAA0E;AAC1E,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAKD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,EAC/C,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,SAAS,GACb,eAAe,CAAC,IAAI,CAAC,CAOvB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,SAAS,GACb,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAmB1C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Sign adjudicated host proof input and the receipts generated by attest. */
|
|
2
|
+
import { sign, verify } from "node:crypto";
|
|
3
|
+
import { isJsonObject } from "../sync/json-path.js";
|
|
4
|
+
import { canonicalText } from "./canonical-json.js";
|
|
5
|
+
/** An Ed25519 signature without Base64 padding occupies 86 characters. */
|
|
6
|
+
const ENCODED_SIGNATURE = /^[A-Za-z0-9_-]{86}$/u;
|
|
7
|
+
/**
|
|
8
|
+
* Sign the canonical body and its intended use with a trusted private key.
|
|
9
|
+
* @param purpose - Whether this is an adjudicated input or an attest receipt
|
|
10
|
+
* @param body - The validated statement
|
|
11
|
+
* @param key - The signer's private Ed25519 key
|
|
12
|
+
* @returns A signed envelope
|
|
13
|
+
* @throws {TypeError} When the supplied key cannot sign this envelope
|
|
14
|
+
*/
|
|
15
|
+
export function signHostProof(purpose, body, key) {
|
|
16
|
+
if (key.type !== "private" || key.asymmetricKeyType !== "ed25519") {
|
|
17
|
+
throw new TypeError("Host proof signing needs a private Ed25519 key.");
|
|
18
|
+
}
|
|
19
|
+
const payload = { purpose, body };
|
|
20
|
+
const signature = sign(null, Buffer.from(canonicalText(payload)), key);
|
|
21
|
+
return { ...payload, signature: signature.toString("base64url") };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Return a signed statement only when the authorized signer and phase match.
|
|
25
|
+
* The caller validates the authenticated body's structure and applicability.
|
|
26
|
+
* @param envelope - The untrusted statement and its signature
|
|
27
|
+
* @param purpose - The expected use of the signed statement
|
|
28
|
+
* @param key - The trusted public Ed25519 key for that use
|
|
29
|
+
* @returns The authenticated body, or null when the signature cannot be used
|
|
30
|
+
*/
|
|
31
|
+
export function verifyHostProof(envelope, purpose, key) {
|
|
32
|
+
if (key.type !== "public" ||
|
|
33
|
+
key.asymmetricKeyType !== "ed25519" ||
|
|
34
|
+
!isJsonObject(envelope) ||
|
|
35
|
+
Object.keys(envelope).length !== 3 ||
|
|
36
|
+
envelope.purpose !== purpose ||
|
|
37
|
+
!isJsonObject(envelope.body) ||
|
|
38
|
+
typeof envelope.signature !== "string" ||
|
|
39
|
+
!ENCODED_SIGNATURE.test(envelope.signature))
|
|
40
|
+
return null;
|
|
41
|
+
const signature = Buffer.from(envelope.signature, "base64url");
|
|
42
|
+
if (signature.toString("base64url") !== envelope.signature)
|
|
43
|
+
return null;
|
|
44
|
+
const message = canonicalText({ purpose, body: envelope.body });
|
|
45
|
+
return verify(null, Buffer.from(message), key, signature)
|
|
46
|
+
? envelope.body
|
|
47
|
+
: null;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=host-proof-signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-proof-signature.js","sourceRoot":"","sources":["../../src/controls/host-proof-signature.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAkB,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAepD,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAqB,EACrB,IAAU,EACV,GAAc;IAEd,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvE,OAAO,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;AACpE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAiB,EACjB,OAAqB,EACrB,GAAc;IAEd,IACE,GAAG,CAAC,IAAI,KAAK,QAAQ;QACrB,GAAG,CAAC,iBAAiB,KAAK,SAAS;QACnC,CAAC,YAAY,CAAC,QAAQ,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAClC,QAAQ,CAAC,OAAO,KAAK,OAAO;QAC5B,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5B,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ;QACtC,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAE3C,OAAO,IAAI,CAAC;IAEd,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC/D,IAAI,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IACxE,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC;QACvD,CAAC,CAAC,QAAQ,CAAC,IAAI;QACf,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Read trust keys from operator configuration outside the audited checkout. */
|
|
2
|
+
import { type KeyObject } from "node:crypto";
|
|
3
|
+
/** Where the operator can identify the trusted issuers for this process. */
|
|
4
|
+
export declare const HOST_PROOF_TRUST_FILE = "LISA_HOST_PROOF_TRUST_FILE";
|
|
5
|
+
/** The issuer's identity is fixed by each external trust configuration. */
|
|
6
|
+
interface Identity {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly key: KeyObject;
|
|
9
|
+
}
|
|
10
|
+
/** Trusted roles and the repository they can speak for. */
|
|
11
|
+
export interface HostProofTrust {
|
|
12
|
+
readonly repository: string;
|
|
13
|
+
readonly environment: string;
|
|
14
|
+
readonly adjudicator: Identity;
|
|
15
|
+
readonly attestor: Identity;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Load the independent adjudicator and attest issuer for this checkout.
|
|
19
|
+
* @param root - Real path of the checkout under evaluation
|
|
20
|
+
* @param named - Path selected by the operator through the process environment
|
|
21
|
+
* @returns The issuers and scope, or null if no trusted configuration is usable
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadHostProofTrust(root: string, named: string | undefined): Promise<HostProofTrust | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Load the protected private key for the attest process only.
|
|
26
|
+
* @param root - Real path of the checkout under evaluation
|
|
27
|
+
* @param named - Explicit private key path supplied to attest
|
|
28
|
+
* @param trust - The public attestor key pinned outside the checkout
|
|
29
|
+
* @returns The matching private key, or null when it cannot be used
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadHostProofSigningKey(root: string, named: string, trust: HostProofTrust): Promise<KeyObject | null>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=host-proof-trust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-proof-trust.d.ts","sourceRoot":"","sources":["../../src/controls/host-proof-trust.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAQhF,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAKlE,2EAA2E;AAC3E,UAAU,QAAQ;IAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;CACzB;AAED,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AA8DD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAiChC;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAY3B"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Read trust keys from operator configuration outside the audited checkout. */
|
|
2
|
+
import { createPrivateKey, createPublicKey } from "node:crypto";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import { open, realpath } from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { isJsonObject } from "../sync/json-path.js";
|
|
7
|
+
import { isWithin } from "./carrier-owner.js";
|
|
8
|
+
/** Where the operator can identify the trusted issuers for this process. */
|
|
9
|
+
export const HOST_PROOF_TRUST_FILE = "LISA_HOST_PROOF_TRUST_FILE";
|
|
10
|
+
/** Keep reads bounded, including failures on an invalid path. */
|
|
11
|
+
const MAX_TRUST_FILE_BYTES = 16 * 1024;
|
|
12
|
+
/**
|
|
13
|
+
* Read a small ordinary file whose real path is outside the checkout.
|
|
14
|
+
* @param root - Real path of the checkout under evaluation
|
|
15
|
+
* @param named - Operator-provided absolute path
|
|
16
|
+
* @param privateFile - Whether group or other users must lack access
|
|
17
|
+
* @returns Its bytes as text, or null if the file cannot be used
|
|
18
|
+
*/
|
|
19
|
+
async function readExternalFile(root, named, privateFile = false) {
|
|
20
|
+
if (!path.isAbsolute(named))
|
|
21
|
+
return null;
|
|
22
|
+
try {
|
|
23
|
+
const file = await realpath(named);
|
|
24
|
+
if (isWithin(root, file))
|
|
25
|
+
return null;
|
|
26
|
+
const handle = await open(file, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
27
|
+
try {
|
|
28
|
+
const stat = await handle.stat();
|
|
29
|
+
if (!stat.isFile() ||
|
|
30
|
+
stat.size > MAX_TRUST_FILE_BYTES ||
|
|
31
|
+
(privateFile && (stat.mode & 0o077) !== 0))
|
|
32
|
+
return null;
|
|
33
|
+
const bytes = Buffer.alloc(MAX_TRUST_FILE_BYTES + 1);
|
|
34
|
+
const { bytesRead } = await handle.read(bytes, 0, bytes.length, 0);
|
|
35
|
+
return bytesRead <= MAX_TRUST_FILE_BYTES
|
|
36
|
+
? bytes.toString("utf8", 0, bytesRead)
|
|
37
|
+
: null;
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
await handle.close();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Read one externally authorized public signer.
|
|
49
|
+
* @param value - An issuer and its PEM public key
|
|
50
|
+
* @returns The authorized identity and Ed25519 key, or null
|
|
51
|
+
*/
|
|
52
|
+
function identity(value) {
|
|
53
|
+
if (!isJsonObject(value) ||
|
|
54
|
+
Object.keys(value).length !== 2 ||
|
|
55
|
+
typeof value.id !== "string" ||
|
|
56
|
+
value.id.trim() === "" ||
|
|
57
|
+
typeof value.public_key !== "string" ||
|
|
58
|
+
!value.public_key.startsWith("-----BEGIN PUBLIC KEY-----"))
|
|
59
|
+
return null;
|
|
60
|
+
const key = createPublicKey(value.public_key);
|
|
61
|
+
return key.asymmetricKeyType === "ed25519" ? { id: value.id, key } : null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Load the independent adjudicator and attest issuer for this checkout.
|
|
65
|
+
* @param root - Real path of the checkout under evaluation
|
|
66
|
+
* @param named - Path selected by the operator through the process environment
|
|
67
|
+
* @returns The issuers and scope, or null if no trusted configuration is usable
|
|
68
|
+
*/
|
|
69
|
+
export async function loadHostProofTrust(root, named) {
|
|
70
|
+
if (named === undefined)
|
|
71
|
+
return null;
|
|
72
|
+
const text = await readExternalFile(root, named);
|
|
73
|
+
if (text === null)
|
|
74
|
+
return null;
|
|
75
|
+
try {
|
|
76
|
+
const value = JSON.parse(text);
|
|
77
|
+
if (!isJsonObject(value) ||
|
|
78
|
+
Object.keys(value).length !== 5 ||
|
|
79
|
+
value.schema_version !== 1 ||
|
|
80
|
+
typeof value.repository !== "string" ||
|
|
81
|
+
value.repository.trim() === "" ||
|
|
82
|
+
typeof value.environment !== "string" ||
|
|
83
|
+
value.environment.trim() === "")
|
|
84
|
+
return null;
|
|
85
|
+
const adjudicator = identity(value.adjudicator);
|
|
86
|
+
const attestor = identity(value.attestor);
|
|
87
|
+
if (adjudicator === null ||
|
|
88
|
+
attestor === null ||
|
|
89
|
+
adjudicator.key.equals(attestor.key))
|
|
90
|
+
return null;
|
|
91
|
+
return {
|
|
92
|
+
repository: value.repository,
|
|
93
|
+
environment: value.environment,
|
|
94
|
+
adjudicator,
|
|
95
|
+
attestor,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Load the protected private key for the attest process only.
|
|
104
|
+
* @param root - Real path of the checkout under evaluation
|
|
105
|
+
* @param named - Explicit private key path supplied to attest
|
|
106
|
+
* @param trust - The public attestor key pinned outside the checkout
|
|
107
|
+
* @returns The matching private key, or null when it cannot be used
|
|
108
|
+
*/
|
|
109
|
+
export async function loadHostProofSigningKey(root, named, trust) {
|
|
110
|
+
const text = await readExternalFile(root, named, true);
|
|
111
|
+
if (text === null)
|
|
112
|
+
return null;
|
|
113
|
+
try {
|
|
114
|
+
const key = createPrivateKey(text);
|
|
115
|
+
return key.asymmetricKeyType === "ed25519" &&
|
|
116
|
+
createPublicKey(key).equals(trust.attestor.key)
|
|
117
|
+
? key
|
|
118
|
+
: null;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=host-proof-trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-proof-trust.js","sourceRoot":"","sources":["../../src/controls/host-proof-trust.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAkB,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAElE,iEAAiE;AACjE,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAgBvC;;;;;;GAMG;AACH,KAAK,UAAU,gBAAgB,CAC7B,IAAY,EACZ,KAAa,EACb,WAAW,GAAG,KAAK;IAEnB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,QA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AQ,KAAK,IAAI;YACjB,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;YAEpC,OAAO,IAAI,CAAC;QACd,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,WAAW;YACX,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAY,EACZ,KAAa,EACb,KAAqB;IAErB,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,iBAAiB,KAAK,SAAS;YACxC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC/C,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GatesDeclaration } from "./gates-declaration.js";
|
|
1
|
+
import { type DeclaredGate, type GatesDeclaration } from "./gates-declaration.js";
|
|
2
2
|
import type { ControlRegister, ControlRegisterEntry, PullRequestExecutor } from "./register-types.js";
|
|
3
3
|
/** The one moment that has an executor, as the gate registry writes it. */
|
|
4
4
|
export declare const PULL_REQUEST_MOMENT = "pull-request";
|
|
@@ -6,6 +6,12 @@ export declare const PULL_REQUEST_MOMENT = "pull-request";
|
|
|
6
6
|
export declare const EXECUTOR_KEY = "executor";
|
|
7
7
|
/** The one platform Lisa ships the pull-request executor for. */
|
|
8
8
|
export declare const LISA_WRITTEN_PLATFORM = "github";
|
|
9
|
+
/**
|
|
10
|
+
* The executor one gate names for its pull-request moment.
|
|
11
|
+
* @param gate - The gate, from a validated declaration
|
|
12
|
+
* @returns The platform and the file, or `null` when the gate names none
|
|
13
|
+
*/
|
|
14
|
+
export declare function declaredExecutor(gate: DeclaredGate): PullRequestExecutor | null;
|
|
9
15
|
/**
|
|
10
16
|
* Tell whether an executor is one Lisa ships.
|
|
11
17
|
* @param executor - The executor
|
|
@@ -36,15 +42,21 @@ export declare function executorsAgree(context: {
|
|
|
36
42
|
* @returns The entries; one whose gate names no executor is returned as it is
|
|
37
43
|
*/
|
|
38
44
|
export declare function withDeclaredExecutors(entries: readonly ControlRegisterEntry[], declaration: GatesDeclaration): readonly ControlRegisterEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* The executor an entry's pull-request check runs from, when Lisa did not
|
|
47
|
+
* write it.
|
|
48
|
+
* @param entry - The entry
|
|
49
|
+
* @returns The executor, or `null` when there is none or Lisa wrote it
|
|
50
|
+
*/
|
|
51
|
+
export declare function unwrittenExecutor(entry: ControlRegisterEntry): PullRequestExecutor | null;
|
|
39
52
|
/**
|
|
40
53
|
* Mark every entry whose pull-request check runs from a file Lisa did not
|
|
41
|
-
* write as unproved
|
|
54
|
+
* write as unproved until the authorized receipt confirms the pair.
|
|
42
55
|
* @param entries - The entries, their executors already recorded
|
|
43
|
-
* @param
|
|
44
|
-
* when some entry's status depends on it
|
|
56
|
+
* @param confirmed - The entries whose exact proof receipts were verified
|
|
45
57
|
* @returns The entries, `status: "unproved"` added where it applies
|
|
46
58
|
*/
|
|
47
|
-
export declare function withProofStatus(entries: readonly ControlRegisterEntry[],
|
|
59
|
+
export declare function withProofStatus(entries: readonly ControlRegisterEntry[], confirmed?: ReadonlySet<string>): readonly ControlRegisterEntry[];
|
|
48
60
|
/**
|
|
49
61
|
* Say which entries of a register read unproved and why, for the operator.
|
|
50
62
|
* @param register - The register
|
|
@@ -52,5 +64,5 @@ export declare function withProofStatus(entries: readonly ControlRegisterEntry[]
|
|
|
52
64
|
*/
|
|
53
65
|
export declare function unprovedNote(register: ControlRegister): string | null;
|
|
54
66
|
/** What a drift report adds when an entry's status is what differs. */
|
|
55
|
-
export declare const STATUS_DRIFT_NOTE = "The status
|
|
67
|
+
export declare const STATUS_DRIFT_NOTE = "The status depends on a trusted, current attest receipt for the proof records in .lisa/controls/evidence.json.";
|
|
56
68
|
//# sourceMappingURL=pull-request-executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-request-executor.d.ts","sourceRoot":"","sources":["../../src/controls/pull-request-executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pull-request-executor.d.ts","sourceRoot":"","sources":["../../src/controls/pull-request-executor.ts"],"names":[],"mappings":"AAkCA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAiC9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,YAAY,GACjB,mBAAmB,GAAG,IAAI,CAO5B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAKtE;AA2FD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;CACxC,GAAG,SAAS,MAAM,EAAE,CAgBpB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,WAAW,EAAE,gBAAgB,GAC5B,SAAS,oBAAoB,EAAE,CAcjC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,oBAAoB,GAC1B,mBAAmB,GAAG,IAAI,CAK5B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,SAAS,oBAAoB,EAAE,CAQjC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAWrE;AAED,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,mHAAuG,CAAC"}
|
|
@@ -23,21 +23,16 @@
|
|
|
23
23
|
* ## Why the register may depend on the evidence file
|
|
24
24
|
*
|
|
25
25
|
* The register is compared byte for byte with what generating it again would
|
|
26
|
-
* write.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* again. The clock is never read, so the file cannot go out of date on its
|
|
31
|
-
* own. The evidence file is read only when some entry's status depends on it;
|
|
32
|
-
* a declaration that names no such executor produces the register it always
|
|
33
|
-
* did, from the declaration alone.
|
|
26
|
+
* write. The status can clear when the authorized attest receipt binds both
|
|
27
|
+
* current halves to the live check definition. Hosted evidence can expire
|
|
28
|
+
* after the register was written. A declaration without host-authored
|
|
29
|
+
* executors still produces the register from the declaration alone.
|
|
34
30
|
* @module controls/pull-request-executor
|
|
35
31
|
*/
|
|
36
32
|
import { isJsonObject } from "../sync/json-path.js";
|
|
37
33
|
import { compareCodeUnits } from "./canonical-json.js";
|
|
38
34
|
import { EVIDENCE_PATH } from "./evidence.js";
|
|
39
35
|
import { GATES_DECLARATION_PATH, } from "./gates-declaration.js";
|
|
40
|
-
import { hasBothProofHalves, parseProofHalfRecords } from "./proof-halves.js";
|
|
41
36
|
/** The one moment that has an executor, as the gate registry writes it. */
|
|
42
37
|
export const PULL_REQUEST_MOMENT = "pull-request";
|
|
43
38
|
/** The key of a pull-request entry that names the executor. */
|
|
@@ -64,7 +59,7 @@ function pullRequestEntry(gate) {
|
|
|
64
59
|
* @param gate - The gate, from a validated declaration
|
|
65
60
|
* @returns The platform and the file, or `null` when the gate names none
|
|
66
61
|
*/
|
|
67
|
-
function declaredExecutor(gate) {
|
|
62
|
+
export function declaredExecutor(gate) {
|
|
68
63
|
const executor = pullRequestEntry(gate)?.[EXECUTOR_KEY];
|
|
69
64
|
if (!isJsonObject(executor))
|
|
70
65
|
return null;
|
|
@@ -211,26 +206,26 @@ export function withDeclaredExecutors(entries, declaration) {
|
|
|
211
206
|
* @param entry - The entry
|
|
212
207
|
* @returns The executor, or `null` when there is none or Lisa wrote it
|
|
213
208
|
*/
|
|
214
|
-
function unwrittenExecutor(entry) {
|
|
209
|
+
export function unwrittenExecutor(entry) {
|
|
215
210
|
const executor = entry.enforcement_points.find(point => point.moment === PULL_REQUEST_MOMENT)?.executor;
|
|
216
211
|
return executor === undefined || isWrittenByLisa(executor) ? null : executor;
|
|
217
212
|
}
|
|
218
213
|
/**
|
|
219
214
|
* Mark every entry whose pull-request check runs from a file Lisa did not
|
|
220
|
-
* write as unproved
|
|
215
|
+
* write as unproved until the authorized receipt confirms the pair.
|
|
221
216
|
* @param entries - The entries, their executors already recorded
|
|
222
|
-
* @param
|
|
223
|
-
* when some entry's status depends on it
|
|
217
|
+
* @param confirmed - The entries whose exact proof receipts were verified
|
|
224
218
|
* @returns The entries, `status: "unproved"` added where it applies
|
|
225
219
|
*/
|
|
226
|
-
export function withProofStatus(entries,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
220
|
+
export function withProofStatus(entries, confirmed) {
|
|
221
|
+
return entries.map(entry => {
|
|
222
|
+
if (unwrittenExecutor(entry) === null)
|
|
223
|
+
return entry;
|
|
224
|
+
if (confirmed?.has(entry.id) !== true)
|
|
225
|
+
return { ...entry, status: "unproved" };
|
|
226
|
+
const { status: _status, ...proved } = entry;
|
|
227
|
+
return proved;
|
|
228
|
+
});
|
|
234
229
|
}
|
|
235
230
|
/**
|
|
236
231
|
* Say which entries of a register read unproved and why, for the operator.
|
|
@@ -246,8 +241,8 @@ export function unprovedNote(register) {
|
|
|
246
241
|
return null;
|
|
247
242
|
const one = unproved.length === 1;
|
|
248
243
|
const ids = unproved.map(entry => entry.id).join(", ");
|
|
249
|
-
return `${unproved.length} ${one ? "entry reads" : "entries read"} unproved: ${ids}. The ${PULL_REQUEST_MOMENT} check for ${one ? "it" : "them"} runs from ${located(executor)}, a file Lisa did not write
|
|
244
|
+
return `${unproved.length} ${one ? "entry reads" : "entries read"} unproved: ${ids}. The ${PULL_REQUEST_MOMENT} check for ${one ? "it" : "them"} runs from ${located(executor)}, a file Lisa did not write. Authenticating both halves of ${one ? "its" : "their"} proof in ${EVIDENCE_PATH} requires a trusted, current receipt. ${one ? "It stays" : "They stay"} unproved until the attest step records that both held.`;
|
|
250
245
|
}
|
|
251
246
|
/** What a drift report adds when an entry's status is what differs. */
|
|
252
|
-
export const STATUS_DRIFT_NOTE = `The status
|
|
247
|
+
export const STATUS_DRIFT_NOTE = `The status depends on a trusted, current attest receipt for the proof records in ${EVIDENCE_PATH}.`;
|
|
253
248
|
//# sourceMappingURL=pull-request-executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-request-executor.js","sourceRoot":"","sources":["../../src/controls/pull-request-executor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pull-request-executor.js","sourceRoot":"","sources":["../../src/controls/pull-request-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO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ParameterDirection = (typeof PARAMETER_DIRECTIONS)[number];
|
|
|
53
53
|
/**
|
|
54
54
|
* What the register says about an entry beyond what the declaration states.
|
|
55
55
|
*
|
|
56
|
-
* `unproved`: the entry's pull-request check
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* that the rule was proved; that is the verdict's to say.
|
|
56
|
+
* `unproved`: the entry's host-authored pull-request check needs a signed,
|
|
57
|
+
* current attest receipt for both halves. The verdict reports the standing
|
|
58
|
+
* of every other entry.
|
|
60
59
|
*/
|
|
61
60
|
export declare const CONTROL_ENTRY_STATUSES: readonly ["unproved"];
|
|
62
61
|
/** The status of an entry that has one. */
|