-
Notifications
You must be signed in to change notification settings - Fork 316
Closed
Labels
bugThis points to a verified bug in the codeThis points to a verified bug in the code
Description
Checklist
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
mergeHeaders and mergeOnlyDefinedHeaders in
| export function mergeHeaders<THeaderValue>( |
In addition to this, a caller can set for e.g. Authorization: null, which is treated as a deleted header. for e.g.
let _headers = mergeHeaders(
this._options?.headers, // 1) global
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }), // 2) SDK auth
requestOptions?.headers, // 3) per-request
);
...
client.keys.customSigning.get({ headers: { Authorization: null } });
...
client.keys.customSigning.get({ headers: { authorization: "Basic attacker" } });
Reproduction
const defaults = { Authorization: "Bearer sdk-token" };
const user = { authorization: "Basic attacker" }; // different case
const merged = mergeHeaders(defaults, user);
// merged now has both keys:
// { Authorization: "Bearer sdk-token", authorization: "Basic attacker" }
// Downstream client will normalize and one wins.
Additional context
No response
node-auth0 version
latest
Node.js version
latest
Metadata
Metadata
Assignees
Labels
bugThis points to a verified bug in the codeThis points to a verified bug in the code