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

GH-42: Fix: Middleware overhandling exceptions #44

Merged
merged 12 commits into from
Aug 19, 2024

Commits on Jul 24, 2024

  1. pysnippetGH-42: testscases middleware overhandling excepts

    - Unintended errors in code should be 500
    - Non Http custom exceptions should be 500
    - Handled exceptions should use handler (and be 418 in this case)
    
    But all of them are reported as 401 Unauthorized even
    when the entrypoint does not requires authorization.
    vokimon committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    1cef8b8 View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2024

  1. pysnippetGH-42: Covering jwt cases and modify others

    I added a case of exception that should be handled:
    as auth errors: jwt validation errors
    
    Using same approach as expiration check,
    but maybe it should be a HttpException in order
    to be properly handled both by fastapi and users.
    
    Also unexpected errors are not transformed to
    500 either on the test setup. Maybe because we are
    not using Fastapi TestClient.
    vokimon committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    cb8b445 View commit details
    Browse the repository at this point in the history
  2. pysnippetGH-42: error handling ignores library user code exceptions

    - Removed the generic error handling in __call__()
    - Introduced specific error handling inside authenticate()
      for jwt decoding.
        - One use of jwt is in token generation in core,
          but in this case it won't be a authorization error
          but maybe a configuration one, we should see
          the details in logging or debugging platforms.
    - For sure, other authorization errors caught previously
      as Exception now run on the wild.
      Review required on that.
    vokimon committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    089d648 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2024

  1. pysnippetGH-22: Using starlette like exception handling

    That is:
    - raising starlette.authentication.AuthenticationError
    - providing an on_error callback turning starlet 400 into 401
      to keep same api
    - letting the user provide their own on_error when instantiating
      the middleware.
    vokimon committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    b3ce107 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8c93004 View commit details
    Browse the repository at this point in the history

Commits on Jul 31, 2024

  1. Improve code formatting

    ArtyomVancyan committed Jul 31, 2024
    Configuration menu
    Copy the full SHA
    0041465 View commit details
    Browse the repository at this point in the history
  2. - Fix typing for lower versions of Python interpreter

    - Use `default_on_error` instead of defining new one
    ArtyomVancyan committed Jul 31, 2024
    Configuration menu
    Copy the full SHA
    252c00e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4e2a832 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fea2234 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    00bf9ab View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3a0cc00 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2024

  1. Configuration menu
    Copy the full SHA
    ad31cba View commit details
    Browse the repository at this point in the history