Skip to content

Getting a 500 error when sending a malformed base64 encoded basic auth header. #3713

Description

@Sxmindu

Description

In MGW when invoking APIs using malformed base64 encoded basic auth header, the server returns a 500 instead of a 401.

Steps to Reproduce

  1. First hosted an API by following [1].
  2. Before deploying the API in the Micro-Gateway runtime, Configured the WSO2 API Microgateway for Basic Authentication using [2].
  3. Then invoke the https://localhost:9095/petstore/v1/pet/1 using postman by adding Authorization : Basic YWRtaW46YWRtaW4=. This returned a 200 OK reponse. YWRtaW46YWRtaW4=1 is Base64(admin:admin).
  4. Then invoke the https://localhost:9095/petstore/v1/pet/1 again using postman by adding Authorization : Basic YWRtaW46YWRtaW4=1 (malformed basic auth). This returned a 500 Internal Server Error with the below reponse:

[1] : https://mg.docs.wso2.com/en/latest/how-tos/adding-apis/using-an-openapi-definition/
[2] : https://mg.docs.wso2.com/en/latest/how-tos/security/api-authentication/basic-authentication/

Version

WSO2 Microgateway 3.2.0

Environment Details (with versions)

No response

Relevant Log Output

Related Issues

No response

Suggested Labels

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions