Skip to content

Comments

[Log Rocket] /broadcasting/auth 403 on multiple customers#8737

Open
marcoAntonioNina wants to merge 4 commits intodevelopfrom
bugfix/FOUR-24910
Open

[Log Rocket] /broadcasting/auth 403 on multiple customers#8737
marcoAntonioNina wants to merge 4 commits intodevelopfrom
bugfix/FOUR-24910

Conversation

@marcoAntonioNina
Copy link
Contributor

@marcoAntonioNina marcoAntonioNina commented Feb 20, 2026

Issue & Reproduction Steps

The 403 error is because it has permissions on the broadcasting channel.

Solution

  • This could be due to a lost session; defensive code is used here to prevent subscriptions if the user doesn't exist.
  • Middleware is added to view the 403 error and capture more information when this problem occurs. A variable, BROADCAST_AUTH_DEBUG, is used to enable this logging.

How to Test

The steps to reproduce the problem are uncertain; you should only check that notifications are working correctly.

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

ci:deploy


Note

Medium Risk
Touches realtime auth and channel authorization paths; misconfiguration or overly strict checks could block legitimate subscriptions/notifications, though changes are mostly defensive and the logging is opt-in.

Overview
Reduces intermittent /broadcasting/auth 403s by hardening both client and server broadcast auth behavior.

On the backend, broadcasting routes now run under auth:web,anon and a new opt-in BroadcastAuthDebug middleware (enabled via BROADCAST_AUTH_DEBUG) logs detailed context for failed auth responses. Channel authorization callbacks now explicitly deny unauthenticated/AnonymousUser access and return false (instead of null) for invalid IDs.

On the frontend, Echo’s broadcasting config is adjusted to default authEndpoint to the app origin and enable withCredentials, and Echo.private() is wrapped to no-op when there is no current user or when subscribing to another user’s private channel.

Written by Cursor Bugbot for commit 92b54eb. This will update automatically on new commits. Configure here.

…equests

- Introduced BroadcastAuthDebug middleware to log failed broadcast authentication attempts (HTTP status codes 401, 403, 500) for debugging purposes.
- Updated BroadcastServiceProvider to include the new middleware in the broadcast routes.
- Enhanced private channel subscription logic in bootstrap.js to prevent 403 errors when no user is authenticated.
- Updated channels.php to ensure anonymous users are denied access to specific channels.
…are directed to the Laravel app with cookies, reducing CORS-related 403 errors.

- Added logic to handle user ID extraction from private channels, preventing subscription to channels of other users.
- Improved error handling for private channel subscriptions when no user is authenticated.
… channel information parsing

- Updated BroadcastAuthDebug middleware to log additional details on failed broadcast authentication attempts, including user anonymity and channel type.
@processmaker-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on March 21

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

'status' => $response->getStatusCode(),
'user_id' => $user?->id,
'user_type' => $user ? get_class($user) : null,
'user_is_anonymous' => $user && method_exists($user, 'isAnonymous') ? $user->isAnonymous : null,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method_exists check fails for isAnonymous property

Medium Severity

isAnonymous is defined as a public property (public $isAnonymous = true;) on AnonymousUser, not a method. Using method_exists($user, 'isAnonymous') will always return false, so user_is_anonymous will always be logged as null — even for anonymous users. This undermines the debug middleware's ability to diagnose the exact 403 scenario it was built to investigate. The check needs property_exists instead.

Fix in Cursor Fix in Web

{
$response = $next($request);

if (!env('BROADCAST_AUTH_DEBUG', false)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct env() call fails with cached config

Medium Severity

env('BROADCAST_AUTH_DEBUG', false) is called directly instead of through a config value. In production Laravel deployments where php artisan config:cache has been run, the .env file isn't loaded, so env() will always return the default false. Since BROADCAST_AUTH_DEBUG isn't registered in any config file, this middleware can never be activated in a cached-config environment — exactly the production scenario it's meant to debug.

Fix in Cursor Fix in Web

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.

1 participant