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

@creadev.org/security

v0.3.1

Published

Shared security utilities - rate limiting, input sanitization, WAF, validation

Downloads

424

Readme

@creadev.org/security

Security utilities shared between weisync, migrare, Threadforge, and other projects.

npm License: MIT

Install

npm install @creadev.org/security

Usage

Rate Limiting

import { RateLimiter } from '@creadev.org/security';

const limiter = new RateLimiter({ maxRequests: 30, windowMs: 60000 });

// Check if request is allowed
const result = limiter.check('user-id');
if (!result.allowed) {
  console.log(`Retry after ${result.retryAfter}ms`);
}

Firewall (Input Validation)

import { firewall, createFirewall } from '@creadev.org/security';

// Use default firewall instance
const result = firewall.process(userInput, { type: 'text' });
if (!result.safe) {
  console.log('Input blocked:', result.threats);
}

// Or create custom firewall
const custom = createFirewall({ 
  threatAction: 'log',
  logLevel: 'debug' 
});
const customResult = custom.process(userInput, { type: 'html' });

Input Sanitization

import { sanitizePath, sanitizeUrl, sanitizeFilename } from '@creadev.org/security';

sanitizePath('../../etc/passwd');  // null (blocked)
sanitizeUrl('javascript:alert(1)');    // null (blocked)
sanitizeFilename('my file.txt');       // 'my-file.txt' (safe)

Validators

import { secureValidators, securityConfig } from '@creadev.org/security';

// Check format
secureValidators.email('[email protected]'); // { valid: true }
secureValidators.uuid('550e8400-…');         // { valid: true }
secureValidators.positiveInt('42');           // { valid: true }

// Get security config
securityConfig.isEnabled();    // true
securityConfig.getLogLevel();  // 'warn'
securityConfig.getStatus();    // { enabled, logLevel, … }

API

Rate Limiter

| Method | Description | |-------|-------------| | new RateLimiter(opts) | Create limiter with maxRequests, windowMs, cleanupIntervalMs | | limiter.check(key) | Check if request allowed, returns { allowed, remaining, retryAfter } | | limiter.reset(key) | Reset limiter for key | | limiter.resetAll() | Reset all limiters |

Firewall

| Method | Description | |-------|-------------| | firewall.process(input, opts) | Process input, returns FirewallResult | | createFirewall(config?) | Create custom firewall instance | | isAreaActive(area) | Check if area is active |

FirewallResult

interface FirewallResult {
  safe: boolean;
  original: string;
  sanitized: string;
  threats: Threat[];
  firewallEnabled: boolean;
  whitelisted: boolean;
  action: 'allowed' | 'blocked' | 'sanitized' | 'log';
  meta: { processedAt, inputLength, outputLength, truncated, area? };
}

Validators

| Function | Description | |----------|-------------| | secureValidators.email(input) | Validate email format | | secureValidators.url(input) | Validate URL format | | secureValidators.uuid(input) | Validate UUID format | | secureValidators.filename(input) | Validate filename (no path traversal) | | secureValidators.positiveInt(input) | Validate positive integer |

Types

import type { 
  Threat, 
  ThreatLevel, 
  ThreatCategory,
  InputType,
  FirewallConfig,
  FirewallResult,
} from '@creadev.org/security';

License

MIT