Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
localstorage-migrator
Advanced tools
This is a library for handling migrations of local storage. It is similar to DbUp. It uses rstolsmark-json-migrator for handling the migration logic.
npm i localstorage-migrator
A migration is an object that consist of two items:
Example:
import * as migrator from "localstorage-migrator";
const migrations = [
{
name: "delta1",
up: () => {
localStorage.setItem(
"hei",
JSON.stringify({
hei: "1"
})
);
}
},
{
name: "delta2",
up: () => {
var object = JSON.parse(localStorage.getItem("hei") as string);
object.num = 2;
localStorage.setItem("hei", JSON.stringify(object));
}
},
{
name: "delta3",
up: () => {
var object = JSON.parse(localStorage.getItem("hei") as string);
object.num++;
localStorage.setItem("hei", JSON.stringify(object));
}
}
];
/* This would typically be called in some startup method
before local storage is accessed by other code. */
export function runMigrations() : void {
migrator.migrate(migrations);
}
An example project can be found on GitHub: https://github.com/ragnarstolsmark/migratortest
The migrate method takes a an array of migrations, filters them by those who have already been applied and executes them in sequence. The applied migrations is then stored in local storage under a key called: "appliedMigrations".
This returns an array of those appliedMigrations that have been stored in local storage. They are returned in the order they was applied. An appliedMigration consist of:
This takes an array of appliedMigration objects and stores them in local storage. This can work like a reset method when calling it with an empty array.
FAQs
A library for applying migrations to localstorage.
The npm package localstorage-migrator receives a total of 180 weekly downloads. As such, localstorage-migrator popularity was classified as not popular.
We found that localstorage-migrator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.