Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
jsonVerse is a lightweight JSON-based database package for Node.js. It provides a simple interface to store, retrieve, and manage data using JSON files.
jsonVerse is a lightweight JSON-based database package for Node.js. It provides a simple interface to store, retrieve, and manage data using JSON files.
To install jsonVerse, use the following command:
npm install jsonverse
// Import required modules and setup express router
const express = require("express");
const router = express.Router();
const jsonVerse = require("jsonVerse");
// Initialize the JSONDatabase instance
const db = new jsonVerse("./path/to/your/data/folder"); // add the path to the data folder for example "./Data"
// Display all the website data
router.get("/", async (req, res) => {
try {
const allData = await db.getAllData(); // getAllData is used if you have multiple json files andd you want to show them all
// ... (rendering logic)
} catch (err) {
// ... (error handling)
}
});
// Add data
router.post("/add", async (req, res) => {
try {
const { dataName, name, social, rank, competition, date, edu } = req.body; // here you have to add the dataName which is where you want to save the data in the json files you have, here i store the name of the dataName from the UI (User interface - Front end)
// dataName is where you want to add the data (the json file)
// the data that you will store from the front end and save in the database
const newData = {
social,
name,
rank,
competition,
date,
edu,
}; // whatever the data you want to receive from the front end form
await db.addData(dataName, newData);
// ... (redirect or response)
} catch (err) {
// ... (error handling)
}
});
// Get data by ID
router.get("/:id", async (req, res) => {
const id = req.params.id;
try {
const result = await db.findDataById(id);
if (result) {
// ... (rendering logic)
} else {
// ... (not found logic)
}
} catch (err) {
// ... (error handling)
}
});
// Delete data by ID
router.delete("/:id", async (req, res) => {
const id = req.params.id;
try {
await db.deleteDataById(id);
// ... (response or redirect)
} catch (err) {
// ... (error handling)
}
});
// Edit data by ID
app.post("/edit/:id", async (req, res) => {
const id = req.params.id;
const { name, social, rank, competition, date, edu } = req.body;
try {
const existingData = await db.findDataById(id);
const updatedData = {
social,
name,
rank,
competition,
date,
edu,
}; // whatever the data you want to receive from the front end form
await db.editDataById(id, updatedData)
// ... (response or redirect)
} catch (err) {
// ... (error handling)
}
});
FAQs
jsonVerse is a lightweight JSON-based database package for Node.js. It provides a simple interface to store, retrieve, and manage data using JSON files.
We found that jsonverse demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.