Skip to content
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

Wrap IllegalArgumentException thrown by Base64 decoder #936

Merged

Commits on Apr 9, 2024

  1. Wrap IllegalArgumentException thrown by Base64 decoder

    Some time ago, there had been `net.schmizz.sshj.common.Base64`. This class used to throw `IOException` in case of any problem. Although `IOException` isn't an appropriate class for indicating on parsing issues, a lot of code has been expecting `IOException` from Base64.
    
    Once, the old Base64 decoder was replaced with the one, bundled into Java 14 (see f35c2bd). Copy-paste elimination and switching to standard implementations is undoubtedly a good decision.
    
    Unfortunately, `java.util.Base64.Decoder` brought a pesky issue. It throws `IllegalArgumentException` in case of any problem. Since it is an unchecked exception, it was quite challenging to notice it. It's especially challenging because the error appears during processing malformed base64 strings. So, a lot of places in the code kept expecting `IOException`. Sudden `IllegalArgumentException` led to authentication termination in cases where everything used to work perfectly.
    
    One of such issues is already found and fixed: 03f8b22
    
    This commit represents a work, based on revising every change made in f35c2bd. It should fix all other similar issues.
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    a25e447 View commit details
    Browse the repository at this point in the history
  2. squash! Wrap IllegalArgumentException thrown by Base64 decoder

    Rename Base64DecodeError -> Base64DecodingException
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    0834c09 View commit details
    Browse the repository at this point in the history
  3. squash! Wrap IllegalArgumentException thrown by Base64 decoder

    A better warning message in KnownHostMatchers
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    1df0e48 View commit details
    Browse the repository at this point in the history
  4. squash! Wrap IllegalArgumentException thrown by Base64 decoder

    A better error message in OpenSSHKeyFileUtil
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    4e6ed16 View commit details
    Browse the repository at this point in the history
  5. squash! Wrap IllegalArgumentException thrown by Base64 decoder

    A better error message in OpenSSHKeyV1KeyFile
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    5c054bc View commit details
    Browse the repository at this point in the history
  6. squash! Wrap IllegalArgumentException thrown by Base64 decoder

    Get rid of unnecessary `throws IOException` in Base64Decoder
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    6ad7e1e View commit details
    Browse the repository at this point in the history
  7. squash! Wrap IllegalArgumentException thrown by Base64 decoder

    Better error messages in OpenSSHKeyFileUtil and PuTTYKeyFile
    vladimirlagunov committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    ce1cab2 View commit details
    Browse the repository at this point in the history