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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sigmundd-security

v2.0.0

Published

Sets Headers to a very save style in express-apps. may be overriden by config

Downloads

6

Readme

security

Sets Headers to a very save style. may be overriden by config.

Installation

  • npm install --save sigmundd-security

Usage

const security = require('sigmundd-security')
app.use(security(options))

Options

Headers

This is the List of Header with default values and Option name

| Header | Option | Default Value | | ------- | ------ | ------------- | | Cache-Control | CacheControl | no-cache, no-store, must-revalidate | | Pragma | Pragma | no-cache | | Expires | Expires | 0 | | Content-Security-Policy | ContentSecurityPolicy | default-src 'self'; frame-ancestors 'none' | | X-XSS-Protection | XXSSProtection | 1; mode=block | | X-DNS-Prefetch-Control | XDNSPrefetchControl | off | | Expect-CT | ExpectCT | report-uri="/_report", enforce, max-age=30 | | X-Frame-Options | XFrameOptions | deny | | X-Powered-By | XPoweredBy | true | | Strict-Transport-Security | StrictTransportSecurity | max-age=30 | | X-Download-Options | XDownloadOptions | noopen | | X-Content-Type-Options | XContentTypeOptions | nosniff | | X-Permitted-Cross-Domain-Policies | XPermittedCrossDomainPolicies | none | | Referrer-Policy | ReferrerPolicy | no-referrer |

Allowed Methods

The option allowedMethods is an array of allowed HTTP-Methods.
By Default it is set to ['GET', 'POST', 'PUT', 'DELETE'], dissallowing e.g. HEAD

You may set this Array to whatever you like, we recommend to make it even more restrict if possible.

A read-only API may set allowedMethods: ['GET']

Only Defined Routes

The Option onlyDefinedRoutes may be set to true (Default: false)

Then only explicitely defined Routes are allowed by the express-Router, all other attempts will receive a status 405

To define Routes, use the Option definedRoutes, which expects an Array of Routes. No Wildcard is allowed as this kind of defeats the purpose of this ...

So if you have a route like /items/:id defined, you should add all ids to your array of defined routes ...

Examples

Run these and check with your favorite testing tool, eg nikto, zap

Default

You Should create SSL-Keys first to enable https-example:
openssl req -x509 -newkey rsa:4096 -keyout examples/default/private.key -out examples/default/certificate.crt -days 365 -nodes

node examples/default/index.js

unsave

node examples/unsave/index.js

Author

Dominik Sigmund [email protected]

Contribution

Header

To add header, create a fork, then branch and add the header to:

  • index.js
  • index.test.js
  • README.md

then run tests and mutation tests.

after that, create a pull request and state the function of the header.

Other Functions

Similar as above, just make sure the functions secures the app even more.