Coverity-CWE 922: Insecure Storage of Sensitive Information(localStorage write)
- Coverity fix for localStorage write issue: For storing datas
in browser localStorage so changed it to sessionStorage
Change-Id: Ie35774b610b08e1e412394bd2ec544c013ac8730
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/app/login/LoginComponent.ts b/src/app/login/LoginComponent.ts
index 2f4f67e..06d4f64 100644
--- a/src/app/login/LoginComponent.ts
+++ b/src/app/login/LoginComponent.ts
@@ -103,7 +103,7 @@
userName: ['', [Validators.required]],
password: ['', [Validators.required]]
});
- this.returnUrl = isNullOrUndefined(localStorage.getItem('returnUrl')) ? '/' : localStorage.getItem('returnUrl');
+ this.returnUrl = isNullOrUndefined(sessionStorage.getItem('returnUrl')) ? '/' : sessionStorage.getItem('returnUrl');
}
/**
@@ -122,7 +122,7 @@
this.router.navigate([this.returnUrl]).catch(() => {
// Catch Navigation Error
});
- localStorage.removeItem('returnUrl');
+ sessionStorage.removeItem('returnUrl');
}, (err: HttpErrorResponse) => {
this.isLoadingResults = false;
this.restService.handleError(err, 'post');