Skip to content

Commit ff33150

Browse files
committed
Reject "dangerous" JWT headers. Closes #673.
1 parent a0927d2 commit ff33150

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

atr/jwtoken.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ def verify(token: str) -> dict[str, Any]:
105105

106106

107107
async def verify_github_oidc(token: str) -> dict[str, Any]:
108+
header = jwt.get_unverified_header(token)
109+
dangerous_headers = {"jku", "x5u", "jwk"}
110+
if dangerous_headers.intersection(header.keys()):
111+
raise base.ASFQuartException("JWT contains disallowed headers", errorcode=401)
108112
try:
109113
async with util.create_secure_session() as session:
110114
r = await session.get(

0 commit comments

Comments
 (0)