Skip to content

Sensitive Parameters not being obfuscated for Laravel Telescope #544

Closed
saloonphp/laravel-plugin
#82

Description

@Horlerdipo

(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.

Image Image

Activity

  1. Horlerdipo commented on Mar 26, 2026

    @Horlerdipo
    Author

    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',
            ]);
        }
    
  2. JonPurvis commented on Mar 28, 2026

    @JonPurvis
    Contributor

    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

    Image

    Would you be able to pull that branch down and test on your app please?

    Thanks!

  3. Horlerdipo commented on Mar 28, 2026

    @Horlerdipo
    Author

    Yes, sure. I'll do that and let you know in a couple of hours.

  4. JonPurvis commented on Mar 28, 2026

    @JonPurvis
    Contributor

    Great, thanks! If you're happy with it, I'll tag and release a new version of this package.

  5. Horlerdipo commented on Mar 31, 2026

    @Horlerdipo
    Author

    Hi @JonPurvis , I was able to test that PR and it worked fine. It is good to go.
    Thanks for your help.

  6. JonPurvis commented on Mar 31, 2026

    @JonPurvis
    Contributor

    Awesome, thanks for confirming! I'll get my PR merged after work this evening (~6 hours) and tag a new release.

  7. JonPurvis commented on Mar 31, 2026

    @JonPurvis
    Contributor

    Merged and tagged!

  8. Sammyjo20 commented on Apr 3, 2026

    @Sammyjo20
    Member

    Thanks @JonPurvis - you legend!

  9. JonPurvis commented on Apr 3, 2026

    @JonPurvis
    Contributor

    Happy to help! 🤠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions