-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gate/Policy breaks when using octane+telescope #1122
Comments
@Gab-Menezes we're a bit strapped these days so we'll need to delay looking into this for now. If you could come up with a PR yourself that'd be great. |
I put together a propspective fix but it only part of it may make sense for the This would trace the stack back to file vendor/laravel/octane/src/ApplicationGateway.php:36 for call telescope/resources/js/screens/gates/preview.vue Lines 38 to 43 in e31d4e7
The UI hides file location details if it isn't stored so may be best to just introduce the src/Watchers/GateWatcher.php change that stores database entry Edit: I've submitted a pull request for the simplest fix. Telescope will provide less feedback about what triggered the gate check, but at least it doesn't throw an exception. |
@derekmd ty for the fix, I was really busy with work this last week, and ended forgeting about it. I'm gonna test this later, should we close this issue or leave it until we can find a better fix ? |
It can probably be closed because I can't think of a non-hacky fix for this. The problem seems to be route middleware performing gate authorization checks so e.g., Route::get('profile/{user}', function (\App\User $user) {
return view('profiles.view', ['user' => $user]);
})->middleware('can:view,user'); Even without using Laravel Octane, visiting As mentioned in my pull request, maybe a hardcoded fallback could be introduced to indicate But the code is really hacky: https://github.com/laravel/telescope/compare/4.x...derekmd:gate-stacktrace-auth-middleware?expand=1 The Telescope screen hiding that "Location" line seems a good enough solution. The line will still be displayed for controller |
Yeah I understand, looking carefully it really seems a hacky solution. I'm gonna let this issue be open for few more days, only to have a chance to attract another solutions from other people. I'm also gonna try to think in a solution, if nothing pops out I'm gonna close it. |
Description:
The use of the can middleware will cause the GateWatcher::recordGateCheck to throw an exception because the funcion getCallerFromStackTrace will return null instead of an array with the file and line.
I'm running Swoole but I suspect that the same will happen to RoadRunner, since the begin of the stacktrace it's not a vendor file.
Here is another issue talking about the same problem: #1072
Here is a link with the thrown exception: https://pastebin.com/DKMHPs3E.
If ignore_packages is set to false in the cofig file the error doesn't happen.
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: