Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Further refinement to handle malformed cookies. (Specifically missing…
Browse files Browse the repository at this point in the history
… "=" delimiter.)
  • Loading branch information
Eric Chevalier committed Jul 30, 2020
1 parent b1a292f commit 20ad978
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/rest/src/session/AbstractSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,16 @@ export abstract class AbstractSession {
// see each field in the cookie, e/g. Path=/; Secure; HttpOnly; LtpaToken2=...
authArr.forEach((element: string) => {
// if element begins with tokenType, extract full tokenType and tokenValue.
if (element.indexOf(this.mISession.tokenType) === 0) {
if (element.indexOf(this.ISession.tokenType) === 0) {
// parse off token value, splitting element at first "=".
const split = element.indexOf("=");
this.ISession.tokenType = element.substring(0, split);
this.ISession.tokenValue = element.substring(split + 1);
if (split >= 0) {
this.ISession.tokenType = element.substring(0, split);
this.ISession.tokenValue = element.substring(split + 1);
}
else {
this.ISession.tokenValue = "";
}
}
});
});
Expand Down

0 comments on commit 20ad978

Please sign in to comment.