mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch to using base64 encoding of the auth tokens
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
076cf9e1c5
commit
e92304b92e
@ -63,15 +63,7 @@ export class ShellRequestAuthenticator extends Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const authToken = clusterTokens.get(tabId);
|
const authToken = clusterTokens.get(tabId);
|
||||||
const buf = Uint8Array.from(token.split(",").map(ar => {
|
const buf = Uint8Array.from(Buffer.from(token, "base64"));
|
||||||
const res = +ar;
|
|
||||||
|
|
||||||
if (isNaN(res)) {
|
|
||||||
throw new TypeError("Token must be a CSV list of digits");
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (authToken instanceof Uint8Array && crypto.timingSafeEqual(authToken, buf)) {
|
if (authToken instanceof Uint8Array && crypto.timingSafeEqual(authToken, buf)) {
|
||||||
// remove the token because it is a single use token
|
// remove the token because it is a single use token
|
||||||
|
|||||||
@ -89,7 +89,7 @@ export class TerminalApi extends WebSocketApi {
|
|||||||
pathname: "/api",
|
pathname: "/api",
|
||||||
query: {
|
query: {
|
||||||
...this.query,
|
...this.query,
|
||||||
shellToken: authTokenArray.toString(),
|
shellToken: Buffer.from(authTokenArray).toString("base64"),
|
||||||
},
|
},
|
||||||
slashes: true,
|
slashes: true,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user