First, a quick milestone update: PR#2137has been merged into ethereum/ERCs:master!
It enforces verificationTier = 0 at initial registration, introduces verificationExpiry, dynamic getEffectiveTier() evaluation, and ensures reputation updates cannot renew expired certifications. Thanks @Revinand for the sharp review!
Following an internal audit of interface edge cases and the insightful feedback from @SergeevDmitry and @sen_vouch, we would like to submit the following Hardening RFC to the community for discussion before drafting the next PR:
Current Issue: isKnownAttacker returns true if any recorded incidents exist. If an authorized oracle reports a false positive, an innocent agent is permanently blacklisted with no standard mechanism for remediation.
Proposed Resolution:
Introduce an explicit IncidentStatus state machine:
Extend AttackRecord to track uint256 incidentId, address reporter, and IncidentStatus status.
Add a retraction method callable only by the original reporter or governance:
function retractAttack(uint256 incidentId, string calldata reason) external;
Invariant: isKnownAttacker(agent) MUST return true if and only if there exists at least one incident with status == IncidentStatus.ACTIVE.
2. DID Front-Running & Registration Authorization
Current Issue: registerAgent(did, publicKey, metadataURI) does not explicitly bind msg.sender to the agent address embedded in did:agent:<chainId>:<address>, allowing malicious third parties to squat high-profile agent identities.
Proposed Resolution:
Add normative invariant: registerAgent MUST verify that msg.sender == extractedAgentAddress, OR:
Support delegated factory registrations via an EIP-712 typed signature from the agent wallet:
Active State Invariant: In IAgentIdentityRegistry, ensure isVerified(agent) checks both agent.isActive && getEffectiveTier(agent) > 0. Add deactivateAgent() / reactivateAgent() callable by the agent controller.
On-Chain Attack Record Getter: In IThreatRegistry, add a dedicated getter to inspect full incident details:
function getAttackRecord(uint256 incidentId) external view returns (AttackRecord memory);
Standardized Threat Layer Taxonomy: Replace ambiguous uint8 layer with an explicit enum:
Transaction Telemetry: Either define standard updating methods (recordTransactionResult) or remove un-updated counter fields (totalTransactions, successfulTransactions) from the core minimal interface to avoid orphan state.
What exactly would RESOLVED mean here? A confirmed attack that has been remediated is different from a false positive that was retracted. Both would make isKnownAttacker return false under the proposed rule. Should the boolean instead describe active threats while confirmed historical incidents remain separately queryable? I would also specify who may mark an incident RESOLVED and test that resolving one incident cannot clear the flag while another remains ACTIVE.
Spot-on distinction, @SergeevDmitry. You’ve pinpointed an essential nuance between an erroneous attribution and a remediated historical exploit.
Here is the exact architectural specification we are adopting based on your feedback:
1. Semantic Separation: Active Defense vs. Historical Lineage
We decouple the immediate execution firewall from historical risk underwriting:
hasActiveThreat(address agent) -> bool (and isKnownAttacker for backward compatibility):
Evaluates strictly whether the agent poses an immediate, un-remediated risk. It returns true if and only if activeIncidentCount[agent] > 0.
getIncidentSummary(address agent) -> (uint256 active, uint256 resolved, uint256 retracted):
Exposes the full breakdown. This gives consuming protocols granular policy control:
Dynamic Defense (Standard): Reverts if active > 0 (caller cannot execute while under active investigation).
Zero-Tolerance / Institutional Underwriting: Reverts if active > 0 || resolved > 0 (permanently excludes any agent with confirmed historical exploit records, even if remediated).
retracted records are preserved for oracle accountability but completely excluded from threat evaluations.
2. Authorization Boundaries
retractAttack(uint256 incidentId, string reason):
Restricted exclusively to the original reporting entity (to correct an honest false positive) or the governance dispute module. The agent has zero authorization to retract.
resolveAttack(uint256 incidentId, string remediationURI):
MUST NOT be callable by the subject agent. It requires attestation by an authorized verification oracle, designated security auditor, or governance consensus certifying that the exploit condition, vulnerability, or financial restitution has been formally validated.
3. Independent State Machine Invariant
To guarantee that resolving or retracting one incident cannot clear an agent while another remains active:
The registry maintains an activeIncidentCount[agent] mapping.
recordAttack: transitions state to ACTIVE and increments activeIncidentCount[agent].
retractAttack / resolveAttack: verifies the incident is currently ACTIVE, updates the incident status, and decrements activeIncidentCount[agent].
Invariant: hasActiveThreat(agent) is strictly equivalent to activeIncidentCount[agent] > 0. If Incident A is marked RESOLVED while Incident B is ACTIVE, activeIncidentCount remains >= 1 and the blocking flag remains asserted.
We will add a dedicated conformance case (T7) specifically verifying this independent lifecycle invariant.
Thanks @ibonon for incorporating this. Starting registrations at tier 0, with a separate authorized promotion, addresses the registration issue. The dedicated expiry and the explicit rule that reputation updates cannot extend it also address my concern about stale verification.
Could we also make explicit that calculateTrustScore() uses getEffectiveTier() for any tier-based weighting? For example, after Gold verification expires, the agent should lose any Gold multiplier even if its stored verificationTier remains 3. Its reputation score can stay unchanged. The verification benefit should expire. That would keep trust scoring consistent with isVerified(), so consumers don’t accidentally retain the benefit of an expired certification. A conformance test covering expiry followed by a reputation update would help check that the expired tier contributes no boost in either case.
Thank you @Revinand — that is exactly the right consistency concern.
We have addressed it with the following explicit normative rule:
calculateTrustScore MUST derive any tier-based weighting from getEffectiveTier(agentAddress) rather than reading AgentIdentity.verificationTier directly. After expiry, the tier
contribution to the trust score is zero, even though the stored field
retains its value. The agent’s reputationScore is unaffected.
This means: Gold verification expires → getEffectiveTier() returns 0 →
Gold multiplier drops to zero in calculateTrustScore → isVerified() and calculateTrustScore are now consistent by construction.
We also added conformance test T8:
Promote agent to tier 3 (Gold)
Advance past verificationExpiry
Call updateReputationScore (must not extend expiry — T5 boundary)
Assert getEffectiveTier() == 0
Assert calculateTrustScore post-expiry < score while active (zero tier boost)
I turned T8 into runnable tests with a small test registry. They advance time, compare equal reputation, and cover the exact expiry boundary plus capped scores. All 7 pass.
Thank you @ted0x the assertExpired pattern comparing against a tier-0 control at equal reputation is more precise than our original scoreAfterExpiry < scoreWhileActive which breaks at saturation — as test_T8_doesNotRequireStrictScoreDecrease correctly catches. The abstract TrustScoreExpiryChecks base is exactly the adapter pattern a conformance suite needs. PR #2141 approved
[ERC-8259 Internal Audit Finding] Invariant Clarification: Inactive Agents in getEffectiveTier() and calculateTrustScore()
Following the merge of PR #2137 (verification expiry) and PR #2141 (Foundry test suite), we conducted an adversarial security audit on edge-case combinations across agent states. This review surfaced an invariant omission in the current draft regarding deactivated agents.
The Flaw
The AgentIdentity struct defines a bool isActive field to indicate whether an identity is currently operative (e.g. decommissioned, slashed, or revoked by governance).
However, under the wording introduced in PR #2137:
getEffectiveTier(agent) explicitly stated: “MUST return 0 if block.timestamp > verificationExpiry”, but omitted the requirement to evaluate !isActive.
As a consequence, if an agent holding a valid tier (e.g. Tier 2 Silver) was deactivated prior to its expiry timestamp, getEffectiveTier() continued returning 2, isVerified() returned true, and calculateTrustScore() continued awarding the full tier multiplier.
This allowed revoked agents to continue passing downstream guards (such as ERC8259Guard’s onlyVerifiedAgent and minTrustScore).
// Alice is verified at Tier 2 for 30 days
registry.updateVerificationTier(ALICE, 2, 30 days);
require(registry.isVerified(ALICE), "Alice verified");
// Governance deactivates Alice (e.g. rogue behavior or key compromise)
registry.deactivateAgent(ALICE);
// Invariant requirement:
require(registry.isVerified(ALICE) == false, "Inactive agent must not be verified");
require(registry.getEffectiveTier(ALICE) == 0, "Inactive agent effective tier must be 0");
require(registry.calculateTrustScore(ALICE) == 0, "Inactive agent trust score must be 0");
Proposed Specification Update
We propose a lightweight normative amendment to erc-8259.md and IAgentIdentityRegistry.sol:
getEffectiveTier: MUST return 0 if !isActive OR block.timestamp > verificationExpiry.
isVerified: MUST return false if !isActive or getEffectiveTier <= 0.
calculateTrustScore: MUST return 0 if !isActive.
The reference NPM package has been updated in erc-8259@1.3.0.