basyx commited on
Commit
a4fde0f
·
verified ·
1 Parent(s): a760c15

Match Studio HMAC canonicalization

Browse files

Use the exact newline-separated envelope format produced by the Studio proxy.

Files changed (1) hide show
  1. app/security/studio_identity.py +1 -1
app/security/studio_identity.py CHANGED
@@ -56,7 +56,7 @@ def verify_studio_identity(
56
  current = time.time() if now is None else now
57
  if abs(current - timestamp) > max_age_seconds:
58
  raise ValueError("Studio identity envelope has expired.")
59
- canonical = "\\n".join((timestamp_text, subject, email, name)).encode("utf-8")
60
  expected = hmac.digest(secret.encode("utf-8"), canonical, "sha256").hex()
61
  if not hmac.compare_digest(expected, signature):
62
  raise ValueError("Studio identity signature is invalid.")
 
56
  current = time.time() if now is None else now
57
  if abs(current - timestamp) > max_age_seconds:
58
  raise ValueError("Studio identity envelope has expired.")
59
+ canonical = "\n".join((timestamp_text, subject, email, name)).encode("utf-8")
60
  expected = hmac.digest(secret.encode("utf-8"), canonical, "sha256").hex()
61
  if not hmac.compare_digest(expected, signature):
62
  raise ValueError("Studio identity signature is invalid.")