---
title: Javascript – Avoid Use Of Local Storage On Catalog Client Scripts
description: "Impact Area Security             Severity High             Affected Element Client Script Widget Widget Angular Provider UI Script       ## Rule number **SN-0161** ## Impact Session storage and local…"
url: "https://community-staging.qualityclouds.com/qcdocs/qc/javascript-rules-rules-for-servicenow/javascript-avoid-use-of-local-storage-on-catalog-client-scripts/"
updated: "2025-03-21"
category: Rules for ServiceNow / JavaScript Rules
---

# Javascript – Avoid Use Of Local Storage On Catalog Client Scripts

Impact Area

Security

 

 

 

 

 

 

Severity

High

 

 

 

 

 

 

Affected Element

Client Script

Widget

Widget Angular Provider

UI Script

 

 

 

## Rule number

**SN-0161**

## Impact

Session storage and local storage are HTML 5 features which allow developers to easily store megabytes of data client-side, as opposed to the 4Kb cookies can accommodate. While useful to speed applications up on the client side, it can be dangerous to store sensitive information this way because the data is not encrypted by default and any script on the page may access it.

## Remediation

Avoid use of local storage in all client side code.

### Time to fix

45 min

## References

This rule is linked to [Common Weakness Enumeration CWE-539 Information Exposure Through Persistent cookies](https://cwe.mitre.org/data/definitions/539.html).

## Code examples

## Code examples

### Noncompliant code

localStorage.setItem(“login”, login); // NoncompliantsessionStorage.setItem(“sessionId”, sessionId); // Noncompliant

### Compliant code

//Store sensitive data on the server side only.
