
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@variablesoftware/mock-d1
Advanced tools
๐๏ธ๐๏ธ๐ง Mock D1 Database implementation for testing Cloudflare Workers
Mock Cloudflare D1 Database for unit and integration testing
๐๏ธ๐๏ธ๐ง @variablesoftware/mock-d1
provides an in-memory simulation of Cloudflare's D1 SQLite-compatible database. It enables fast, isolated, and predictable testing of SQL-backed applications without relying on external services.
pnpm add --dev @variablesoftware/mock-d1
This package assumes a test environment with Vitest and support for ESM.
import { mockD1Database } from "@variablesoftware/mock-d1";
const db = mockD1Database({
sessions: [{ sub: "user-123", jti: "token-abc", created: Date.now() }],
});
const stmt = db.prepare("SELECT * FROM sessions WHERE sub = ?");
stmt.bind("user-123");
const result = await stmt.all();
console.log(result.results); // [{ sub: 'user-123', ... }]
.prepare().bind().all()
and .run()
flow@variablesoftware/logface
SELECT
, INSERT
, UPDATE
, and DELETE
statements.dump()
method for snapshot inspectionD1Result
Tested using vitest run
, with coverage for:
mockD1Database()
with randomized insert/select/delete operations to simulate real query volumeD1Result
Run tests:
pnpm test
This package is under active development and not yet stable.
Once stable, it will be published as:
"@variablesoftware/mock-d1": "^0.5.0"
MIT ยฉ Rob Friedman / Variable Software
Built with โค๏ธ by @variablesoftware
Thank you for downloading and using this project. Pull requests are warmly welcomed!
FAQs
๐๏ธ๐๏ธ๐ง Mock D1 Database implementation for testing Cloudflare Workers
The npm package @variablesoftware/mock-d1 receives a total of 142 weekly downloads. As such, @variablesoftware/mock-d1 popularity was classified as not popular.
We found that @variablesoftware/mock-d1 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socketโs new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.