npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@floatingsidewal/bulkhead-core

v0.3.0

Published

Cascading content protection engine — PII detection, secret scanning, prompt injection defense

Downloads

144

Readme

@floatingsidewal/bulkhead-core

Cascading content protection engine -- detects and redacts PII, secrets, prompt injection, and system prompt leakage in text before it reaches LLMs.

Part of the Bulkhead project.

Install

Then install:

npm install @floatingsidewal/bulkhead-core

Quick Start

import { createEngine } from "@floatingsidewal/bulkhead-core";

const engine = createEngine();

// Fast regex-only scan (sub-millisecond)
const result = await engine.analyze("My SSN is 123-45-6789 and key is AKIAIOSFODNN7EXAMPLE");

console.log(result.passed);      // false
console.log(result.detections);   // [{ entityType: "US_SSN", ... }, { entityType: "AWS_ACCESS_KEY", ... }]

// Scan and redact
const redacted = await engine.scan("Call me at 555-867-5309");
console.log(redacted.redactedText); // "Call me at [REDACTED-US_PHONE]"

What It Detects

| Category | Coverage | |----------|----------| | PII | 45+ entity types across 20+ countries (SSN, credit cards, IBAN, phone, email, medical IDs, national IDs) | | Secrets | 154 patterns across 13 categories (AWS, Azure, GCP, GitHub, Slack, Stripe, database credentials, private keys) | | Prompt Injection | 16+ patterns (role-play attacks, DAN mode, instruction override) | | System Prompt Leakage | 7+ patterns (prompt extraction, "repeat everything above") |

All structured patterns include checksum validation where applicable (Luhn, IBAN mod-97, Verhoeff).

Configuration

import { createEngine, type BulkheadConfig } from "@floatingsidewal/bulkhead-core";

const engine = createEngine({
  enabled: true,
  debounceMs: 500,
  guards: {
    pii: { enabled: true },
    secret: { enabled: true },
    injection: { enabled: true },
    contentSafety: { enabled: false },
  },
  cascade: {
    modelEnabled: false,       // Enable BERT layer (see below)
    escalationThreshold: 0.75,
    contextSentences: 3,
    modelId: "Xenova/bert-base-NER",
  },
});

Custom Guard Composition

For fine-grained control, compose guards directly:

import { GuardrailsEngine, PiiGuard, SecretGuard } from "@floatingsidewal/bulkhead-core";

const engine = new GuardrailsEngine();
engine.addGuard(new PiiGuard());
engine.addGuard(new SecretGuard());
// Skip injection/leakage guards if not needed

BERT Layer (Optional)

The regex layer catches structured patterns. For contextual entities like names, locations, and organizations, enable the BERT layer:

npm install @huggingface/transformers
const engine = createEngine({
  // ...
  cascade: {
    modelEnabled: true,  // Enables BERT NER model
    // ...
  },
});

// Use deepScan for full cascade (regex + BERT + optional LLM)
const result = await engine.deepScan("Send the report to John Smith at Acme Corp");

// Or modelScan for regex + BERT only (no LLM)
const result = await engine.modelScan(text);

The BERT model (~29 MB) downloads on first inference and runs in a worker thread. No GPU required.

API

createEngine(config?)

Creates a configured engine from a BulkheadConfig. Returns a GuardrailsEngine.

engine.analyze(text)

Layer 1 only (regex). Sub-millisecond. Returns { passed, detections, stats }.

engine.scan(text)

Layer 1 scan with redaction. Returns { passed, detections, redactedText, stats }.

engine.modelScan(text)

Regex + BERT (Layers 1-2). Requires cascade.modelEnabled: true.

engine.deepScan(text)

Full cascade (Layers 1-3). Requires cascade configuration.

engine.dispose()

Cleanup (terminates BERT worker thread if running).

Documentation

See the full documentation for architecture details, deployment guides, and API reference.

License

MIT