Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Rename the project to Akashi. The repository moved to `Lucid-Computing/akashi`. The CLI is now `akashi`, the wheel `akashi-verify`, the environment prefix `AKASHI_`, and the service units and paths `akashi*`. Protocol domains, the `x-akashi-receipt` header, `/.well-known/akashi.json` and the `akashi-pickup/1` envelope replace their `vig` forms. Receipts, pickups and verdicts made under the old domains no longer verify, and the reference vectors were regenerated. [Data model](docs/spec/03-data-model.md)
- Document the recorded Maverick request and both offline CLI verdicts with exact measurement boundaries and machine-readable evidence. [Recorded demo](docs/demo/README.md)
- Give contributors a CPU quickstart and issue forms that direct vulnerability reports to the private security channel. [Quickstart](README.md#try-it) · [Security reporting](SECURITY.md)
- The independent log monitor treats a public log response nested too deeply to decode as malformed. It keeps running and raises the coverage alert for overdue promises instead of stopping without one. [Independent monitor](log/README.md#independent-monitor)

## 0.0.0 development candidate

Expand Down
2 changes: 2 additions & 0 deletions log/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ def unique(items: list[tuple[str, object]]) -> dict[str, object]:
return json.loads(data.decode("utf-8"), object_pairs_hook=unique)
except HTTPException:
raise OSError("Log read unavailable") from None
except RecursionError:
raise ValueError("Public log response nests too deeply") from None
49 changes: 49 additions & 0 deletions tests/test_log_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,52 @@ def test_pinned_https_reader_observes_actual_log(self) -> None:
finally:
http.shutdown()
thread.join()

@unittest.skipUnless(shutil.which("openssl"), "requires OpenSSL for test-only TLS")
def test_deeply_nested_log_response_is_malformed_and_raises_a_coverage_alert(
self,
) -> None:
make_certificates(self.root, cast(str, shutil.which("openssl")))
tls = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
tls.load_cert_chain(self.root / "proxy.pem", self.root / "proxy.key")
nested = b"[" * 65536 # nests too deeply for json on Python 3.10 to 3.14

def hostile(env: dict[str, Any], start_response: Any) -> list[bytes]:
start_response("200 OK", [("Content-Type", "application/json")])
return [nested]

with make_server(
"127.0.0.1", 0, cast(Any, hostile), handler_class=Quiet
) as http:
http.socket = tls.wrap_socket(http.socket, server_side=True)
thread = threading.Thread(
target=http.serve_forever, kwargs={"poll_interval": 0.02}, daemon=True
)
thread.start()
try:
read = LogReader(
f"https://127.0.0.1:{http.server_port}/log/v1/",
timeout=2,
max_response_bytes=65536,
context=ssl.create_default_context(
cafile=str(self.root / "ca.pem")
),
)
with self.assertRaisesRegex(ValueError, "nests too deeply"):
read("sth")
self.monitor.hold(self.issue(self.log))
self.now += timedelta(seconds=11)
stop = threading.Event()
alerts: list[dict[str, Any]] = []

def emit(report: dict[str, Any]) -> None:
alerts.append(report)
stop.set()

self.monitor.run(read, stop, interval=0.01, emit=emit)
self.assertEqual(
[a["kind"] for a in alerts], ["observation_unavailable"]
)
finally:
http.shutdown()
thread.join()