gabriel / musehub public
fix fix/branch-delete-signature-mismatch #1 / 1
AI Agent gabriel · 21 days ago · Jul 2, 2026 · Diff

fix: use raw encoded wire path for MSign signature verification

_verify_msign used request.url.path, which Starlette/ASGI always presents decoded (%2F -> /) regardless of what was actually sent over the wire. The client signs the encoded form (muse.core.msign.build_msign_header), so any request whose path contains a client-encoded slash produced a signature mismatch and a 401 - concretely, muse push --delete <branch> for any branch name with a '/' (task/*, feat/*, fix/* - i.e. nearly every real branch in this workspace's naming convention).

A regression test file already existed (test_request_signing_raw_path.py) fully speccing out the correct fix, but it tested a hand-copied mirror function defined inside the test file itself, never wired into the real _verify_msign - so it passed while production stayed broken. Extracted the real logic into _extract_signed_path() in request_signing.py, wired it into _verify_msign, and pointed the existing tests at the real function instead of the disconnected copy.

Verified: reproduced the exact 401 against real staging (push+delete a slash-named branch), confirmed the fix end-to-end against localhost after applying it, and ran the full wire suite (56 passed) plus the full auth suite (123 passed) with zero regressions.

sha256:7a8e762b497ce66d76329d6b188134a114a863c80215bf3c0f279fdd425de49c sha
+2 ~1 −1 symbols
2 changed · 997 in snapshot files
sha256:fe0f2c3278fdb0c08062b0c8a189ae2459f27975f50c7d87421ad92eeb2be352 snapshot
+2
symbols added
~1
symbol modified
−1
symbol removed
2
files changed
997
files in snapshot
0
dead code introduced
Semantic Changes 4 symbols
~ musehub/auth/request_signing.py .py 1 symbol added, 1 symbol modified
+ _extract_signed_path function function _extract_signed_path L114–135
~ tests/test_request_signing_raw_path.py .py 1 symbol added, 1 symbol removed
_extract_path function function _extract_path L29–35
+ _extract_path import import _extract_path L18–18
Files Changed
~2
997 in snapshot
← Older Oldest on fix/branch-delete-signature-mismatch
All commits
Newer → Latest on fix/branch-delete-signature-mismatch

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:7a8e762b497ce66d76329d6b188134a114a863c80215bf3c0f279fdd425de49c --body "your comment"