#!/usr/bin/env python3 """Local demonstration of response-length inference without solving a puzzle. Uses the existing real-binary dev fixture, with synthetic content only. The fixture retains every artifact and terminates only processes it starts. Run with the project's test dependencies and built debug host/enclave binaries. """ import importlib.util import json from pathlib import Path ROOT = Path(__file__).resolve().parents[1] spec = importlib.util.spec_from_file_location("objective_fixture", ROOT / "tests/test_v2_e2e.py") fixture = importlib.util.module_from_spec(spec) spec.loader.exec_module(fixture) def main(): runtime = fixture.Runtime.__new__(fixture.Runtime) try: runtime.__init__() runtime.ready() candidates = [b"A" * 32, b"B" * 1024] selected = [0] def respond(handler): body = candidates[selected[0]] handler.send_response(200) handler.send_header("Content-Length", str(len(body))) handler.end_headers() handler.wfile.write(body) runtime.upstream.RequestHandlerClass.do_GET = respond observations = [] for choice in (0, 1, 0, 1): selected[0] = choice response = runtime.relay.get("https://fixture.example/same-request") assert response.status_code == 200 assert response.content == candidates[choice] # Read the public ciphertext envelope as the host can. No key is # obtained and no solver/decryptor is invoked anywhere in this check. name = dict(response.headers)["x-attested-relay-record"] envelope = json.loads((runtime.records / name).read_bytes()) observations.append({ "candidate": choice, "body_bytes": len(candidates[choice]), "ciphertext_bytes": len(bytes.fromhex(envelope["ciphertext"])), "record": name, }) lengths = {i: {o["ciphertext_bytes"] for o in observations if o["candidate"] == i} for i in (0, 1)} assert lengths[0].isdisjoint(lengths[1]) result = { "passed": True, "claim": "Known response candidates can be distinguished by public ciphertext length before any puzzle is solved.", "limitations": "Synthetic local dev fixture; demonstrates length leakage, not key recovery or a Nitro-isolation break.", "solver_invoked": False, "observations": observations, "fixtures_retained_at": str(runtime.dir), } (runtime.dir / "objective-metadata-evidence.json").write_text(json.dumps(result, indent=2) + "\n") print(json.dumps(result, indent=2)) finally: runtime.close() if __name__ == "__main__": main()