Skip to content

Commit f915ff2

Browse files
committed
refactor: Pass the 'algorithms list' to 'jws.verify' to ensure only expected algorithms are used for signature validation.
1 parent 2621476 commit f915ff2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/a2a/utils/signing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def signature_verifier(
138138
protected_header = json.loads(protected_header_json)
139139
kid = protected_header.get('kid')
140140
jku = protected_header.get('jku')
141+
alg = protected_header.get('alg')
141142
verification_key = key_provider(kid, jku)
142143

143144
canonical_payload = canonicalize_agent_card(agent_card)
@@ -149,7 +150,7 @@ def signature_verifier(
149150
jws.verify(
150151
token=token,
151152
key=verification_key,
152-
algorithms=None,
153+
algorithms=[alg] if alg else None,
153154
)
154155
# Found a valid signature, exit the loop and function
155156
break

0 commit comments

Comments
 (0)