a2aproject / a2aproject/a2a-js

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

Abierto
#705 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
613
Forks
169
Merge medio
1 d 6 h
PR fusionados (30 d)
21

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, typescript
Área
backend-api-design, security
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
65/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.