• AVincentInSpace@pawb.social
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    1 year ago

    Under what circumstance would a web client need to send an Authorization header at all? The browser sends the cookie and the server treats that as equivalent.

    Malicious JavaScript in that case could theoretically forge a request using an auth token it acquired some other way by sending it as Authorization: Bearer in addition to the cookie, but 1) this would be extremely easy to defend against (just check for the cookie before you check the Authorization header) and 2) it would still not allow malicious JS code to access the user’s auth token which was still stored in an HTTP only cookie, or really do anything that server side code (read: script kiddie scripts) couldn’t, apart from sending a request from the web client’s IP address.