security(node): sign the SignedTreeHead and resolve did:web documents over the network instead of trusting prefixes

Open
#21 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start with src/p2p.rs and src/udp_gossip.rs to trace how SignedTreeHead values are created and ingested, then inspect src/http_identity.rs and src/udp_gossip.rs for DID verification. The issue names tests/milestone2_test.rs as evidence for the current registration behavior. Done means forged STHs are rejected and a did:web identity without a resolvable, matching document is not marked verified_b2b; add tests for both cases.

Written by the indexing model from the issue text.

Description

area::node effort::m impact::high priority::low source::auto status::review type::security

Context

Full-ecosystem production-readiness audit (2026-11-18). Two trust anchors of the node are decorative: the gossip tree head carries no signature, and did:web identities are marked verified without any network resolution. Milestone 7 (#7, status::review) claims a live did:web document verifier.

Findings (evidence)

  1. SignedTreeHead is not signed. The struct is {node_id, tree_size, root_hash} with no signature field and no sender verification (src/p2p.rs:10-18); equivocation detection in udp_gossip.rs therefore trusts whoever sends the head.
  2. verified_b2b granted by prefix. Identity resolution marks any DID starting with did:web: as a verified B2B identity (src/http_identity.rs:14-17); the inline did_document_json validation is optional and superficial (src/udp_gossip.rs:118-141); there is no fetch of /.well-known/did.json anywhere in the crate (grep: no HTTP client for resolution). The test tests/milestone2_test.rs:89-97 proves registration without a document succeeds.

Impact

High: Key Transparency anti-equivocation and merchant identity verification — two properties the architecture sells — do not hold against an active attacker.

Acceptance criteria

  • STH carries an Ed25519 signature over {node_id, tree_size, root_hash}, verified on ingest (gossip + HTTP).
  • did:web verification resolves https://<domain>/.well-known/did.json over the network, matches the DID's verification material, and caches with TTL; unverified DIDs are never marked verified_b2b.
  • Tests: forged STH rejected; did:web without resolvable document not verified.
Dominant language
Rust
Stars
0
Forks
0
Avg merge
4m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from alfonsodg/sonaraim-node

All issues in alfonsodg/sonaraim-node

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.