voltagegpu-cli 2.0.2__tar.gz → 2.0.3__tar.gz

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 (32) hide show
  1. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/PKG-INFO +14 -6
  2. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/README.md +12 -4
  3. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/pyproject.toml +2 -2
  4. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/__init__.py +1 -1
  5. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/cmd_misc.py +6 -3
  6. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/vgpu.py +24 -9
  7. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/mcp/server.py +8 -1
  8. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/attest.py +26 -5
  9. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/.gitignore +0 -0
  10. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/LICENSE +0 -0
  11. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/__main__.py +0 -0
  12. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/__init__.py +0 -0
  13. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/cmd_account.py +0 -0
  14. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/cmd_deploy.py +0 -0
  15. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/cmd_machines.py +0 -0
  16. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/cmd_pods.py +0 -0
  17. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/main.py +0 -0
  18. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/output.py +0 -0
  19. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/cli/state.py +0 -0
  20. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/mcp/__init__.py +0 -0
  21. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/__init__.py +0 -0
  22. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/catalog.py +0 -0
  23. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/client.py +0 -0
  24. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/config.py +0 -0
  25. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/errors.py +0 -0
  26. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/fleet.py +0 -0
  27. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/models.py +0 -0
  28. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/remote.py +0 -0
  29. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/scripts/snp-proof-in-the-vm.sh +0 -0
  30. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/scripts/two-proofs-in-the-vm.sh +0 -0
  31. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/ssh.py +0 -0
  32. {voltagegpu_cli-2.0.2 → voltagegpu_cli-2.0.3}/volt/sdk/ttl.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: voltagegpu-cli
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: VoltageGPU CLI and Python SDK: Confidential VMs (Intel TDX), Confidential CPU (AMD SEV-SNP), standard GPU pods, dedicated machines and sandboxes, with the vgpu command for scripts and AI agents.
5
5
  Project-URL: Homepage, https://voltagegpu.com
6
6
  Project-URL: Documentation, https://docs.voltagegpu.com/cli
@@ -59,7 +59,7 @@ Requires-Dist: pytest>=8; extra == 'dev'
59
59
  Requires-Dist: ruff>=0.6; extra == 'dev'
60
60
  Requires-Dist: twine>=5; extra == 'dev'
61
61
  Provides-Extra: verify
62
- Requires-Dist: voltage-verify>=0.2.3; extra == 'verify'
62
+ Requires-Dist: voltage-verify>=0.3.0; extra == 'verify'
63
63
  Description-Content-Type: text/markdown
64
64
 
65
65
  # voltagegpu-cli
@@ -155,13 +155,17 @@ commands). On your own machine:
155
155
 
156
156
  ```bash
157
157
  pip install "voltagegpu-cli[verify]" # installs voltage-verify
158
- voltagegpu verify bundle.json --offline
159
158
  voltagegpu verify bundle.json --challenge <hex-you-issued> --gpus 1
159
+ voltagegpu verify bundle.json --challenge <hex-you-issued> --offline --accept-offline-tcb
160
160
  ```
161
161
 
