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

@oxog/praxis-security

v1.0.0

Published

Security features for Praxis framework - CSP, XSS protection, sanitization, and more

Readme

Praxis Security

Enterprise-grade security features for Praxis applications.

Installation

npm install @oxog/praxis-security

Features

Content Security Policy (CSP)

import { createCSP } from '@oxog/praxis-security';

const csp = createCSP({
  defaultSrc: ["'self'"],
  scriptSrc: ["'self'", "'unsafe-inline'"],
  styleSrc: ["'self'", "'unsafe-inline'"],
  imgSrc: ["'self'", "data:", "https:"],
  reportUri: '/csp-report'
});

// Apply CSP
app.use(csp.middleware());

XSS Protection

import { sanitize, escapeHtml } from '@oxog/praxis-security';

// Sanitize HTML
const clean = sanitize(userInput);

// Escape HTML entities
const escaped = escapeHtml(userInput);

Trusted Types

import { enableTrustedTypes } from '@oxog/praxis-security';

// Enable Trusted Types API
enableTrustedTypes({
  createPolicy: true,
  defaultPolicy: 'praxis-default'
});

Input Validation

import { validate } from '@oxog/praxis-security';

const schema = {
  email: { type: 'email', required: true },
  age: { type: 'number', min: 18, max: 100 },
  username: { type: 'string', pattern: /^[a-zA-Z0-9_]+$/ }
};

const errors = validate(userInput, schema);

CSRF Protection

import { csrf } from '@oxog/praxis-security';

// Generate token
const token = csrf.generate();

// Verify token
const isValid = csrf.verify(token);

Rate Limiting

import { rateLimit } from '@oxog/praxis-security';

const limiter = rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 100, // limit each IP to 100 requests per windowMs
  message: 'Too many requests'
});

Secure Headers

import { secureHeaders } from '@oxog/praxis-security';

app.use(secureHeaders({
  hsts: {
    maxAge: 31536000,
    includeSubDomains: true,
    preload: true
  },
  noSniff: true,
  xssFilter: true,
  referrerPolicy: 'strict-origin-when-cross-origin'
}));

Configuration

import { configureSecurity } from '@oxog/praxis-security';

configureSecurity({
  // Global settings
  enableCSP: true,
  enableTrustedTypes: true,
  enableSanitization: true,
  
  // CSP settings
  csp: {
    reportOnly: false,
    directives: {
      defaultSrc: ["'self'"]
    }
  },
  
  // Sanitization settings
  sanitizer: {
    allowedTags: ['b', 'i', 'em', 'strong', 'a'],
    allowedAttributes: {
      'a': ['href']
    }
  }
});

Best Practices

  1. Always sanitize user input before rendering
  2. Use CSP headers to prevent XSS attacks
  3. Enable Trusted Types for DOM manipulation
  4. Validate all inputs on both client and server
  5. Implement rate limiting for API endpoints
  6. Use secure headers for all responses

Security Checklist

  • [ ] CSP headers configured
  • [ ] Input sanitization enabled
  • [ ] Trusted Types enabled
  • [ ] CSRF protection active
  • [ ] Rate limiting configured
  • [ ] Secure headers set
  • [ ] HTTPS enforced
  • [ ] Sensitive data encrypted

License

MIT