Skip to content

Commit 939eec5

Browse files
committed
Normalize line endings in key challenge response
1 parent 62b1149 commit 939eec5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ssh_keyservice/app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ def verify_challenge_response(challenge, response, public_key):
293293
Verifies the challenge response using the provided public key.
294294
"""
295295
try:
296+
# Normalize line endings and encode the response
297+
byte_str = response.encode("UTF-8")
298+
byte_str = byte_str.replace(b'\r\n', b'\n').replace(b'\r', b'\n')
299+
response = byte_str.decode("UTF-8")
296300

297301
# Create a temporary file to store the public key and response
298302
with tempfile.NamedTemporaryFile(mode="w", prefix="tmp_allowed_signers",

0 commit comments

Comments
 (0)