Skip to content

feat(identity): pin trusted keys in verify_signatures; stop claiming attribution without them - #9

Merged
bhyi4 merged 1 commit into
mainfrom
claude/trusted-keys
Nov 24, 2026
Merged

bhyi4 merged 1 commit into
mainfrom
claude/trusted-keys

Conversation

@bhyi4

@bhyi4 bhyi4 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Requested by 범후연이 · project thread

Problem

verify_signatures only checked that the key written inside each entry signed it. If someone rewrote a ledger and signed every entry with a fresh key, it still passed. The result nonetheless said "Attribution proven", and the README and GUIDE said impersonation ("signed with the wrong key") was caught. Without knowing which key is expected, it is not.

Change

  • New load_trusted_keys(path): reads lines of <agent> <pubkey_hex>, with * meaning any agent and # starting a comment. It validates that each key is a 32-byte Ed25519 key and reports the file and line on errors.
  • New verify_signatures(ledger, trusted_keys=...) and am verify-sig --trusted-keys FILE:
    • An entry signed by a key that is not trusted for its agent → FAIL (impersonation).
    • An unsigned entry from an agent that has a trusted key → FAIL. Otherwise an impersonator would simply leave the signature off.
    • Agents with no trusted key may stay unsigned, as before.
  • Without trusted keys: behaviour is unchanged, but the OK message no longer says "Attribution proven". It now says the signatures are self-consistent and the keys are NOT pinned.
  • README, README_KO, GUIDE and GUIDE_KO are corrected: impersonation is caught only with trusted keys, and the trusted-keys file must be kept out of the ledger writer's reach. load_trusted_keys is exported. CHANGELOG updated.

Tests

  • 4 new tests in tests/test_am.py:
    • shows the old gap: a ledger re-signed with an attacker's key passes without trusted keys;
    • impersonation and missing-signature FAILs;
    • wildcard keys and a malformed trusted-keys file;
    • CLI exit codes.
  • Full suite: 92 passed. cryptography is installed locally, so the signing tests actually ran rather than being skipped.

Generated by Claude Code

…attribution without them

verify_signatures only checked that the key written in each entry signed it.
A ledger rewritten and re-signed with a fresh key passed, yet the result said
"Attribution proven" and the README said impersonation was caught.

New load_trusted_keys() and am verify-sig --trusted-keys FILE (<agent> <pubkey>
lines, * for any agent): a signature by a key not trusted for the entry's
agent FAILs, and so does an unsigned entry from an agent with a trusted key.
Without trusted keys the OK message now says the keys are not pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aq8kkjKAMDjSSK54hcWnuc
@bhyi4 bhyi4 self-assigned this Nov 24, 2026
@bhyi4
bhyi4 merged commit 1c91eda into main Nov 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants