mirror of
https://github.com/saymrwulf/proof-aware-crypto-tooling-agent.git
synced 2026-09-04 20:03:40 +00:00
154 lines
5.6 KiB
Text
154 lines
5.6 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Lecture 5: Third-Party Proof-Checking Attestations\n",
|
|
"\n",
|
|
"Local proof replay can be operationally cumbersome. A specialized provider can run the Lean/Aeneas environment in a controlled setup and publish a signed attestation. This transforms trust in local compilation into trust in a provider, its environment, its signing key custody, and its transparency log.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Learning Objectives\n",
|
|
"\n",
|
|
"- Explain the trust transformation from local replay to provider attestation.\n",
|
|
"- Read a provider attestation.\n",
|
|
"- Verify an Ed25519 attestation signature.\n",
|
|
"- Understand why untrusted attestations must score R0.\n",
|
|
"- Distinguish a provider signature from transparency-log accountability.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Attestation Contents\n",
|
|
"\n",
|
|
"A useful attestation records:\n",
|
|
"\n",
|
|
"- provider identity,\n",
|
|
"- issue time,\n",
|
|
"- subject component, repo URL, repo commit, verification dir, kind, backend,\n",
|
|
"- Lean and lake versions,\n",
|
|
"- check log and axiom log locations,\n",
|
|
"- certificate names, statuses, observed axioms, expected axioms,\n",
|
|
"- provider signature metadata.\n",
|
|
"\n",
|
|
"The agent must verify both content and trust policy. A valid signature from an untrusted provider is not enough.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from pathlib import Path\n",
|
|
"import sys\n",
|
|
"\n",
|
|
"repo_root = Path.cwd()\n",
|
|
"if not (repo_root / \"src\" / \"pacta\").exists():\n",
|
|
" repo_root = repo_root.parent\n",
|
|
"sys.path.insert(0, str(repo_root / \"src\"))\n",
|
|
"\n",
|
|
"from pacta.attestation import load_attestation\n",
|
|
"\n",
|
|
"attestation_path = repo_root / \"examples\" / \"dalek-ed25519.attestation.yaml\"\n",
|
|
"raw = load_attestation(attestation_path)\n",
|
|
"print(raw.keys())\n",
|
|
"print(raw[\"provider\"])\n",
|
|
"print(raw[\"subject\"])\n",
|
|
"print(raw[\"certificates\"][0])\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Trust Policy\n",
|
|
"\n",
|
|
"PACTA requires an explicit `--trust-attestation-provider` value. If the attestation provider does not match, the attestation is rejected.\n",
|
|
"\n",
|
|
"Real attestations should be signed. The included example fixture is unsigned and requires `--allow-unsigned-attestation`, which is suitable only for demos and tests.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from pacta.attestation import validate_attestation\n",
|
|
"from pacta.config import RepoConfig\n",
|
|
"\n",
|
|
"repo = RepoConfig(\n",
|
|
" name=\"dalek-ed25519-verified\",\n",
|
|
" url=\"https://github.com/saymrwulf/dalek-ed25519-verified.git\",\n",
|
|
" kind=\"ed25519\",\n",
|
|
" verified_backend=\"serial/u64\",\n",
|
|
" certificates=[\n",
|
|
" \"CurveFieldProofs.fieldImplementation\",\n",
|
|
" \"CurveFieldProofs.edwardsImplementation\",\n",
|
|
" ],\n",
|
|
")\n",
|
|
"\n",
|
|
"trusted = validate_attestation(\n",
|
|
" raw,\n",
|
|
" repo,\n",
|
|
" path=attestation_path,\n",
|
|
" trusted_provider=\"example-proof-checker.invalid\",\n",
|
|
" allow_unsigned=True,\n",
|
|
")\n",
|
|
"untrusted = validate_attestation(raw, repo, path=attestation_path)\n",
|
|
"print(\"trusted accepted:\", trusted.accepted)\n",
|
|
"print(\"untrusted accepted:\", untrusted.accepted)\n",
|
|
"print(\"untrusted diagnostics:\", untrusted.diagnostics)\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Provider Threat Model\n",
|
|
"\n",
|
|
"A proof-checking provider can be valuable, but it introduces new risks:\n",
|
|
"\n",
|
|
"- It may sign an incorrect result.\n",
|
|
"- Its environment may be stale or compromised.\n",
|
|
"- Its signing key may be stolen.\n",
|
|
"- It may equivocate by showing different results to different agents.\n",
|
|
"- It may lose log history.\n",
|
|
"\n",
|
|
"This is why transparency logging matters. A signature says \"this provider signed this.\" A transparency receipt says \"this signed result is included in an append-only public structure at this tree head.\"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Exercises\n",
|
|
"\n",
|
|
"- Draw the trusted base for local replay and provider attestation. Mark what changes.\n",
|
|
"- Explain why a provider attestation must include repo commit, not only repo name.\n",
|
|
"- Design a monitoring rule that would detect if the provider changes the result for the same commit.\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"name": "python",
|
|
"pygments_lexer": "ipython3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|