Skip to content

Commit 666216d

Browse files
Status honesty + real HMAC attestation; refuse fake asymmetric keys (#75)
## What & why Two related honesty problems flagged by the survey, threat model, and `STATE.a2ml`: dashboards that overstate status, and cryptography that isn't what its labels claim. ## Changes **B1 — status reconciliation (docs)** - `TOPOLOGY.md` advertised "OVERALL 100% v1.0 Production Ready" while `STATE.a2ml` records 60% / CRG grade **D** and `READINESS.md` grades it **D (Alpha, Unstable)**. Rewrote the completion dashboard to summarise the real state and name the actual caveats (homerolled MAC, label-only asymmetric crypto, obliteration not guaranteed on SSD/CoW, formal proofs pending). - Added an **ARCHIVED** banner to the stale `TESTING-REPORT.adoc` (2025-12-29) whose "all tests passed / robust" framing overstates status. **B3 — real attestation MAC (code)** - Replaced the homerolled `SHA256(key || data || previous_hash)` (not a MAC; banned by Trustfile `no-homerolled-hmac`) with a real **HMAC-SHA256** (`hmac` crate, RFC 2104) with a versioned domain separator. - `compute_attestation` now returns `Result` and **hard-errors** when no key is set, removing the `unwrap_or([0u8; 32])` all-zero-key fallback that silently produced forgeable attestations. Producer and verifier both propagate the error. **B4 — no fake asymmetric crypto (code)** - `SecretKey::generate()` only produces 32 random bytes and ignores the algorithm, so `ed25519`/`x25519` yielded a random blob merely *labelled* asymmetric. Generation of these types is now **refused** at the CLI with a clear "not implemented" error. Enum variants are retained (documented reserved/unimplemented) for backward-compatible deserialization. ## Verification - `cargo build -p januskey` — clean (pre-existing dead-code warnings only). - `cargo test -p januskey --lib` — **26 passed / 0 failed**; attestation E2E + P2P chain-integrity pass. - New regression tests: `test_attestation_refused_without_key`, `test_attestation_is_genuinely_keyed` (wrong key fails verification — proves the MAC is genuinely keyed, which a plain hash would not catch). - `STATE.a2ml` blockers updated (`homerolled-hmac` → RESOLVED). ## Context Tasks **B1/B3/B4** of a broader estate assessment. Draft pending human review. Note: on-disk audit logs written under the old homerolled scheme will not verify under the new versioned MAC (intentional, alpha-stage). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015qwVESTcbfanY2iJPQNoSz --- _Generated by [Claude Code](https://claude.ai/code/session_015qwVESTcbfanY2iJPQNoSz)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 468cbba commit 666216d

11 files changed

Lines changed: 202 additions & 54 deletions

File tree

.github/workflows/cargo-audit.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ jobs:
3838
runs-on: ubuntu-latest
3939
timeout-minutes: 15
4040
needs: audit
41-
if: failure()
41+
# Only file a tracking issue on push/schedule runs. On pull_request events
42+
# GITHUB_TOKEN is forced read-only, so `gh issue create` 403s; guarding here
43+
# keeps PR runs green (the audit job itself still gates the PR).
44+
if: failure() && github.event_name != 'pull_request'
4245
permissions:
4346
issues: write
4447
steps:

.github/workflows/rust-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ permissions:
1515
jobs:
1616
rust-ci:
1717
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@d135b05bfc647d0c0fbfedc7e80f37ea50f49236
18+
with:
19+
toolchain: stable

.machine_readable/6a2/STATE.a2ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ compatibility = false
5353

5454
[blockers]
5555
threat-model-signoff = "threat-model.a2ml status = draft-pending-human-review (since 2026-04-19); blocks any januskey-mcp cartridge"
56-
homerolled-hmac = "attestation.rs SHA256(key||data) pattern flagged by threat model; must be replaced with a real HMAC primitive before MCP exposure (Trustfile no-homerolled-hmac)"
57-
metadata-only-key-types = "Ed25519/X25519 enum entries lack real sign/DH implementations (threat-model flag)"
56+
homerolled-hmac = "RESOLVED: attestation.rs now uses a real HMAC-SHA256 (hmac crate, RFC 2104) with a versioned domain separator, and hard-errors instead of the unwrap_or([0u8;32]) unkeyed fallback. Regression tests: test_attestation_refused_without_key, test_attestation_is_genuinely_keyed. Satisfies Trustfile no-homerolled-hmac."
57+
metadata-only-key-types = "PARTIALLY MITIGATED: Ed25519/X25519 key generation is now refused at the CLI (was silently producing 32 random bytes mislabelled as an asymmetric key); enum variants retained only for backward-compatible deserialization. Real dalek-backed sign/DH still unimplemented."
5858
claude-md-maintainer-edits = ".claude/CLAUDE.md is guardrail-blocked for agents: line 46 still says 'Julia/Rust/ReScript' (leftover from #49); package-management section still cites flake.nix, removed by the estate wave"
5959
idris2-in-ci = "just test-proofs requires the idris2 binary; proof check not yet wired as a CI gate (READINESS D→C promotion item)"
6060

Cargo.lock

Lines changed: 40 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TESTING-REPORT.adoc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
33
// SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell
44

5-
= JanusKey Testing Report
5+
= JanusKey Testing Report (ARCHIVED — 2025-12-29)
66
:toc: auto
77
:icons: font
88
:source-highlighter: rouge
99
:date: 2025-12-29
1010

11+
[WARNING]
12+
====
13+
*This report is a stale snapshot from 2025-12-29 and is retained for
14+
history only.* It predates the 2026-04 readiness assessment, which graded
15+
the project *D (Alpha, Unstable)*. Its "all tests passed / robust and
16+
functional" framing overstates the current state (homerolled attestation
17+
MAC, unimplemented asymmetric crypto, no fuzz/mutation/chaos testing).
18+
19+
*For the current, authoritative test status see `READINESS.md` and
20+
`.machine_readable/6a2/STATE.a2ml`.*
21+
====
22+
1123
== Executive Summary
1224

