Skip to content

API key from header appears in error message #4246

Closed

Description

@maggie44

Describe the bug

I am catching the error responses from Axios when a request fails. I then use the error request to create logs, log to console or return to the browser. In many of these instances the error contains axios.defaults.headers.common.Authorization set before the request. I started going through deleting them before logging, but they are all over in the response and request, and {config} with the response and request. So far I have:

obj.config.headers.Authorization
obj.request._header
obj.response.request._header
obj.request._currentRequest._header

Likely more, but have stopped looking.

Ideally there would be a way to clean this up automatically so the outputs are safe to use anywhere.

To Reproduce

Any failed request

Expected behavior

Remove the Authorisation headers so error message can be used safely, with option to include them for debug.

Environment

  • Axios Version [0.24.0]

Activity

  1. github-actions commented on Nov 4, 2021

    @github-actions
    Contributor

    Hello! 👋

    This issue is being automatically closed because it does not follow the issue template. Please read the issue template carefully and follow all of the instructions when opening a new issue.

    Thanks

  2. maggie44 commented on Nov 4, 2021

    @maggie44
    Author

    Maybe a little over zealous by the bot. Not much here to add to JSFiddle or the like. It could potential come under a feature request, but showing Authorisation headers seems like a bug to me.

  3. shawnsparks-work commented on Aug 15, 2022

    @shawnsparks-work
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