a2aproject / a2aproject/a2a-js

[Bug]: Client caches an extended Agent Card before signature verification succeeds

Ouverte
#705 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
613
Forks
169
Merge moyen
1 j 6 h
PR mergées (30 j)
21

Description

## 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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, typescript
Domaine
backend-api-design, security
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
65/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.