Repository navigation
FOUR-34196 Review the issue Unauthorized - #9117
devmiguelangel wants to merge 5 commits into
Conversation
…uards for blocking response
…sureAccountAllowsAccess and adjust tests for static data providers
PR SummaryMedium Risk Overview Guard scoping: Logout behavior: Session invalidation and logout run only when the resolved guard implements Tests & k6: New feature tests cover malformed bearer on web, denied statuses on web/API, and guard isolation via Reviewed by Cursor Bugbot for commit b9a7090. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 29ba1da. Configure here.
|






Issue & Reproduction Steps
Review the issue Unauthorized
The performance2 environment generated a high volume of OAuth authorization errors when requests contained malformed bearer values such as
Bearer undefined,Bearer null, or placeholder JWTs.EnsureAccountAllowsAccesswas registered in the web middleware group but unconditionally evaluated both thewebandapiguards. As a result, Passport parsed and reported malformed bearer tokens even for requests authenticated through a web session, producing large stack traces and unnecessary log/disk overhead.To reproduce before this change:
Authorization: Bearer undefined.Solution
EnsureAccountAllowsAccessto explicitly supplied guards.webguard when the middleware runs in the web group.ProcessMakerAuthenticate, soauth:apichecks onlyapi.PM_K6_BASE_URLand a validPM_K6_TOKENinstead of sending nullish or placeholder bearer values.This change preserves normal
401behavior for malformed credentials sent directly to authenticated API routes; it prevents unrelated API guard evaluation on web routes.How to Test
Run:
Result: 13 tests, 58 assertions, all passing.
Related Tickets & Packages
FOUR-34196
Code Review Checklist