Skip to content

Security: outerreaches/nexus

Security

SECURITY.md

Security Audit Tools for Nexus

This document describes the security scanning tools configured for the Nexus codebase and how to use them.

Overview

Nexus uses a multi-layered security approach:

Tool Purpose Type
ESLint + security plugin Development-time security checks SAST
npm audit Dependency vulnerability scanning SCA
Semgrep Static application security testing SAST
Gitleaks Secret detection Secret Scanning

Quick Start

Requirements:

  • Node.js 22+ (repo and some dependencies enforce engines)

Install Dependencies

npm install

Run All Security Scans

npm run security:all

Individual Tools

1. ESLint with Security Plugin

Checks for common security issues in JavaScript/TypeScript code during development.

# Run linting
npm run lint

# Auto-fix issues where possible
npm run lint:fix

What's detected:

  • eval() usage
  • dangerouslySetInnerHTML usage
  • Command injection risks
  • Weak cryptographic algorithms
  • Insecure random number generation
  • Path traversal risks

2. npm Audit

Built-in npm dependency vulnerability scanner.

# Check for vulnerabilities
npm run security:audit

# Auto-fix vulnerabilities
npm run security:audit:fix

Configuration: The audit runs at "high" severity level by default.

3. Semgrep

Advanced static analysis with community-curated security rules.

# Run semgrep with repository rules (semgrep.yml)
npm run security:semgrep

# Docker fallback (if semgrep is not installed locally)
npm run security:semgrep:docker

What's detected:

  • Code injection vulnerabilities
  • SQL injection
  • Path traversal
  • XXE vulnerabilities
  • Hardcoded secrets
  • And many more OWASP Top 10 issues

4. Gitleaks

Scans for secrets accidentally committed to the repository.

# Run gitleaks
npm run security:gitleaks

# Docker fallback (if gitleaks is not installed locally)
npm run security:gitleaks:docker

What's detected:

  • AWS access keys
  • GitHub tokens
  • Slack tokens
  • Stripe API keys
  • Private keys
  • Database connection strings
  • JWT tokens

CI/CD Integration

A GitHub Actions workflow is configured at .github/workflows/security.yml.

Secrets Required

For full CI/CD functionality, add these secrets to your GitHub repository:

Secret Purpose
SNYK_TOKEN Snyk dependency monitoring (optional)

Running Locally Without Secrets

The workflow will still run without secrets - some steps may be skipped or use local-only modes.

Scheduled Scans

The workflow runs:

  • On every push to main or develop
  • On every pull request to main
  • Weekly on Sunday at 2 AM
  • Manually via workflow_dispatch

Adding Snyk (Optional)

To add Snyk for enhanced dependency monitoring:

# Install Snyk CLI
npm install -g snyk

# Authenticate
snyk auth

# Test configuration
snyk test

# Add to CI/CD (uncomment in security.yml)
# Uses: snyk/actions/node@master

Best Practices

  1. Run security scans before committing:

    npm run security:all
  2. Use pre-commit hooks:

    npx husky install
    # or use semgrep's built-in hook
    npm run postinstall
  3. Fix vulnerabilities promptly:

    npm run security:audit:fix
  4. Review security findings regularly:

    • Check GitHub Security tab
    • Review PR security checks
    • Monitor dependency updates

Agent-Assisted Audits (Optional)

For external platform audits (HTTP headers/TLS/artifact exposure), use the security-researcher preset.

Operational guardrails to avoid noisy loops:

  • Retry policy is enforced by the runner; don’t repeat identical tool calls after retry=no.
  • For exploratory shell_exec probes, make commands non-fatal (|| true) and emit explicit YES/NO output so expected misses don’t derail the run.

Troubleshooting

Node engine warnings / install failures on VM

If you see npm WARN EBADENGINE (e.g. Node 18 on the VM), upgrade Node to 22+ before running scans.

"command not found: semgrep"

npm install -g semgrep

"command not found: gitleaks"

# macOS
brew install gitleaks

# Linux
wget https://github.com/zricethezav/gitleaks/releases/download/v8.18.2/gitleaks_v8.18.2_linux_x64.tar.gz
tar -xzf gitleaks_v8.18.2_linux_x64.tar.gz
sudo mv gitleaks /usr/local/bin/

ESLint errors about TypeScript

# Ensure TypeScript ESLint is properly installed
npm install

Exit Codes

  • 0 - Scan passed / No issues found
  • 1 - Issues found (for most tools)
  • 2 - Configuration error

Reporting Security Issues

If you find a security vulnerability, please:

  1. Do NOT open a public GitHub issue
  2. Email the maintainers directly
  3. Or use GitHub's private vulnerability reporting

Last updated: February 2026

There aren't any published security advisories