fix(cloud): compare job owner as string so recovered jobs pass the guard
User.id is a uuid.UUID; live jobs store that object, but jobs recovered from the .owner sidecar store its string form. 'UUID(x) != str(x)' is always True, so after a restart the legitimate owner got 404 on /status, /transcript, /hook etc. for their own recovered jobs. Compare str(user.id) != str(owner).
This commit is contained in:
parent
be3dc665a3
commit
ff38a9d7ee
1 changed files with 3 additions and 1 deletions
4
app.py
4
app.py
|
|
@ -232,7 +232,9 @@ async def _assert_job_owner(request, record):
|
|||
if owner is None:
|
||||
return
|
||||
user = await _user_from_request(request)
|
||||
if user is None or user.id != owner:
|
||||
# Compare as strings: live jobs store a uuid.UUID, but jobs recovered from
|
||||
# the .owner sidecar store its string form — UUID != str is always True.
|
||||
if user is None or str(user.id) != str(owner):
|
||||
raise HTTPException(status_code=404, detail="Not found")
|
||||
|
||||
# Application State
|
||||
|
|
|
|||
Loading…
Reference in a new issue