162
162
  `voltagegpu verify` runs [voltage-verify](https://pypi.org/project/voltage-verify/),
163
163
  which checks the Intel TDX quote up to Intel's root and the NVIDIA GPU
164
- attestation tokens, without trusting VoltageGPU.
164
+ attestation tokens, without trusting VoltageGPU. Online, the TCB status and
165
+ revocation are checked against Intel's collateral of today. `--offline` uses
166
+ the Intel collateral inside the bundle: the verdict names that limit and the
167
+ exit code is 3, unless `--accept-offline-tcb` (voltage-verify 0.3.0 or later).
168
+ `voltagegpu verify` returns voltage-verify's own exit code.
165
169
 
166
170
  ## Scripting
167
171
 
@@ -223,8 +227,11 @@ balance` show the balance as hidden: only a full key reads it.
223
227
  script in the machine (`two-proofs-in-the-vm.sh` for a Confidential VM,
224
228
  `snp-proof-in-the-vm.sh` for a Confidential CPU tier, both embedded and pinned
225
229
  by SHA-256), copies the archive back and verifies it here: `voltage-verify`
226
- for Intel TDX + NVIDIA (`pip install 'voltagegpu-cli[verify]'`, `--offline`
227
- for no network). For SEV-SNP: the report is requested at `--vmpl` (0 by
230
+ for Intel TDX + NVIDIA (`pip install 'voltagegpu-cli[verify]'`). `--offline`
231
+ verifies without network, with the Intel collateral inside the bundle: the TCB
232
+ and revocation are then not checked against Intel today, so the result stays
233
+ `VERIFIED` but names that limit (`limits` in `--json`) and exits with 10,
234
+ unless `--accept-offline-tcb`. For SEV-SNP: the report is requested at `--vmpl` (0 by
228
235
  default, sent as `SNP_VMPL`; if VMPL 0 is refused, the script says so and asks
229
236
  again at 1, and the result reports it), REPORT_DATA equals the challenge, the
230
237
  report policy forbids debug and its VMPL field is the level requested (the
@@ -249,6 +256,7 @@ attestation and are refused.
249
256
  | 7 | unavailable: sold out, over `--max-price`, rate limited, offer closed |
250
257
  | 8 | attestation failed |
251
258
  | 9 | attestation incomplete, or a local tool is missing (ssh, scp, voltage-verify) |
259
+ | 10 | attestation verified with a limit: `--offline`, TCB and revocation not checked against Intel today (`--accept-offline-tcb` accepts it; local MCP server: `ATTESTATION_LIMITED`) |
252
260
 
253
261
  With `--json`, an error is also printed on stdout as
254
262
  `{"error": {"code", "message", "exit_code", ...}}`.
@@ -91,13 +91,17 @@ commands). On your own machine:
91
91
 
92
92
  ```bash
93
93
  pip install "voltagegpu-cli[verify]" # installs voltage-verify
94
- voltagegpu verify bundle.json --offline
95
94
  voltagegpu verify bundle.json --challenge <hex-you-issued> --gpus 1
95
+ voltagegpu verify bundle.json --challenge <hex-you-issued> --offline --accept-offline-tcb
96
96
  ```
97
97
 
98
98
  `voltagegpu verify` runs [voltage-verify](https://pypi.org/project/voltage-verify/),
99
99
  which checks the Intel TDX quote up to Intel's root and the NVIDIA GPU
100
- attestation tokens, without trusting VoltageGPU.
100
+ attestation tokens, without trusting VoltageGPU. Online, the TCB status and
101
+ revocation are checked against Intel's collateral of today. `--offline` uses
102
+ the Intel collateral inside the bundle: the verdict names that limit and the
103
+ exit code is 3, unless `--accept-offline-tcb` (voltage-verify 0.3.0 or later).
104
+ `voltagegpu verify` returns voltage-verify's own exit code.
101
105
 
102
106
  ## Scripting
103
107
 
@@ -159,8 +163,11 @@ balance` show the balance as hidden: only a full key reads it.
159
163
  script in the machine (`two-proofs-in-the-vm.sh` for a Confidential VM,
160
164
  `snp-proof-in-the-vm.sh` for a Confidential CPU tier, both embedded and pinned
161
165
  by SHA-256), copies the archive back and verifies it here: `voltage-verify`
162
- for Intel TDX + NVIDIA (`pip install 'voltagegpu-cli[verify]'`, `--offline`
163
- for no network). For SEV-SNP: the report is requested at `--vmpl` (0 by
166
+ for Intel TDX + NVIDIA (`pip install 'voltagegpu-cli[verify]'`). `--offline`
167
+ verifies without network, with the Intel collateral inside the bundle: the TCB
168
+ and revocation are then not checked against Intel today, so the result stays
169
+ `VERIFIED` but names that limit (`limits` in `--json`) and exits with 10,
170
+ unless `--accept-offline-tcb`. For SEV-SNP: the report is requested at `--vmpl` (0 by
164
171
  default, sent as `SNP_VMPL`; if VMPL 0 is refused, the script says so and asks
165
172
  again at 1, and the result reports it), REPORT_DATA equals the challenge, the
166
173
  report policy forbids debug and its VMPL field is the level requested (the
@@ -185,6 +192,7 @@ attestation and are refused.
185
192
  | 7 | unavailable: sold out, over `--max-price`, rate limited, offer closed |
186
193
  | 8 | attestation failed |
187
194
  | 9 | attestation incomplete, or a local tool is missing (ssh, scp, voltage-verify) |
195
+ | 10 | attestation verified with a limit: `--offline`, TCB and revocation not checked against Intel today (`--accept-offline-tcb` accepts it; local MCP server: `ATTESTATION_LIMITED`) |
188
196
 
189
197
  With `--json`, an error is also printed on stdout as
190
198
  `{"error": {"code", "message", "exit_code", ...}}`.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "voltagegpu-cli"
7
- version = "2.0.2"
7
+ version = "2.0.3"
8
8
  description = "VoltageGPU CLI and Python SDK: Confidential VMs (Intel TDX), Confidential CPU (AMD SEV-SNP), standard GPU pods, dedicated machines and sandboxes, with the vgpu command for scripts and AI agents."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -46,7 +46,7 @@ dependencies = [
46
46
  ]
47
47
 
48
48
  [project.optional-dependencies]
49
- verify = ["voltage-verify>=0.2.3"]
49
+ verify = ["voltage-verify>=0.3.0"]
50
50
  dev = ["pytest>=8", "pytest-cov>=5", "ruff>=0.6", "build>=1.2", "twine>=5"]
51
51
 
52
52
  [project.scripts]
@@ -1,5 +1,5 @@
1
1
  """VoltageGPU command-line interface and Python SDK."""
2
2
 
3
- __version__ = "2.0.2"
3
+ __version__ = "2.0.3"
4
4
 
5
5
  __all__ = ["__version__"]
@@ -15,7 +15,7 @@ VERIFY_SUBCOMMANDS = ("manifest", "attest", "verify", "quote", "inspect", "selft
15
15
 
16
16
 
17
17
  def verify_argv(args: Sequence[str]) -> List[str]:
18
- """`voltagegpu verify bundle.json --offline` -> voltage-verify's `verify bundle.json --offline`.
18
+ """`voltagegpu verify bundle.json --challenge HEX` -> voltage-verify's `verify bundle.json --challenge HEX`.
19
19
 
20
20
  Any voltage-verify subcommand (manifest, attest, quote, ...) passes through
21
21
  unchanged; with no argument, voltage-verify prints its own help.
@@ -44,15 +44,18 @@ def run_voltage_verify(argv: List[str]) -> int:
44
44
  @click.command("verify", context_settings={"ignore_unknown_options": True, "allow_extra_args": True, "help_option_names": []})
45
45
  @click.argument("args", nargs=-1, type=click.UNPROCESSED)
46
46
  def verify_cmd(args: Tuple[str, ...]) -> None:
47
- """Verify a Confidential VM attestation bundle offline (runs voltage-verify).
47
+ """Verify a Confidential VM attestation bundle (runs voltage-verify).
48
48
 
49
49
  \b
50
50
  Examples:
51
- voltagegpu verify bundle.json --offline
52
51
  voltagegpu verify bundle.json --challenge <hex> --gpus 1
52
+ voltagegpu verify bundle.json --challenge <hex> --offline --accept-offline-tcb
53
53
  voltagegpu verify quote quote.bin
54
54
  voltagegpu verify --help # voltage-verify's own help
55
55
  \b
56
+ Online, the TCB is checked against Intel's collateral of today. --offline uses the
57
+ collateral inside the bundle: exit code 3 (verified with that limit) unless
58
+ --accept-offline-tcb (voltage-verify 0.3.0 or later).
56
59
  Needs: pip install voltage-verify (or: pip install "voltagegpu-cli[verify]")
57
60
  """
58
61
  if importlib.util.find_spec("voltage_verify") is None:
@@ -48,6 +48,7 @@ EXIT_CODES = {
48
48
  7: "unavailable, sold out or over --max-price",
49
49
  8: "attestation failed",
50
50
  9: "attestation incomplete or local tool missing",
51
+ 10: "attestation verified with a limit (offline TCB)",
51
52
  }
52
53
 
53
54
  # Seams for the tests (no ssh binary, no waiting).
@@ -159,7 +160,8 @@ def vgpu(ctx: click.Context, base_url: Optional[str]) -> None:
159
160
  (budget or balance), and call a machine confidential only after `vgpu attest`
160
161
  returns VERIFIED. Exit codes: 0 ok, 1 error, 2 usage, 3 key, 4 scope,
161
162
  5 not found, 6 budget/balance (402), 7 unavailable, 8 attestation failed,
162
- 9 attestation incomplete or tool missing.
163
+ 9 attestation incomplete or tool missing, 10 attestation verified with a
164
+ limit (offline TCB).
163
165
  """
164
166
  state = ctx.ensure_object(AppState)
165
167
  state.base_url = base_url
@@ -332,10 +334,12 @@ def find_instance(client: Any, ref: str) -> Instance:
332
334
 
333
335
 
334
336
  def attest_machine(client: Any, ref: str, *, out: Optional[str], offline: bool, identity: Optional[str],
335
- vmpl: int = 0) -> Tuple[Dict[str, Any], int]:
336
- """The whole `vgpu attest` (CLI and local MCP server): result and exit code (0, 8 or 9).
337
+ vmpl: int = 0, accept_offline_tcb: bool = False) -> Tuple[Dict[str, Any], int]:
338
+ """The whole `vgpu attest` (CLI and local MCP server): result and exit code (0, 8, 9 or 10).
337
339
 
338
340
  ``vmpl``: Confidential CPU only, the VMPL level the SEV-SNP report is requested at (SNP_VMPL).
341
+ ``accept_offline_tcb``: Confidential VM with ``offline``, accept the limit voltage-verify 0.3.0 names
342
+ (TCB and revocation from the bundle's Intel collateral): 0 instead of 10.
339
343
  """
340
344
  inst = find_instance(client, ref)
341
345
  try:
@@ -366,7 +370,7 @@ def attest_machine(client: Any, ref: str, *, out: Optional[str], offline: bool,
366
370
  try:
367
371
  extracted = attest.extract_archive(archive, folder / "proof")
368
372
  if inst.kind == "vm":
369
- result = attest.verify_gpu(extracted, challenge, offline=offline)
373
+ result = attest.verify_gpu(extracted, challenge, offline=offline, accept_offline_tcb=accept_offline_tcb)
370
374
  else:
371
375
  result = attest.verify_cpu(extracted, challenge, snpguest=_tool("snpguest"), runner=_run, vmpl=vmpl)
372
376
  except attest.ToolMissing as exc:
@@ -374,22 +378,30 @@ def attest_machine(client: Any, ref: str, *, out: Optional[str], offline: bool,
374
378
  except attest.AttestError as exc:
375
379
  return _attest_failure(inst.kind, challenge, "archive", str(exc))
376
380
  data = {"name": inst.name, "id": inst.id, **result.to_dict(), "folder": str(folder)}
377
- return data, 0 if result.verified else 9 if result.status == "INCOMPLETE" else 8
381
+ if result.verified:
382
+ # A limit named by voltage-verify (offline TCB): 10, its own 3 (3 is the API key here).
383
+ return data, 10 if result.limits else 0
384
+ return data, 9 if result.status == "INCOMPLETE" else 8
378
385
 
379
386
 
380
387
  @vgpu.command("attest")
381
388
  @click.argument("ref")
382
- @click.option("--offline", is_flag=True, help="GPU: use the collateral inside the bundle, no network call.")
389
+ @click.option("--offline", is_flag=True,
390
+ help="GPU: verify with the Intel collateral inside the bundle, no network call. With voltage-verify 0.3.0 the TCB "
391
+ "is then not checked against Intel today: VERIFIED names that limit, exit 10.")
392
+ @click.option("--accept-offline-tcb", is_flag=True,
393
+ help="GPU, with --offline: accept that limit, exit 0 instead of 10 (voltage-verify 0.3.0 or later).")
383
394
  @click.option("--out", type=click.Path(file_okay=False), help="Folder for the archive and the report.")
384
395
  @click.option("-i", "--identity", help="Private key file (default: VGPU_SSH_KEY).")
385
396
  @click.option("--vmpl", type=click.IntRange(0, 3), default=0, show_default=True,
386
397
  help="Confidential CPU: VMPL level the SEV-SNP report is requested at (the script asks again at 1 if 0 is refused).")
387
398
  @click.option("--json", "as_json", is_flag=True)
388
399
  @click.pass_context
389
- def attest_cmd(ctx: click.Context, ref: str, offline: bool, out: Optional[str], identity: Optional[str], vmpl: int,
390
- as_json: bool) -> None:
400
+ def attest_cmd(ctx: click.Context, ref: str, offline: bool, accept_offline_tcb: bool, out: Optional[str], identity: Optional[str],
401
+ vmpl: int, as_json: bool) -> None:
391
402
  """Prove the machine is a genuine TEE: challenge drawn here, proofs made in the VM, checked here."""
392
- data, code = attest_machine(_state(ctx).client(), ref, out=out, offline=offline, identity=identity, vmpl=vmpl)
403
+ data, code = attest_machine(_state(ctx).client(), ref, out=out, offline=offline, identity=identity, vmpl=vmpl,
404
+ accept_offline_tcb=accept_offline_tcb)
393
405
  failed = data.get("failed") or []
394
406
  # 2.0.1: a VM verdict covers the NVIDIA GPU too; say so when its checks passed.
395
407
  gpu_checked = any(str(c.get("name", "")).startswith("nvidia.") and c.get("ok") for c in data.get("checks") or [])
@@ -399,6 +411,9 @@ def attest_cmd(ctx: click.Context, ref: str, offline: bool, out: Optional[str],
399
411
  human += f" ({data['detail']})"
400
412
  if (data.get("facts") or {}).get("vmpl_fallback"):
401
413
  human += " (VMPL 0 refused: the guest is not at VMPL 0; report requested at VMPL 1)"
414
+ limits = data.get("limits") or []
415
+ if data.get("verified") and limits: # 2.0.3: what voltage-verify 0.3.0 says an offline VERIFIED did not check
416
+ human += f" (limit: {'; '.join(limits)}; run without --offline, or pass --accept-offline-tcb)"
402
417
  _emit(as_json, data, human)
403
418
  raise click.exceptions.Exit(code)
404
419
 
@@ -79,7 +79,11 @@ TOOLS: List[Dict[str, Any]] = [
79
79
  {"name": "attest", "description": "Check that a Confidential VM (Intel TDX + NVIDIA) or Confidential CPU (AMD SEV-SNP) machine is genuine: "
80
80
  "challenge drawn on this computer, proofs generated in the machine, verified on this computer. Standard pods, dedicated "
81
81
  "machines and sandboxes have no tenant attestation.",
82
- "inputSchema": {"type": "object", "properties": {"name": {"type": "string"}, "offline": {"type": "boolean"}, "out": {"type": "string"}},
82
+ "inputSchema": {"type": "object", "properties": {
83
+ "name": {"type": "string"}, "out": {"type": "string"},
84
+ "offline": {"type": "boolean", "description": "verify with the Intel collateral inside the bundle, no network call; with "
85
+ "voltage-verify 0.3.0 the TCB is then not checked against Intel today and a "
86
+ "VERIFIED comes back as ATTESTATION_LIMITED"}},
83
87
  "required": ["name"], "additionalProperties": False}},
84
88
  {"name": "inference", "description": "Chat with a confidential model (ids ending in -TEE) on the OpenAI-compatible API, no GPU to rent. "
85
89
  "Needs an inference key (vgpu_...) in VOLTAGEGPU_API_KEY. list_models=true returns the model ids.",
@@ -274,6 +278,9 @@ class McpServer:
274
278
  def _attest(self, args: Mapping[str, Any]) -> Any:
275
279
  _required(args, "name")
276
280
  data, code = ops.attest_machine(self._client, str(args["name"]), out=args.get("out"), offline=bool(args.get("offline")), identity=None)
281
+ if code == 10: # VERIFIED with a limit named by voltage-verify 0.3.0 (offline TCB): said, not called a failure
282
+ raise ops.Fail(code, f"Attestation VERIFIED with a limit: {'; '.join(data.get('limits') or [])}. Attest online "
283
+ "(offline false) for a verdict without it.", "ATTESTATION_LIMITED", {"result": data})
277
284
  if code != 0:
278
285
  failed = ", ".join(data.get("failed") or [])
279
286
  raise ops.Fail(code, f"Attestation {data.get('status')}: {failed}. Do not call this machine confidential.",
@@ -4,7 +4,10 @@ The challenge is drawn HERE, on the user's machine, never in the VM: a VM that
4
4
  picked its own challenge could replay an old bundle. The archive is verified
5
5
  here too. ``verified`` is True only when every required check passed:
6
6
 
7
- vm (Intel TDX + NVIDIA GPU) ``voltage-verify`` on bundle.json, with the challenge we drew
7
+ vm (Intel TDX + NVIDIA GPU) ``voltage-verify`` on bundle.json, with the challenge we drew.
8
+ Offline, voltage-verify 0.3.0 also names what a VERIFIED did not check (TCB and
9
+ revocation from the bundle's Intel collateral), kept in ``limits`` unless
10
+ ``accept_offline_tcb``; the result stays VERIFIED. 0.2.x names no limit.
8
11
  cpu (AMD SEV-SNP) REPORT_DATA of report.bin equals our challenge, policy without
9
12
  debug, VMPL field equal to the level requested (SNP_VMPL, 0 by default; the
10
13
  script asks again at 1, saying so, when 0 is refused), and the AMD chain
@@ -21,6 +24,7 @@ from __future__ import annotations
21
24
 
22
25
  import base64
23
26
  import hashlib
27
+ import inspect
24
28
  import re
25
29
  import secrets
26
30
  import tarfile
@@ -61,6 +65,8 @@ class AttestResult:
61
65
  tee: str
62
66
  challenge: str
63
67
  failed: List[str] = field(default_factory=list)
68
+ # What a VERIFIED did not check, named by voltage-verify 0.3.0 (offline TCB); empty otherwise.
69
+ limits: List[str] = field(default_factory=list)
64
70
  checks: List[Dict[str, Any]] = field(default_factory=list)
65
71
  bundle_path: Optional[str] = None
66
72
  in_vm_chain_report: Optional[str] = None
@@ -163,8 +169,21 @@ def _result(tee: str, challenge: str, checks: List[Dict[str, Any]], **extra: Any
163
169
  challenge=challenge, failed=failed, checks=checks, **extra)
164
170
 
165
171
 
166
- def verify_gpu(folder: Path, challenge: str, *, offline: bool = False) -> AttestResult:
167
- """voltage-verify on bundle.json with OUR challenge (online: Intel PCS and NVIDIA keys are fetched)."""
172
+ def _known(fn: Callable[..., Any], **options: Any) -> Dict[str, Any]:
173
+ """The keyword options the installed voltage-verify takes; the others are left out (0.2.x has no accept_offline_tcb)."""
174
+ try:
175
+ params = inspect.signature(fn).parameters
176
+ except (TypeError, ValueError):
177
+ return {}
178
+ return {name: value for name, value in options.items() if name in params}
179
+
180
+
181
+ def verify_gpu(folder: Path, challenge: str, *, offline: bool = False, accept_offline_tcb: bool = False) -> AttestResult:
182
+ """voltage-verify on bundle.json with OUR challenge (online: Intel PCS and NVIDIA keys are fetched).
183
+
184
+ ``accept_offline_tcb``: offline, accept that the TCB and revocation come from the bundle's Intel
185
+ collateral (voltage-verify 0.3.0 then names no limit). Passed only to a version that knows it.
186
+ """
168
187
  try:
169
188
  from voltage_verify.bundle import Bundle, BundleError
170
189
  from voltage_verify.verify import verify_bundle
@@ -179,10 +198,12 @@ def verify_gpu(folder: Path, challenge: str, *, offline: bool = False) -> Attest
179
198
  except (BundleError, OSError, ValueError) as exc:
180
199
  checks.append({"name": "bundle.format", "ok": False, "detail": f"unreadable bundle ({type(exc).__name__})"})
181
200
  return _result(TEE["vm"], challenge, checks, bundle_path=str(bundle_path))
182
- report = verify_bundle(bundle, expected_challenge=challenge, online=not offline)
201
+ options = _known(verify_bundle, accept_offline_tcb=True) if accept_offline_tcb else {}
202
+ report = verify_bundle(bundle, expected_challenge=challenge, online=not offline, **options)
183
203
  checks += [{"name": c.name, "ok": c.ok, "detail": c.detail, "required": c.required} for c in report.checks]
184
204
  facts = {k: v for k, v in report.facts.items() if k in ("tdx", "nvidia", "commitment_sha256")}
185
- return _result(TEE["vm"], challenge, checks, bundle_path=str(bundle_path), facts=facts)
205
+ limits = [str(limit) for limit in getattr(report, "limits", None) or []] # Report.limits: 0.3.0 and later
206
+ return _result(TEE["vm"], challenge, checks, bundle_path=str(bundle_path), facts=facts, limits=limits)
186
207
 
187
208
 
188
209
  Runner = Callable[..., Any]
File without changes