a2aproject / a2aproject/a2a-js
[Bug]: Client caches an extended Agent Card before signature verification succeeds
- 主要语言
- TypeScript
- 星标
- 613
- 派生
- 169
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 21
描述
## What happened
When `Client.getAgentCard` fetches an authenticated extended Agent Card with a signature verifier, the client replaces its cached Agent Card before verification completes. If the verifier rejects the card, the call throws, but the unverified card remains active inside the client.
This can change later capability decisions. For example, an unverified extended card can set `pushNotifications: true` and `extendedAgentCard: false`; after the verification error is caught, a later `getAgentCard()` returns that unverified card without fetching or verifying again.
## What I expected
A fetched Agent Card should replace the client's cached card only after the supplied signature verifier succeeds. If verification fails, the previously trusted/public card should remain active, so subsequent calls can retry and capability checks cannot be influenced by rejected content.
## Steps to reproduce
1. Create a `Client` with a public Agent Card that has `extendedAgentCard: true` and `pushNotifications: false`.
2. Configure its transport to return an extended Agent Card named `"UNVERIFIED"` with `extendedAgentCard: false` and `pushNotifications: true`.
3. Call `getAgentCard` with a verifier that throws `Error("invalid signature")`, and catch the error.
4. Call `getAgentCard()` again without a verifier.
5. Observe that the transport was called only once and the second call returns `"UNVERIFIED"` with `pushNotifications: true`, even though that card failed verification.
## Additional context
A2A section 8.4.3 says clients should verify at least one signature before trusting an Agent Card. Section 13.3 recommends replacing the cached public card with the extended version, but the replacement should happen only after successful verification.
Suggested behavior: fetch into a temporary value, run the supplied verifier, then commit it to the client's cached Agent Card. On verification failure, retain the previous card.
Spec: https://github.com/a2aproject/A2A/blob/main/docs/specification.md#843-signature-verification
贡献指南
调研方向
Look at the `Client.getAgentCard` method and the caching logic. The bug is about the order of caching and verification. Start by finding where the fetched card is stored and where the signature verifier is called. The fix is to store the new card only after verification succeeds. Check the test steps in the issue to understand the expected flow.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript
- 领域
- backend-api-design, security
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 65/100