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

tekivex-security-core

v0.1.2

Published

Security kernel for web apps — XSS, Unicode Trojan Source, CSP, PII, clickjacking, rate-limit, MIME-sniff defenses. Framework-agnostic. Pure TypeScript, zero runtime deps.

Readme

tekivex-security-core

The security kernel extracted from tekivex-ui. Framework-agnostic. Zero runtime dependencies. Pure TypeScript.

npm MIT types

If you ship web code, you defend against XSS, CSP gaps, DOM clobbering, Unicode Trojan Source, clickjacking, prototype pollution, MIME confusion, PII leakage, and rate-limit abuse. tekivex-security-core gives you one small, audited module to do all of that.

npm i tekivex-security-core

Works with React, Vue, Svelte, Solid, vanilla TS, Node, Deno, Bun, Cloudflare Workers.


Quick start

import {
  sanitizeHref,
  sanitizeHTML,
  sanitizeUnicode,
  scrubPII,
  buildTkxCSP,
  createRateLimiter,
  isFramed,
  installFrameBuster,
  deepFreeze,
} from 'tekivex-security-core';

// Block dangerous URL schemes
sanitizeHref('javascript:alert(1)');   // → null
sanitizeHref('https://example.com');   // → 'https://example.com'

// Neutralise Unicode Trojan Source (CVE-2021-42574)
sanitizeUnicode('admin\u202E\u2066 evil');  // → 'admin evil'

// Redact PII before logging
scrubPII('call 415-555-0100 or email [email protected]');
// → 'call [PHONE] or email [EMAIL]'

// Build a Content-Security-Policy header
buildTkxCSP({ nonce: 'r4nd0m', strict: true });
// → "default-src 'self'; frame-ancestors 'none'; ..."

// Token-bucket rate limiter
const limiter = createRateLimiter(3, 2000); // 3 per 2s
if (limiter.take('form-submit')) { /* allowed */ }

// Clickjacking defense
if (isFramed()) { /* we're in an iframe — react accordingly */ }
installFrameBuster(() => location.href = '/security-notice');

// Prototype pollution prevention
const config = deepFreeze({ api: { key: '...' } });

What it defends against

Each export maps to a specific attack class. Full threat model is published at SECURITY-THREAT-MODEL.md.

| Function | Defeats | Reference | |---|---|---| | sanitizeHref | XSS via javascript: / data: / vbscript: URLs | OWASP XSS Prevention | | sanitizeHTML | HTML injection, stored XSS | OWASP XSS | | sanitizeCSS | CSS expression() / url(javascript:) | CWE-79 | | sanitizeJSON | Prototype pollution via __proto__ / constructor | CWE-1321 | | sanitizeUnicode | Bidi-override Trojan Source | CVE-2021-42574 | | isSafeAttrName | DOM clobbering via name="cookie" etc. | CWE-79 | | buildTkxCSP | Framing, inline-script XSS, mixed content | CSP Level 3 | | installTrustedTypes | DOM XSS via sink bypass | W3C Trusted Types | | isFramed, installFrameBuster | Clickjacking | OWASP Clickjacking | | createRateLimiter | Brute force, credential stuffing | CWE-307 | | sniffMimeType | MIME-type confusion | OWASP File Upload | | scrubPII | Accidental PII in logs / errors | GDPR / CCPA | | deepFreeze | Prototype pollution, config tampering | CWE-1321 | | audit + verifyAuditIntegrity | Tamper-evident security log | NIST SP 800-92 |

Zero dependencies

tekivex-security-core does not import anything. Not even a polyfill. This is deliberate:

  • Every npm install of your app installs exactly one new file
  • No transitive-dependency supply-chain risk (xz backdoor, colors.js, etc.)
  • Runs anywhere ES2020 runs — browser, Node, Workers, Deno, Bun, React Native

Bundle impact

index.js   ~7 KB min
index.cjs  ~7 KB min
         0 runtime deps

License

MIT © tekivex-ui contributors