Npm Supply Chain Security

v1.0.0

Help secure JavaScript projects by detecting malicious npm packages, enforcing trusted publishing, verifying releases, and auditing dependencies for threats.

0· 12·0 current·0 all-time
MIT-0
Download zip
LicenseMIT-0 · Free to use, modify, and redistribute. No attribution required.
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name/description (npm supply-chain security) match the content of SKILL.md: guidance, heuristics, and example scripts for verifying releases, configuring trusted publishing, and auditing dependencies. Nothing required by the skill (no env vars, no installs) is disproportionate to that purpose.
Instruction Scope
Runtime instructions and code examples only access npm registry and GitHub APIs and read package.json for local audits — all relevant to the stated purpose. The examples do not instruct reading unrelated system files or exfiltrating data to unknown endpoints.
Install Mechanism
No install spec or executable downloads are present (instruction-only). This minimizes disk footprint and reduces install-time risk.
Credentials
The skill declares no required environment variables or credentials. Examples reference typical tokens (NODE_AUTH_TOKEN, short-lived tokens) appropriate for publishing workflows; nothing asks for unrelated secrets or broad credentials.
Persistence & Privilege
always is false and the skill does not request persistent system privileges or modify other skills. There is no evidence it attempts to persist credentials or alter agent-wide settings.
Assessment
This skill appears coherent and aligned with its stated purpose, but the package comes from an unknown source with no homepage — so do not run any example scripts or CI steps verbatim without review. Before using: (1) inspect and test Python/JS snippets in a sandbox, (2) ensure any tokens used are scoped and short-lived (least privilege), (3) prefer GitHub Actions workflows that use OIDC or limited publish tokens, and (4) verify the skill/author provenance (repo, signatures, or known maintainer) before applying its automation to production repositories.

Like a lobster shell, security has layers — review code before you run it.

javascriptvk972j52z76w14m189xv8v698m5840gs3latestvk972j52z76w14m189xv8v698m5840gs3npmvk972j52z76w14m189xv8v698m5840gs3securityvk972j52z76w14m189xv8v698m5840gs3supply-chainvk972j52z76w14m189xv8v698m5840gs3

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

npm-supply-chain-security

Description

Protect your JavaScript projects from npm supply chain attacks. Learn to identify malicious packages, implement trusted publishing, and use security heuristics to detect compromised dependencies.

Implementation

NPM supply chain attacks have become increasingly common, with recent incidents affecting packages with millions of weekly downloads. The Axios attack in March 2026 demonstrated how leaked long-lived npm tokens can be exploited to publish malicious dependencies.

Key Security Practices:

  • Trusted Publishing: Configure GitHub Actions workflows as the only authorized publishers to npm
  • Release Verification: Check for accompanying GitHub releases when new package versions are published
  • Dependency Monitoring: Watch for newly published dependencies in established packages
  • Token Management: Use short-lived, scoped tokens instead of long-lived global tokens

Red Flags for Malicious Packages:

  • New dependencies added to established packages
  • Versions published without corresponding GitHub releases
  • Freshly published dependency packages with suspicious names
  • Unusual code patterns or obfuscated implementations

Code Examples

Example 1: Configure Trusted Publishing

{
  "name": "your-package",
  "version": "1.0.0",
  "publishConfig": {
    "registry": "https://registry.npmjs.org/",
    "provenance": true
  },
  "scripts": {
    "release": "npm publish --provenance"
  }
}

Example 2: GitHub Actions Workflow for Trusted Publishing

name: Publish Package
on:
  release:
    types: [published]

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write  # Required for trusted publishing
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          registry-url: 'https://registry.npmjs.org'
      - run: npm ci
      - run: npm publish --provenance
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Example 3: Security Heuristic Checker

import requests
import json

def check_package_release_heuristic(package_name, version):
    """Check if package version has corresponding GitHub release"""
    # Get package info from npm registry
    npm_url = f"https://registry.npmjs.org/{package_name}/{version}"
    npm_response = requests.get(npm_url)
    
    if npm_response.status_code != 200:
        return False, "Package version not found"
    
    npm_data = npm_response.json()
    repository = npm_data.get('repository', {}).get('url', '')
    
    if 'github.com' not in repository:
        return True, "Non-GitHub repository"  # Can't verify
    
    # Extract GitHub repo info
    repo_parts = repository.replace('https://github.com/', '').replace('.git', '').split('/')
    if len(repo_parts) != 2:
        return True, "Invalid repository format"
    
    owner, repo = repo_parts
    github_release_url = f"https://api.github.com/repos/{owner}/{repo}/releases/tags/v{version}"
    github_response = requests.get(github_release_url)
    
    if github_response.status_code == 200:
        return True, "GitHub release found"
    else:
        return False, "No corresponding GitHub release - potential red flag!"

# Usage
safe, message = check_package_release_heuristic("axios", "1.14.1")
print(f"Security check: {safe} - {message}")

Example 4: Dependency Audit Script

const fs = require('fs');
const path = require('path');

function auditDependencies(packageJsonPath) {
    const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
    const dependencies = {...packageJson.dependencies, ...packageJson.devDependencies};
    
    // Check for recently published packages (simplified)
    const suspiciousPatterns = [
        'crypto-js', 'plain-', 'simple-', 'basic-', 'core-'
    ];
    
    const suspiciousDeps = [];
    for (const [dep, version] of Object.entries(dependencies)) {
        // Check if dependency name matches suspicious patterns
        if (suspiciousPatterns.some(pattern => dep.includes(pattern))) {
            suspiciousDeps.push(dep);
        }
    }
    
    return suspiciousDeps;
}

// Usage
const suspicious = auditDependencies('./package.json');
if (suspicious.length > 0) {
    console.warn('Suspicious dependencies detected:', suspicious);
}

Dependencies

  • Python 3.8+ (for security scripts)
  • requests library
  • Node.js 18+ (for npm workflows)
  • GitHub CLI (optional, for automated verification)

Files

2 total
Select a file
Select a file to preview.

Comments

Loading comments…