Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Restrict auth issuer period cleanup

Manav Rathi9baa351c6db3
diff --git a/web/apps/auth/src/services/code.ts b/web/apps/auth/src/services/code.ts
index c974fda9f1..d4f97c7b57 100644
--- a/web/apps/auth/src/services/code.ts
+++ b/web/apps/auth/src/services/code.ts
@@ -193,9 +193,12 @@ const parseIssuer = (url: URL, path: string): string => {
let issuer = url.searchParams.get("issuer");
if (issuer) {
// This is to handle bug in old versions of Ente Auth app.
- const periodIndex = issuer.indexOf("period=");
- if (periodIndex >= 0) {
- issuer = issuer.substring(0, periodIndex);
+ const periodSuffixIndex = issuer.search(/&?period=\d+$/);
+ if (
+ periodSuffixIndex > 0 &&
+ !/\s/.test(issuer.charAt(periodSuffixIndex - 1))
+ ) {
+ issuer = issuer.substring(0, periodSuffixIndex);
}
if (issuer.endsWith("period")) {
issuer = issuer.substring(0, issuer.length - 6);