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/layouts/header/HeaderComponent.ts b/src/app/layouts/header/HeaderComponent.ts
index b496ff1..f90b5b6 100644
--- a/src/app/layouts/header/HeaderComponent.ts
+++ b/src/app/layouts/header/HeaderComponent.ts
@@ -85,7 +85,7 @@
/** Lifecyle Hooks the trigger before component is instantiate @public */
public ngOnInit(): void {
- this.isAdmin = (localStorage.getItem('isAdmin') === 'true') ? true : false;
+ this.isAdmin = (sessionStorage.getItem('isAdmin') === 'true') ? true : false;
this.selectedProject = this.authService.ProjectName;
this.authService.ProjectName.subscribe((projectNameFinal: string): void => {
this.getSelectedProject = projectNameFinal;
@@ -94,7 +94,7 @@
this.projectService.setHeaderProjects();
this.projectList$ = this.projectService.projectList;
this.PACKAGEVERSION = environment.packageVersion;
- const getLocalStorageVersion: string = localStorage.getItem('osmVersion');
+ const getLocalStorageVersion: string = sessionStorage.getItem('osmVersion');
if (getLocalStorageVersion === null) {
this.showNewVersion();
} else if (getLocalStorageVersion !== this.sharedService.osmVersion) {
@@ -115,7 +115,7 @@
/** Close Version and add in local storage @public */
public closeVersion(): void {
this.toShowNewTag = false;
- localStorage.setItem('osmVersion', this.sharedService.osmVersion);
+ sessionStorage.setItem('osmVersion', this.sharedService.osmVersion);
}
/** Implementation of model for UserSettings options.@public */