Skip to content

Commit 7beb0a7

Browse files
committed
fix(ram_signature): decode query parameters in signed headers
Updated the query parameter handling in get_agentrun_signed_headers to decode both keys and values using unquote. This ensures that the headers are correctly signed when special characters are present in the query string. 修复(ram_signature):在签名头中解码查询参数 更新 get_agentrun_signed_headers 中的查询参数处理,以使用 unquote 解码键和值。这确保在查询字符串中存在特殊字符时,头部能够正确签名。 Change-Id: If1ca01053877ec382044ffc84b4db0e81ecf0610 Signed-off-by: OhYee <oyohyee@oyohyee.com>
1 parent afcdfb1 commit 7beb0a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

agentrun/utils/ram_signature/signer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import hashlib
1313
import hmac
1414
from typing import Optional
15-
from urllib.parse import quote, urlparse
15+
from urllib.parse import quote, unquote, urlparse
1616

1717
ALGORITHM = "AGENTRUN4-HMAC-SHA256"
1818
UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"
@@ -156,7 +156,7 @@ def get_agentrun_signed_headers(
156156
for pair in parsed.query.split("&"):
157157
if "=" in pair:
158158
k, v = pair.split("=", 1)
159-
query_params[k] = v
159+
query_params[unquote(k)] = unquote(v)
160160

161161
now = sign_time if sign_time is not None else datetime.now(timezone.utc)
162162
if now.tzinfo is None:

0 commit comments

Comments
 (0)