You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sensitive Parameters not being obfuscated for Laravel Telescope #544
(I am creating this here because I cannot find where to create issues on the laravel-plugin repository)
I upgraded to the Saloon V4 this morning and I saw that the TelescopeMiddleware that records all Saloon HTTP requests has been added to the laravel-plugin(thanks for this, I can finally remove the custom middleware i wrote).
However, I noticed that sensitive details are not being obfuscated unlike on the Telescope HTTP request itself.
The first image is a request captured by Telescope using my custom implementation and below it is the request captured by the new TelescopeMiddleware that was added on v4.
Btw, the custom implementation just dispatches a ResponseReceived event that is listened to by Telescope ClientRequestWatcher and the ClientRequestWatcher automatically obfuscates the header and payload depending on what is set on the TelescopeServiceProvider hideSensitiveRequestDetails method. This is my custom TelescopeLoggingMiddleware and hideSensitiveRequestDetails for better context.
class TelescopeLoggingMiddleware implements ResponseMiddleware
{
public function __invoke(Response $response): void
{
Event::dispatch(new ResponseReceived(
$this->convertToHttpClientRequest($response),
$this->convertToHttpClientResponse($response)
));
}
protected function convertToHttpClientRequest(Response $saloonResponse): \Illuminate\Http\Client\Request
{
return new \Illuminate\Http\Client\Request(
$saloonResponse->getPsrRequest()
);
}
protected function convertToHttpClientResponse(Response $saloonResponse): \Illuminate\Http\Client\Response
{
return new \Illuminate\Http\Client\Response(
$saloonResponse->getPsrResponse()
);
}
}
/**
* Prevent sensitive request details from being logged by Telescope.
*/
protected function hideSensitiveRequestDetails(): void
{
if ($this->app->environment('local')) {
return;
}
Telescope::hideRequestParameters(['_token', 'authorization_code']);
Telescope::hideRequestHeaders([
'cookie',
'x-csrf-token',
'x-xsrf-token',
'Authorization',
'music-user-token',
]);
}
Activity
Horlerdipo commentedon Mar 26, 2026
Btw, the custom implementation just dispatches a
ResponseReceivedevent that is listened to by TelescopeClientRequestWatcherand the ClientRequestWatcher automatically obfuscates the header and payload depending on what is set on the TelescopeServiceProviderhideSensitiveRequestDetailsmethod. This is my customTelescopeLoggingMiddlewareandhideSensitiveRequestDetailsfor better context.JonPurvis commentedon Mar 28, 2026
Hey @Horlerdipo
Thanks for the report.
I've just pushed saloonphp/laravel-plugin#82 to the laravel plugin repo and tested it on an app I spun up via Herd
Would you be able to pull that branch down and test on your app please?
Thanks!
Horlerdipo commentedon Mar 28, 2026
Yes, sure. I'll do that and let you know in a couple of hours.
JonPurvis commentedon Mar 28, 2026
Great, thanks! If you're happy with it, I'll tag and release a new version of this package.
Horlerdipo commentedon Mar 31, 2026
Hi @JonPurvis , I was able to test that PR and it worked fine. It is good to go.
Thanks for your help.
JonPurvis commentedon Mar 31, 2026
Awesome, thanks for confirming! I'll get my PR merged after work this evening (~6 hours) and tag a new release.
JonPurvis commentedon Mar 31, 2026
Merged and tagged!
Sammyjo20 commentedon Apr 3, 2026
Thanks @JonPurvis - you legend!
JonPurvis commentedon Apr 3, 2026
Happy to help! 🤠