Skip to content

changed fcntl to portalocker to ensure compatiblity with windows#45

Merged
muellerberndt merged 3 commits into
scabench-org:mainfrom
poorvigupta26:fcntl-compatibility
Oct 15, 2025
Merged

changed fcntl to portalocker to ensure compatiblity with windows#45
muellerberndt merged 3 commits into
scabench-org:mainfrom
poorvigupta26:fcntl-compatibility

Conversation

@poorvigupta26

Copy link
Copy Markdown

resolve for #44

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@muellerberndt

Copy link
Copy Markdown
Collaborator

Thanks! I believe we need to update requirements.txt also?

@muellerberndt

Copy link
Copy Markdown
Collaborator

Please also run ruff check . --fix once in the root so we get rid of those linter errors :)

@poorvigupta26

Copy link
Copy Markdown
Author

Thanks! I believe we need to update requirements.txt also?

thanks for pointing that out. have made the necessary changes now :)

@muellerberndt muellerberndt merged commit d401523 into scabench-org:main Oct 15, 2025
2 of 7 checks passed
zcor added a commit to zcor/hound that referenced this pull request Jun 1, 2026
… tokens (scabench-org#45)

Admin preview tokens carry user_id=0 and admin_preview=True. The previous
check in get_current_user() treated user_id=0 as "invalid token" and raised
401. The frontend api-client treats every 401 as session-expired and
dispatches auth:session-expired, which restores the stashed real session
and redirects to "/". Admins who clicked into any page that calls
getCurrentUser() (audit detail hits /users/me via apiClient.getCurrentUser
to prefill a contact-email prompt) got silently booted out of preview.

Return 404 instead of 401 when user_id is falsy AND admin_preview is set.
Semantically correct — we are previewing a tenant, there is no "me" user
to return — and does NOT trip the 401 session-expired flow.

Repros: open admin panel, click "Preview Dashboard" on tenant 57, land
on /; click into /audits/repo-27 — red ADMIN PREVIEW banner disappears
and you're back to your own account.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zcor added a commit to zcor/hound that referenced this pull request Jun 1, 2026
scabench-org#46)

My previous fix (scabench-org#45) added a check for payload.get("admin_preview") but
get_current_user_from_token() strips the JWT payload down to {user_id,
tenant_id} and discards custom claims — so the check always saw None and
we still 401'd.

Switch to decode_access_token() which returns the full payload. This is
the same approach used by reject_preview_writes() in auth_utils.py (and
CLAUDE.md gotcha #admin-preview documents the trap).

Verified with a fresh preview JWT after deploy: /users/me returns 404
(was 401), preview banner persists across /audits/repo-27 navigation.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants