secretvm-verify 0.1.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.
@@ -0,0 +1,62 @@
1
+ export type WorkloadStatus = "authentic_match" | "authentic_mismatch" | "not_authentic";
2
+ export interface WorkloadResult {
3
+ status: WorkloadStatus;
4
+ /** Only set when status !== "not_authentic" */
5
+ template_name?: string;
6
+ vm_type?: string;
7
+ artifacts_ver?: string;
8
+ env?: string;
9
+ }
10
+ /**
11
+ * Given a TDX quote (hex string), look up the matching SecretVM version and
12
+ * template. Returns null when the quote is not from a known SecretVM.
13
+ */
14
+ export declare function resolveSecretVmVersion(quoteHex: string): {
15
+ template_name: string;
16
+ artifacts_ver: string;
17
+ } | null;
18
+ /**
19
+ * Given an AMD SEV-SNP attestation report (base64), look up the matching
20
+ * SecretVM registry entry. Returns null when not found.
21
+ */
22
+ export declare function resolveAmdSevVersion(quoteBase64: string): {
23
+ template_name: string;
24
+ vm_type: string;
25
+ artifacts_ver: string;
26
+ } | null;
27
+ /**
28
+ * Verify that a TDX quote (hex) was produced by a known SecretVM running the
29
+ * given docker-compose YAML.
30
+ *
31
+ * Steps:
32
+ * 1. Parse mrtd + rtmr0..3 from the quote.
33
+ * 2. Find all registry rows matching mrtd+rtmr0..2.
34
+ * 3. If none → not_authentic.
35
+ * 4. For each candidate row: calculate expected RTMR3 from the compose YAML
36
+ * and the row's rootfs_data, then compare to the quote's rtmr3.
37
+ * 5. If any row matches → authentic_match.
38
+ * 6. Otherwise → authentic_mismatch.
39
+ */
40
+ export declare function verifyTdxWorkload(quoteHex: string, dockerComposeYaml: string): WorkloadResult;
41
+ export declare function formatWorkloadResult(r: WorkloadResult): string;
42
+ /**
43
+ * Verify an AMD SEV-SNP workload against a docker-compose.yaml.
44
+ *
45
+ * Recomputes the SEV-SNP GCTX launch digest from the registry entry matching
46
+ * the quote's `family_id` / `image_id` and the provided compose content, then
47
+ * compares it against the measurement in the report.
48
+ *
49
+ * @param quoteBase64 Base64-encoded AMD SEV-SNP attestation report.
50
+ * @param dockerComposeYaml Contents of the docker-compose.yaml file.
51
+ */
52
+ export declare function verifySevWorkload(quoteBase64: string, dockerComposeYaml: string): WorkloadResult;
53
+ /**
54
+ * Verify that a CPU quote was produced by a known SecretVM running the given
55
+ * docker-compose YAML. Automatically detects whether the quote is an Intel
56
+ * TDX (hex) or AMD SEV-SNP (base64) quote and delegates to the appropriate
57
+ * lower-level function.
58
+ *
59
+ * @param quoteData Hex-encoded TDX quote **or** base64-encoded SEV-SNP report.
60
+ * @param dockerComposeYaml Contents of the docker-compose.yaml file.
61
+ */
62
+ export declare function verifyWorkload(quoteData: string, dockerComposeYaml: string): WorkloadResult;
@@ -0,0 +1,253 @@
1
+ import { parseTdxQuoteFields } from "./tdx.js";
2
+ import { detectCpuQuoteType } from "./cpu.js";
3
+ import { findMatchingArtifacts, pickNewestVersion, loadSevRegistry, } from "./artifacts.js";
4
+ import { calculateRtmr3 } from "./rtmr.js";
5
+ import { calcSevMeasurement, parseSevFamilyId } from "./sevGctx.js";
6
+ import { createHash } from "node:crypto";
7
+ // ---------------------------------------------------------------------------
8
+ // Version resolution (no workload check)
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * Given a TDX quote (hex string), look up the matching SecretVM version and
12
+ * template. Returns null when the quote is not from a known SecretVM.
13
+ */
14
+ export function resolveSecretVmVersion(quoteHex) {
15
+ const { mrtd, rtmr0, rtmr1, rtmr2 } = parseTdxQuoteFields(quoteHex);
16
+ const matches = findMatchingArtifacts(mrtd, rtmr0, rtmr1, rtmr2);
17
+ const newest = pickNewestVersion(matches);
18
+ if (!newest)
19
+ return null;
20
+ return {
21
+ template_name: newest.template_name,
22
+ artifacts_ver: newest.artifacts_ver,
23
+ };
24
+ }
25
+ /**
26
+ * Given an AMD SEV-SNP attestation report (base64), look up the matching
27
+ * SecretVM registry entry. Returns null when not found.
28
+ */
29
+ export function resolveAmdSevVersion(quoteBase64) {
30
+ let raw;
31
+ try {
32
+ raw = Buffer.from(quoteBase64.trim(), "base64");
33
+ }
34
+ catch {
35
+ return null;
36
+ }
37
+ if (raw.length < 0x030)
38
+ return null;
39
+ const family = parseSevFamilyId(raw.subarray(0x010, 0x020));
40
+ if (!family)
41
+ return null;
42
+ const imageId = raw.subarray(0x020, 0x030).toString("utf8").replace(/[\x00#]+$/, "");
43
+ if (!imageId)
44
+ return null;
45
+ let registry;
46
+ try {
47
+ registry = loadSevRegistry();
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ const entry = registry.find((e) => e.vm_type === family.vmType && e.artifacts_ver === imageId);
53
+ if (!entry)
54
+ return null;
55
+ return {
56
+ template_name: family.templateName,
57
+ vm_type: family.vmType,
58
+ artifacts_ver: imageId,
59
+ };
60
+ }
61
+ // ---------------------------------------------------------------------------
62
+ // Workload verification
63
+ // ---------------------------------------------------------------------------
64
+ /**
65
+ * Verify that a TDX quote (hex) was produced by a known SecretVM running the
66
+ * given docker-compose YAML.
67
+ *
68
+ * Steps:
69
+ * 1. Parse mrtd + rtmr0..3 from the quote.
70
+ * 2. Find all registry rows matching mrtd+rtmr0..2.
71
+ * 3. If none → not_authentic.
72
+ * 4. For each candidate row: calculate expected RTMR3 from the compose YAML
73
+ * and the row's rootfs_data, then compare to the quote's rtmr3.
74
+ * 5. If any row matches → authentic_match.
75
+ * 6. Otherwise → authentic_mismatch.
76
+ */
77
+ export function verifyTdxWorkload(quoteHex, dockerComposeYaml) {
78
+ let mrtd, rtmr0, rtmr1, rtmr2, quoteRtmr3;
79
+ try {
80
+ const fields = parseTdxQuoteFields(quoteHex);
81
+ mrtd = fields.mrtd;
82
+ rtmr0 = fields.rtmr0;
83
+ rtmr1 = fields.rtmr1;
84
+ rtmr2 = fields.rtmr2;
85
+ quoteRtmr3 = fields.rtmr3;
86
+ }
87
+ catch {
88
+ return { status: "not_authentic" };
89
+ }
90
+ const candidates = findMatchingArtifacts(mrtd, rtmr0, rtmr1, rtmr2);
91
+ if (candidates.length === 0) {
92
+ return { status: "not_authentic" };
93
+ }
94
+ // Pick "best" entry for reporting (newest version)
95
+ const best = pickNewestVersion(candidates);
96
+ const template_name = best.template_name;
97
+ // vm_type column in CSV stores the environment (prod/dev)
98
+ const env = best.vm_type;
99
+ const artifacts_ver = best.artifacts_ver;
100
+ // Check compose against every candidate entry (different rootfs_data or envs)
101
+ for (const entry of candidates) {
102
+ const expected = calculateRtmr3(dockerComposeYaml, entry.rootfs_data);
103
+ if (expected === quoteRtmr3) {
104
+ return {
105
+ status: "authentic_match",
106
+ template_name: entry.template_name,
107
+ vm_type: entry.vm_type,
108
+ artifacts_ver: entry.artifacts_ver,
109
+ env: entry.vm_type,
110
+ };
111
+ }
112
+ }
113
+ return {
114
+ status: "authentic_mismatch",
115
+ template_name,
116
+ vm_type: best.vm_type,
117
+ artifacts_ver,
118
+ env,
119
+ };
120
+ }
121
+ // ---------------------------------------------------------------------------
122
+ // Human-readable output
123
+ // ---------------------------------------------------------------------------
124
+ export function formatWorkloadResult(r) {
125
+ if (r.status === "not_authentic") {
126
+ return "🚫 Attestation doesn't belong to an authentic SecretVM";
127
+ }
128
+ const vmLine = `✅ Confirmed an authentic SecretVM, vm_type ${r.template_name}, artifacts ${r.artifacts_ver}, environment ${r.env}`;
129
+ if (r.status === "authentic_match") {
130
+ return (vmLine +
131
+ "\n✅ Confirmed that the VM is running the specified docker-compose.yaml");
132
+ }
133
+ // authentic_mismatch
134
+ return (vmLine +
135
+ "\n🚫 Attestation does not match the specified docker-compose.yaml");
136
+ }
137
+ // ---------------------------------------------------------------------------
138
+ // SEV-SNP workload verification
139
+ // ---------------------------------------------------------------------------
140
+ /**
141
+ * Verify an AMD SEV-SNP workload against a docker-compose.yaml.
142
+ *
143
+ * Recomputes the SEV-SNP GCTX launch digest from the registry entry matching
144
+ * the quote's `family_id` / `image_id` and the provided compose content, then
145
+ * compares it against the measurement in the report.
146
+ *
147
+ * @param quoteBase64 Base64-encoded AMD SEV-SNP attestation report.
148
+ * @param dockerComposeYaml Contents of the docker-compose.yaml file.
149
+ */
150
+ export function verifySevWorkload(quoteBase64, dockerComposeYaml) {
151
+ let raw;
152
+ try {
153
+ raw = Buffer.from(quoteBase64.trim(), "base64");
154
+ }
155
+ catch {
156
+ return { status: "not_authentic" };
157
+ }
158
+ if (raw.length < 0x090 + 48)
159
+ return { status: "not_authentic" };
160
+ let quoteMeasurement;
161
+ let family;
162
+ let imageId;
163
+ try {
164
+ quoteMeasurement = raw.subarray(0x090, 0x090 + 48).toString("hex");
165
+ family = parseSevFamilyId(raw.subarray(0x010, 0x020));
166
+ if (!family)
167
+ return { status: "not_authentic" };
168
+ imageId = raw.subarray(0x020, 0x030).toString("utf8").replace(/[\x00#]+$/, "");
169
+ }
170
+ catch {
171
+ return { status: "not_authentic" };
172
+ }
173
+ let registry;
174
+ try {
175
+ registry = loadSevRegistry();
176
+ }
177
+ catch {
178
+ return { status: "not_authentic" };
179
+ }
180
+ const { vmType, templateName, vcpus } = family;
181
+ // raw SHA256 — matches jeeves compute_file_hash() (no YAML normalization)
182
+ const composeHash = createHash("sha256").update(dockerComposeYaml, "utf8").digest("hex");
183
+ const candidates = registry.filter((e) => e.vm_type === vmType);
184
+ const versionEntries = imageId ? candidates.filter((e) => e.artifacts_ver === imageId) : [];
185
+ function tryEntry(entry) {
186
+ const cmdline = `console=ttyS0 loglevel=7 docker_compose_hash=${composeHash} rootfs_hash=${entry.rootfs_hash}`;
187
+ try {
188
+ return calcSevMeasurement(entry, vcpus, cmdline) === quoteMeasurement;
189
+ }
190
+ catch {
191
+ return false;
192
+ }
193
+ }
194
+ // Try version-specific entries first
195
+ for (const entry of versionEntries) {
196
+ if (tryEntry(entry)) {
197
+ return {
198
+ status: "authentic_match",
199
+ template_name: templateName,
200
+ vm_type: templateName,
201
+ artifacts_ver: entry.artifacts_ver,
202
+ env: vmType,
203
+ };
204
+ }
205
+ }
206
+ // Fallback: other entries for this vm_type
207
+ for (const entry of candidates) {
208
+ if (imageId && entry.artifacts_ver === imageId)
209
+ continue; // already tried above
210
+ if (tryEntry(entry)) {
211
+ return {
212
+ status: "authentic_match",
213
+ template_name: templateName,
214
+ vm_type: templateName,
215
+ artifacts_ver: entry.artifacts_ver,
216
+ env: vmType,
217
+ };
218
+ }
219
+ }
220
+ // No compose match. If the version is in the registry the VM is authentic
221
+ // but the provided compose doesn't match the measurement.
222
+ if (versionEntries.length > 0) {
223
+ return {
224
+ status: "authentic_mismatch",
225
+ template_name: templateName,
226
+ vm_type: templateName,
227
+ artifacts_ver: imageId,
228
+ env: vmType,
229
+ };
230
+ }
231
+ return { status: "not_authentic" };
232
+ }
233
+ // ---------------------------------------------------------------------------
234
+ // Generic workload verifier (auto-detects TDX vs SEV-SNP)
235
+ // ---------------------------------------------------------------------------
236
+ /**
237
+ * Verify that a CPU quote was produced by a known SecretVM running the given
238
+ * docker-compose YAML. Automatically detects whether the quote is an Intel
239
+ * TDX (hex) or AMD SEV-SNP (base64) quote and delegates to the appropriate
240
+ * lower-level function.
241
+ *
242
+ * @param quoteData Hex-encoded TDX quote **or** base64-encoded SEV-SNP report.
243
+ * @param dockerComposeYaml Contents of the docker-compose.yaml file.
244
+ */
245
+ export function verifyWorkload(quoteData, dockerComposeYaml) {
246
+ const type = detectCpuQuoteType(quoteData);
247
+ if (type === "TDX")
248
+ return verifyTdxWorkload(quoteData, dockerComposeYaml);
249
+ if (type === "SEV-SNP")
250
+ return verifySevWorkload(quoteData, dockerComposeYaml);
251
+ return { status: "not_authentic" };
252
+ }
253
+ //# sourceMappingURL=workload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload.js","sourceRoot":"","sources":["../src/workload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACH,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,GAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE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;IACL,CAAC;IAED,2CAA2C;IAC3C,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,OAAO,IAAI,KAAK,CAAC,aAAa,KAAK,OAAO;YAAE,SAAS,CAAC,sBAAsB;QAChF,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAClB,OAAO;gBACH,MAAM,EAAE,iBAAiB;gBACzB,aAAa,EAAE,YAAY;gBAC3B,OAAO,EAAE,YAAY;gBACrB,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,GAAG,EAAE,MAAM;aACd,CAAC;QACN,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,0DAA0D;IAC1D,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO;YACH,MAAM,EAAE,oBAAoB;YAC5B,aAAa,EAAE,YAAY;YAC3B,OAAO,EAAE,YAAY;YACrB,aAAa,EAAE,OAAO;YACtB,GAAG,EAAE,MAAM;SACd,CAAC;IACN,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACvC,CAAC;AAED,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC1B,SAAiB,EACjB,iBAAyB;IAEzB,MAAM,IAAI,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC3E,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC/E,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACvC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "secretvm-verify",
3
+ "version": "0.1.0",
4
+ "description": "Attestation verification for Intel TDX, AMD SEV-SNP, and NVIDIA GPU",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "bin": {
15
+ "secretvm-verify": "dist/cli.js"
16
+ },
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "test": "node --test dist/**/*.test.js",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "attestation",
24
+ "tdx",
25
+ "sev-snp",
26
+ "nvidia",
27
+ "confidential-computing",
28
+ "tee"
29
+ ],
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "ethers": "^6.16.0",
33
+ "yaml": "^2.4.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^20.11.0",
37
+ "typescript": "^5.3.0"
38
+ }
39
+ }