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

@webklex/sinker

v1.1.0

Published

Minimalistic security tool to scan for dangerous sinks (XSS, data leakage) in codebases.

Readme

Sinker

License: MIT Hits Snyk

Sinker is a minimalistic security tool designed to scan your codebase for potentially dangerous "sinks" (e.g., document.URL, innerHTML, localStorage) that could lead to vulnerabilities like DOM XSS or data leakage.

Designed for modern web development, Sinker integrates seamlessly into CI/CD pipelines to alert developers of unprotected sinks before they reach production.

Table of Contents

Features

  • Recursive Scanning: Automatically scans .ts, .js, .html, and other relevant files.
  • ESLint Plugin: Use it as a real-time linter for better IDE integration.
  • Highly Customizable: Load project-specific sinks and sources via a configuration file.
  • Safe Bypassing: Explicitly flag intentional usage of sinks as safe with inline comments.
  • CI Ready: Returns non-zero exit codes on violations, making it perfect for automated security gates.
  • Contextual Reports: See the exact line and surrounding code for every finding.

Quick Start

Installation

CLI Tool

# Using npm
npm install @webklex/sinker --save-dev

ESLint Plugin

Please take a look at the ESLint Plugin README for detailed information.

Usage

CLI

Run a scan on your project:

npx sinker .

ESLint

Add the plugin to your eslint.config.js (Flat Config):

const sinkerPlugin = require('@webklex/sinker/eslint-plugin');

module.exports = [
    {
        files: ['**/*.js', '**/*.ts'],
        plugins: {
            sinker: sinkerPlugin,
        },
        rules: {
            'sinker/no-sink': ['warn', { contextDepth: 10 }],
        },
    },
];

Or use the recommended configuration:

const sinkerPlugin = require('@webklex/sinker/eslint-plugin');

module.exports = [sinkerPlugin.configs.recommended];

CLI Options

| Option | Description | | :------------------ | :------------------------------------------------- | | target | Path to a file or directory to scan (default: .) | | -nc, --no-color | Disable colored output | | -m, --minimal | Minimal output format | | --context-depth=N | Number of context lines to show (overrides config) | | -h, --help | Show help message |

Example:

npx sinker src --context-depth=5 --no-color

Configuration

Sinker looks for a sinker.config.js file in your project root.

Example sinker.config.js

module.exports = {
    // Define custom sinks to watch for
    sinks: [
        {
            name: 'CUSTOM_STORAGE',
            description: 'Potential sensitive data leakage to custom storage',
            link: 'https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage',
            displayContextBefore: true,
            displayContextAfter: true,
            sinks: ['myApp.storage.set'],
        },
    ],
    // Ignore specific built-in sinks
    ignoredSinks: ['document.URL'],
    // Paths to exclude from scanning
    ignored: [
        '**/node_modules/**',
        '**/dist/**',
        '**/coverage/**',
        '**/*.test.ts',
        '**/*.spec.ts',
    ],
    colors: true,
    minimal: false,
    contextDepth: 3,
};

Configuration Options

  • sinks (Array): Custom sink definitions.
  • ignoredSinks (String[]): List of sink names/patterns to ignore globally.
  • ignored (String[]): Glob patterns for files or directories to skip.
  • colors (Boolean): Toggle colored output.
  • minimal (Boolean): Minimal output format.
  • contextDepth (Number): Number of lines of context to display around violations.

Suppressing Findings

If a sink usage is intentional and properly protected (e.g., sanitized with DOMPurify), you can suppress the alert by adding a @safe-sink comment on the line immediately preceding the sink.

JavaScript / TypeScript

// @safe-sink: Content is sanitized via DOMPurify
element.innerHTML = sanitizedContent;

HTML

<!-- @safe-sink: URL is validated against an allowlist -->
<script>
    const url = document.URL;
</script>

Contributing

Adding Default Sinks

To contribute to the built-in sink definitions:

  1. Create a new definition file in src/sinks/ (e.g., src/sinks/framework_sinks.ts):
    import { Sink } from './types';
    export const frameworkSinks: Sink = {
        name: 'Framework Sinks',
        description: 'Dangerous sinks specific to X framework.',
        link: 'https://example.com/security-docs',
        displayContextBefore: true,
        displayContextAfter: true,
        sinks: ['X.unsafeMethod'],
    };
  2. Register it in src/sinks/index.ts:
    import { frameworkSinks } from './framework_sinks';
    export const allSinkGroups: Sink[] = [
        // ... existing groups
        frameworkSinks,
    ];

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Generate coverage report
npm run test:coverage

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Inspiration

License

The MIT License (MIT). Please see License File for more information.