nija-at opened a new pull request, #39641:
URL: https://github.com/apache/spark/pull/39641

   ### What changes were proposed in this pull request?
   
   When the `pyspark` REPL is initialized with the `--remote <url>` option,
   the URL provided is logged out to stdout as part of the REPL startup.
   However, it may have auth tokens specified as query parameters.
   
   This change sanitizes the URL by removing all query parameters when
   the URL is logged.
   
   ### Why are the changes needed?
   
   Security best practices require not logging auth tokens to standard
   output or any destination.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Previously -
   
   ```sh
   $ ./bin/pyspark --remote "sc://foo.com/?x=y"
   Python 3.10.8 (main, Nov 24 2022, 08:08:27) [Clang 14.0.6 ] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   Welcome to
         ____              __
        / __/__  ___ _____/ /__
       _\ \/ _ \/ _ `/ __/  '_/
      /__ / .__/\_,_/_/ /_/\_\   version 3.4.0.dev0
         /_/
   
   Using Python version 3.10.8 (main, Nov 24 2022 08:08:27)
   Client connected to the Spark Connect server at sc://foo.com/?x=y
   ```
   
   
   Now -
   
   ```sh
   $ ./bin/pyspark --remote "sc://foo.com/?x=y"
   Python 3.10.8 (main, Nov 24 2022, 08:08:27) [Clang 14.0.6 ] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   Welcome to
         ____              __
        / __/__  ___ _____/ /__
       _\ \/ _ \/ _ `/ __/  '_/
      /__ / .__/\_,_/_/ /_/\_\   version 3.4.0.dev0
         /_/
   
   Using Python version 3.10.8 (main, Nov 24 2022 08:08:27)
   Client connected to the Spark Connect server at sc://foo.com/
   ```
   
   ### How was this patch tested?
   
   New unit tests added.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to