13-
This report documents the comprehensive testing of the JanusKey project, a reversible file operations system with cryptographic key management. All tests passed successfully, demonstrating a robust and functional implementation.
25+
This report documents the testing of the JanusKey project as of 2025-12-29, a reversible file operations system with cryptographic key management. The tests recorded here passed at that time; see the archival warning above for why this no longer reflects project status.
1426

1527
|===
1628
| Metric | Result

TOPOLOGY.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0
33
Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
44
-->
55
<!-- TOPOLOGY.md — Project architecture map and completion dashboard -->
6-
<!-- Last updated: 2026-02-19 -->
6+
<!-- Last updated: 2026-07-02 (completion dashboard reconciled to STATE.a2ml / READINESS.md) -->
77

88
# JanusKey — Project Topology
99

@@ -53,27 +53,43 @@ Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
5353

5454
## Completion Dashboard
5555

56+
> **Source of truth:** `.machine_readable/6a2/STATE.a2ml` (completion 60%,
57+
> CRG grade **D**) and `READINESS.md` (Grade **D — Alpha, Unstable**). This
58+
> dashboard is a human-readable summary of those files; if they disagree,
59+
> they win. Percentages below are qualitative, not measured coverage.
60+
5661
```
5762
COMPONENT STATUS NOTES
5863
───────────────────────────────── ────────────────── ─────────────────────────────────
5964
CORE ENGINE (RUST)
60-
Operation Layer ██████████ 100% Delete/Modify/Move stable
61-
Inverse Metadata Gen ██████████ 100% Perfect inversion verified
62-
Transaction Manager ██████████ 100% Begin/Commit/Rollback active
63-
Content-Addressed Storage ██████████ 100% SHA256 deduplication verified
65+
Operation Layer ████████░░ ~85% Delete/Modify/Move implemented; unit-tested
66+
Inverse Metadata Gen ████████░░ ~80% execute∘undo roundtrip property-tested (proptest)
67+
Transaction Manager ████████░░ ~80% Begin/Commit/Rollback tested via P2P suite
68+
Content-Addressed Storage ████████░░ ~85% Real SHA256 content store + dedup
69+
70+
SECURITY (honest)
71+
Attestation / audit chain ███░░░░░░░ ~30% Homerolled SHA256(key||data||prev) MAC +
72+
zero-key fallback — flagged by threat model
73+
(STATE.a2ml homerolled-hmac); needs real HMAC
74+
Asymmetric crypto █░░░░░░░░░ ~10% Ed25519/X25519 are enum labels, not implemented
75+
Secure obliteration ████░░░░░░ ~40% Best-effort; NOT guaranteed on SSD/CoW (threat-
76+
model dependent — see obliteration caveat)
6477
6578
INTERFACES & RESEARCH
66-
CLI Interface (jk) ██████████ 100% Full command set verified
67-
MPR Methodology ██████████ 100% Security by construction proven
68-
Testing Report (SCM) ██████████ 100% Audit trail validated
79+
CLI Interface (jk) ████████░░ ~85% Full command set; no user testing yet
80+
MPR Methodology ████░░░░░░ ~40% Design documented; FORMAL PROOFS PENDING
81+
(30 Idris2 proofs unchecked in CI; not linked
82+
to the Rust)
83+
Testing (READINESS matrix) ██████░░░░ ~60% 67 tests + 5 benches; missing fuzz, mutation,
84+
chaos, compatibility (Grade D)
6985
7086
REPO INFRASTRUCTURE
71-
Justfile Automation ██████████ 100% Standard build/lint tasks
72-
.machine_readable/ ██████████ 100% STATE tracking active
73-
0-AI-MANIFEST.a2ml ██████████ 100% AI entry point verified
87+
Justfile Automation █████████░ ~90% Build/lint/test recipes present
88+
.machine_readable/ █████████░ ~90% STATE tracking active
89+
0-AI-MANIFEST.a2ml █████████░ ~90% AI entry point present
7490
7591
─────────────────────────────────────────────────────────────────────────────
76-
OVERALL: ██████████ 100% v1.0 Production Ready
92+
OVERALL: ██████░░░░ ~60% Grade D — Alpha, Unstable (not v1.0)
7793
```
7894

7995
## Key Dependencies

crates/januskey-cli/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ clap = { version = "4", features = ["derive"] }
1818
serde = { version = "1", features = ["derive"] }
1919
serde_json = "1"
2020
sha2 = "0.10"
21+
hmac = "0.12"
2122
chrono = { version = "0.4", features = ["serde"] }
2223
uuid = { version = "1", features = ["v4", "serde"] }
2324
thiserror = "1"
@@ -28,7 +29,7 @@ dirs = "5"
2829
walkdir = "2"
2930
colored = "2"
3031
dialoguer = "0.11"
31-
indicatif = "0.17"
32+
indicatif = "0.18"
3233
glob = "0.3"
3334
whoami = "1"
3435

0 commit comments

Comments
 (0)