Skip to content

fix: skip malformed agent card signature headers - #1335

Open
sean0407 wants to merge 1 commit into
a2aproject:mainfrom
sean0407:codex/malformed-protected-header-1332
Open

sean0407 wants to merge 1 commit into
a2aproject:mainfrom
sean0407:codex/malformed-protected-header-1332

Conversation

@sean0407

Copy link
Copy Markdown

Summary

for each AgentCard signature:
+ skip malformed base64, UTF-8, or JSON protected headers
  attempt verification of remaining signatures

The malformed-header failure now reaches the existing InvalidSignaturesError result when no signature verifies, while a later valid signature can still verify. Fixes #1332.

Evidence

  • Before: The issue reproduction raised raw binascii.Error for protected='!!!not-base64url!!!' and stopped before later signatures.
  • After: The regression test confirms malformed-only input raises InvalidSignaturesError and malformed-then-valid input verifies. ./scripts/lint.sh passed; uv run pytest --cov=src --cov-report=term-missing reported 2,270 passed, 183 skipped, 3 xfailed, 1 xpassed, and 93% total coverage.

Merge Danger

Door: Two-way

Blast Radius: Low

Only malformed protected-header parsing is skipped; key-provider and signature-verification handling remain unchanged.

@sean0407
sean0407 requested a review from a team as a code owner October 12, 2026 12:44
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/utils/signing.py 95.77% 93.59% 🔴 -2.18%
Total 93.10% 93.08% 🔴 -0.02%

Generated by coverage-comment.yml

@Iwaniukooo11 Iwaniukooo11 self-assigned this Oct 12, 2026
verifier_wrong_key(signed_card)


def test_verifier_skips_malformed_protected_header(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extend the test to also cover json.JSONDecodeError, UnicodeDecodeError, and the not isinstance(protected_header, dict) guard

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Agent card signature verification raises raw binascii.Error on a malformed protected header instead of SignatureVerificationError

2 participants