You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
security: DID cryptographic identity audit — SDK fixes
- Add verify_w3c_credential() for offline W3C VC v2.0 verification
- Add format param to get_reputation_credential() (avp/w3c)
- Document did:key risk, challenge-response, credential signing in SECURITY.md
- Part of full DID/crypto identity revision (Sprint 1+2)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: SECURITY.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,39 @@ We will acknowledge receipt within **48 hours** and aim to provide an initial as
30
30
-**Audit trail** — SHA-256 hash-chained logs anchored to IPFS
31
31
-**Key storage** — local keys saved with `chmod 0600` permissions
32
32
33
+
## Cryptographic Identity
34
+
35
+
### DID Method: did:key
36
+
37
+
AVP uses `did:key` (W3C CCG, Ed25519) for agent identifiers. This is a **stateless, self-certifying** method: the DID is derived deterministically from the public key.
38
+
39
+
**By design, did:key does not support:**
40
+
- Key rotation (new key = new DID)
41
+
- DID deactivation/revocation at the protocol level
42
+
- Key recovery after loss
43
+
44
+
**Implications for key compromise:** If an agent's private key is compromised, the attacker gains full control of that identity. AVP mitigates this server-side: agents can be suspended or revoked via the AVP registry, and webhook alerts notify operators of anomalous score drops. However, this protection is scoped to the AVP ecosystem.
45
+
46
+
**Recommendations:**
47
+
- Use encrypted key storage (`agent.save(passphrase="...")`) with Argon2id key derivation for production agents.
48
+
- For long-lived, high-value agents, consider `did:web` (supports rotation, revocation, key history) when AVP adds support.
49
+
- Store keys in hardware security modules (HSM) or secure enclaves where possible.
50
+
- Monitor reputation velocity alerts for early compromise detection.
51
+
52
+
### Challenge-Response Authentication
53
+
54
+
-**Registration challenge:** 64 random hex chars (`secrets.token_hex(32)`), stored in Redis with 300-second TTL. Expired challenges auto-delete. One-time use — consumed on verification.
55
+
-**API request auth:** Ed25519 signature over `{method}:{path}:{timestamp}:{nonce}:{body_sha256}`. Timestamp window: 60 seconds. Nonces tracked in Redis with 120-second TTL (2x timestamp window for safety margin). Redis unavailable = fail closed (503).
56
+
-**Proof-of-Work:** Required on registration to prevent Sybil attacks. SHA-256 with configurable difficulty (default 24 leading zero bits).
57
+
58
+
### Credential Signing
59
+
60
+
Reputation credentials are signed by the server's Ed25519 key (configured via `CREDENTIAL_SIGNING_KEY_HEX`). Two formats available:
61
+
-**AVP format:** Custom JSON with hex-encoded signature. Verify with `AVPAgent.verify_credential()`.
62
+
-**W3C VC v2.0 format:** Standards-compliant Verifiable Credential with Data Integrity proof (`eddsa-jcs-2022`). Verify with any VC library or `AVPAgent.verify_w3c_credential()`.
63
+
64
+
Ephemeral signing keys are rejected in production (`CREDENTIAL_SIGNING_KEY_HEX` must be set).
65
+
33
66
## Disclosure Policy
34
67
35
68
We follow coordinated disclosure. Please do not open public issues for security vulnerabilities.
0 commit comments