Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the state correctly for temp cache clearance #1339

Merged
merged 2 commits into from Mar 11, 2020

Conversation

sameerag
Copy link
Member

@sameerag sameerag commented Mar 4, 2020

This PR fixes #1333 where the msal-core lib assumes that "state" is always a GUID and does not have a delimiter within itself.

We fixed this by making sure that the guid the msal attaches before sending a request to server is always appended at the beginning and we rectify the split logic to reflect this.

Note: tests will be added before merging this.

@jasonnutter jasonnutter self-assigned this Mar 4, 2020
… delimeter to prevent exhausting cookie length and local storage
@coveralls
Copy link

Coverage Status

Coverage increased (+1.3%) to 74.061% when pulling d492c35 on split-state-for-tempCache into 029e934 on dev.

@jasonnutter
Copy link
Contributor

jasonnutter commented Mar 11, 2020

To summarize: we can take the state string as-is, and remove any local storage values whose key includes the string. Making this logic not dependent on the resource delimiter both solves this bug, but is also future proof if we want to change the format of the state string (which we are considering).

this.setItemCookie(key, "", -1);
this.clearMsalCookie(state);
}
if ((!state || key.indexOf(state) !== -1) && !this.tokenRenewalInProgress(state)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we test end-to-end? Will this pass for concurrent silent calls failing (at the msal-core execution) for any reason?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tested with the React sample. Can you clarify the concern with failing concurrent requests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a concern, I was thinking if there will be any cache based on state we do not want to get rid off, that should not be the case.

@jasonnutter
Copy link
Contributor

Approving on behalf of @sameerag, who can't approve as the original author.

@jasonnutter jasonnutter merged commit b60a788 into dev Mar 11, 2020
@sameerag sameerag deleted the split-state-for-tempCache branch March 18, 2020 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Temporary local storage entries are not cleared when token request has "state" value
5 participants