deepscan-cli 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  *Zero False Positives Architecture • AST-Powered Context • AI Auto-Remediation*
7
7
 
8
8
  [![npm version](https://img.shields.io/npm/v/deepscan-cli.svg)](https://www.npmjs.com/package/deepscan-cli)
9
+ [![GitHub Marketplace](https://img.shields.io/badge/GitHub%20Marketplace-DeepScan%20Action-blue?logo=githubactions&logoColor=white)](https://github.com/marketplace/actions/deepscan-sast-secrets-cve-oom-scanner)
9
10
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
10
11
  [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org)
11
12
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
@@ -241,6 +242,54 @@ deepscan report convert results.json --to html --output report.html
241
242
 
242
243
  ---
243
244
 
245
+ ## 🤖 GitHub Actions (CI/CD & Code Scanning)
246
+
247
+ Available on [GitHub Actions Marketplace](https://github.com/marketplace/actions/deepscan-sast-secrets-cve-oom-scanner). Run DeepScan automatically on every push and pull request, detect security & OOM-kill bugs, and upload SARIF results directly to the **GitHub Security → Code Scanning** tab:
248
+
249
+ ```yaml
250
+ name: DeepScan Security & Ops Check
251
+
252
+ on:
253
+ push:
254
+ branches: [main]
255
+ pull_request:
256
+ branches: [main]
257
+
258
+ permissions:
259
+ contents: read
260
+ security-events: write
261
+
262
+ jobs:
263
+ deepscan:
264
+ runs-on: ubuntu-latest
265
+ steps:
266
+ - uses: actions/checkout@v4
267
+
268
+ - name: Run DeepScan (SAST + Ops/OOM-Kill)
269
+ uses: maiductuan/code-security-scanner@v1
270
+ with:
271
+ path: '.'
272
+ scanners: 'security,ops'
273
+ fail-on: 'critical,high'
274
+ upload-sarif: 'true'
275
+ ```
276
+
277
+ ### Action Inputs
278
+
279
+ | Input | Description | Default |
280
+ | :--- | :--- | :--- |
281
+ | `path` | Target path to scan | `.` |
282
+ | `scanners` | Comma-separated scanners (`security,ops,quality,cve`) | `security,ops` |
283
+ | `severity` | Severities to report (`critical,high,medium,low`) | `critical,high,medium,low` |
284
+ | `fail-on` | Severities that fail the job (`none` to never fail) | `critical,high` |
285
+ | `format` | Output format (`sarif`, `json`, `html`, `csv`, `console`) | `sarif` |
286
+ | `output` | Output report file path | `deepscan-results.sarif` |
287
+ | `upload-sarif` | Upload SARIF report to GitHub Code Scanning | `true` |
288
+ | `baseline` | Optional baseline JSON file path to ignore existing findings | `""` |
289
+ | `deep` | Enable taint flow & semantic analysis | `false` |
290
+
291
+ ---
292
+
244
293
  ## 🤖 AI-Assisted Validation
245
294
 
246
295
  Enable AI validation to reduce false positives (optional):
@@ -320,8 +369,8 @@ This section is intended for developers and users who want to run DeepScan from
320
369
  ### Setup
321
370
  Clone the repository and install all dependencies:
322
371
  ```bash
323
- git clone https://github.com/your-org/code-scan-security.git
324
- cd code-scan-security
372
+ git clone https://github.com/maiductuan/code-security-scanner.git
373
+ cd code-security-scanner
325
374
  npm install
326
375
  ```
327
376
 
@@ -13,7 +13,7 @@ import {
13
13
  loadBaseline,
14
14
  loadConfig,
15
15
  saveBaseline
16
- } from "../chunk-KITQQYNW.js";
16
+ } from "../chunk-ZP6AOU5P.js";
17
17
 
18
18
  // src/cli/index.ts
19
19
  import { Command as Command5 } from "commander";
@@ -341,6 +341,7 @@ var RULE_CATEGORIES = [
341
341
  { id: "timeout-resilience", name: "Timeouts & Resilience", description: "Missing HTTP/client timeouts, unbounded retry loops, and unsafe pool limits", scanner: "ops" },
342
342
  { id: "resource-leaks", name: "Resource & Connection Leaks", description: "Unclosed handles/connections, per-request DB clients, and uncleaned timers or listeners", scanner: "ops" },
343
343
  { id: "ops-performance", name: "Operational Bottlenecks", description: "N+1 queries in loops, blocking sync I/O in async handlers, unbounded Promise.all fan-out, and ReDoS", scanner: "ops" },
344
+ { id: "db-operations", name: "Database Connections & Locks", description: "External I/O in DB transactions, missing rollback handling, blocking locks, and pinned keep-alive DB connections", scanner: "ops" },
344
345
  // Quality categories
345
346
  { id: "complexity", name: "Complexity", description: "Cyclomatic and cognitive complexity issues", scanner: "quality" },
346
347
  { id: "duplication", name: "Code Duplication", description: "Duplicated code blocks", scanner: "quality" },
@@ -369,7 +370,7 @@ function createRulesCommand() {
369
370
  }
370
371
  if (options.scanner) {
371
372
  const secCategories = ["injection", "xss", "secrets", "auth", "crypto", "file-ops", "api-security"];
372
- const opsCategories = ["oom-memory", "timeout-resilience", "resource-leaks", "ops-performance"];
373
+ const opsCategories = ["oom-memory", "timeout-resilience", "resource-leaks", "ops-performance", "db-operations"];
373
374
  if (options.scanner === "security") {
374
375
  allRules = allRules.filter((r) => secCategories.includes(r.category));
375
376
  } else if (options.scanner === "ops") {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/scan.ts","../../src/cli/commands/init.ts","../../src/cli/commands/rules.ts","../../src/types/rule.ts","../../src/cli/commands/report.ts","../../src/bin/deepscan.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { createScanCommand } from './commands/scan.js';\nimport { createInitCommand } from './commands/init.js';\nimport { createRulesCommand } from './commands/rules.js';\nimport { createReportCommand } from './commands/report.js';\nimport { DEEPSCAN_VERSION } from '../version.js';\n\nconst VERSION = DEEPSCAN_VERSION;\n\n/**\n * Create the DeepScan CLI application\n */\nexport function createCLI(): Command {\n const program = new Command();\n\n program\n .name('deepscan')\n .description('🔍 DeepScan - Open-source security & code quality scanner')\n .version(VERSION, '-v, --version', 'Display version number')\n .option('--config <path>', 'Path to configuration file')\n .option('--verbose', 'Enable verbose output')\n .option('--quiet', 'Suppress all output except errors')\n .option('--no-color', 'Disable colored output');\n\n // Register commands\n program.addCommand(createScanCommand());\n program.addCommand(createInitCommand());\n program.addCommand(createRulesCommand());\n program.addCommand(createReportCommand());\n\n // Default action (no subcommand) → show help\n program.action(() => {\n program.outputHelp();\n });\n\n return program;\n}\n","import { Command } from 'commander';\nimport { resolve } from 'node:path';\nimport { consola } from 'consola';\nimport { loadConfig } from '../../config/loader.js';\nimport { ScanPipeline, generateFingerprint } from '../../core/pipeline.js';\nimport { applyBaseline, loadBaseline, saveBaseline } from '../../core/baseline.js';\nimport { SecurityScanner } from '../../scanners/security/index.js';\nimport { OperationsScanner } from '../../scanners/ops/index.js';\nimport { QualityScanner } from '../../scanners/quality/index.js';\nimport { CVEScanner } from '../../scanners/cve/index.js';\nimport { getReporter } from '../../reporters/index.js';\nimport type { OutputFormat } from '../../types/config.js';\n\n/**\n * Create the 'scan' command\n * Usage: deepscan scan [path] [options]\n */\nexport function createScanCommand(): Command {\n const scan = new Command('scan');\n\n scan\n .description('Scan source code for security and operational reliability issues (optional: quality, cve)')\n .argument('[path]', 'Path to scan (default: current directory)', '.')\n .allowExcessArguments(true)\n .option('-s, --scanners <scanners>', 'Scanner engines to use (comma-separated: security,ops,quality,cve) [default: security,ops]')\n .option('--security', 'Run security scanner only')\n .option('--ops', 'Run operational & OOM reliability scanner only')\n .option('--quality', 'Run quality scanner only')\n .option('--cve', 'Run CVE/dependency scanner only')\n .option('-f, --format <format>', 'Output format: json, csv, html, sarif, console', 'console')\n .option('-o, --output <file>', 'Output file path')\n .option('--severity <levels>', 'Filter by severity (comma-separated: critical,high,medium,low)')\n .option('--include <patterns>', 'Include file patterns (comma-separated)')\n .option('--exclude <patterns>', 'Exclude file patterns (comma-separated)')\n .option('--deep', 'Enable deep analysis (taint tracking, semantic analysis)')\n .option('--ai', 'Enable AI-assisted validation (requires API key)')\n .option('--ai-provider <provider>', 'AI provider: openai, anthropic, ollama, google')\n .option('--rules <path>', 'Path to custom rules directory')\n .option('--parallel <n>', 'Number of parallel workers', '4')\n .option('--incremental', 'Only scan changed files (git-based)')\n .option('--preset <name>', 'Use a preset configuration (node-api, python-web, java-spring, minimal)')\n .option('--config <path>', 'Path to configuration file')\n .option('--cache', 'Enable local result caching (default: true)', true)\n .option('--no-cache', 'Disable local result caching')\n .option('--cache-dir <dir>', 'Path to cache directory')\n .option('--fail-on <severities>', 'Fail scan (exit code 1) on matching severities (comma-separated: critical,high,medium,low)')\n .option('--baseline <file>', 'Ignore existing findings present in baseline JSON or prior scan report')\n .option('--save-baseline <file>', 'Save current finding fingerprints to a baseline JSON file')\n .option('-q, --quiet', 'Suppress progress output')\n .option('-w, --watch', 'Watch files and automatically re-scan on change')\n .action(async (targetPath: string, options: Record<string, string | boolean | undefined>, command: Command) => {\n try {\n const validScanners = new Set(['security', 'ops', 'quality', 'cve']);\n const extraArgs = (command?.args ?? []).slice(1);\n let resolvedTargetPath = targetPath;\n const extraScannerArgs: string[] = [];\n\n if (options.scanners && validScanners.has(targetPath)) {\n extraScannerArgs.push(targetPath);\n resolvedTargetPath = extraArgs.find(arg => !validScanners.has(arg)) ?? '.';\n }\n for (const arg of extraArgs) {\n if (validScanners.has(arg)) {\n extraScannerArgs.push(arg);\n }\n }\n\n const absolutePath = resolve(resolvedTargetPath);\n\n // Build CLI overrides from options\n const cliOverrides: Record<string, unknown> = {};\n\n const hasExplicitFlag = options.security || options.ops || options.quality || options.cve;\n if (hasExplicitFlag) {\n cliOverrides.scanners = {\n security: { enabled: !!options.security },\n ops: { enabled: !!options.ops },\n quality: { enabled: !!options.quality },\n cve: { enabled: !!options.cve },\n };\n } else if (options.scanners) {\n const rawScanners = String(options.scanners);\n // Windows PowerShell .ps1 shim converts unquoted comma lists (e.g. -s security,quality,cve) into \"System.Object[]\"\n if (rawScanners.includes('System.Object[]')) {\n cliOverrides.scanners = {\n security: { enabled: true },\n ops: { enabled: true },\n quality: { enabled: true },\n cve: { enabled: true },\n };\n } else {\n const scannerList = [\n ...rawScanners.split(/[\\s,]+/).map(s => s.trim().toLowerCase()).filter(Boolean),\n ...extraScannerArgs,\n ];\n const hasValidScanner = scannerList.some(s => validScanners.has(s));\n if (!hasValidScanner) {\n consola.warn(`No valid scanner found in \"${rawScanners}\". Falling back to default (security,ops).`);\n } else {\n cliOverrides.scanners = {\n security: { enabled: scannerList.includes('security') },\n ops: { enabled: scannerList.includes('ops') },\n quality: { enabled: scannerList.includes('quality') },\n cve: { enabled: scannerList.includes('cve') },\n };\n }\n }\n }\n\n if (options.format) {\n cliOverrides.output = { format: options.format };\n }\n\n if (options.severity) {\n const severities = (options.severity as string).split(/[\\s,]+/).map(s => s.trim()).filter(Boolean);\n if (!cliOverrides.scanners) cliOverrides.scanners = {};\n const scannersOverride = cliOverrides.scanners as Record<string, unknown>;\n const existingSec = (scannersOverride.security as Record<string, unknown>) || {};\n const existingOps = (scannersOverride.ops as Record<string, unknown>) || {};\n scannersOverride.security = { ...existingSec, severity: severities };\n scannersOverride.ops = { ...existingOps, severity: severities };\n }\n\n if (options.include) {\n cliOverrides.paths = {\n ...(cliOverrides.paths as Record<string, unknown> || {}),\n include: (options.include as string).split(','),\n };\n }\n\n if (options.exclude) {\n cliOverrides.paths = {\n ...(cliOverrides.paths as Record<string, unknown> || {}),\n exclude: (options.exclude as string).split(','),\n };\n }\n\n if (options.deep) cliOverrides.deep = true;\n if (options.incremental) cliOverrides.incremental = true;\n if (options.parallel) cliOverrides.parallel = parseInt(options.parallel as string, 10);\n if (options.cache === false) cliOverrides.cache = false;\n if (options.cacheDir) cliOverrides.cacheLocation = resolve(options.cacheDir as string, 'cache.json');\n if (options.failOn) cliOverrides.failOn = (options.failOn as string).split(',');\n if (options.watch) cliOverrides.watch = true;\n\n if (options.ai) {\n cliOverrides.ai = {\n enabled: true,\n provider: options.aiProvider || 'openai',\n };\n }\n\n if (options.rules) {\n cliOverrides.rules = { custom: [(options.rules as string)] };\n }\n\n const runScanIteration = async () => {\n // Load configuration\n const config = await loadConfig({\n configPath: options.config as string,\n targetPath: absolutePath,\n cliOverrides: cliOverrides as any,\n preset: options.preset as string,\n });\n\n // Override output format from CLI\n if (options.format) {\n config.output.format = options.format as OutputFormat;\n }\n\n // Create pipeline\n const pipeline = new ScanPipeline(config);\n\n // Register enabled scanners\n if (config.scanners.security.enabled) {\n pipeline.addScanner(new SecurityScanner());\n }\n if (config.scanners.ops?.enabled) {\n pipeline.addScanner(new OperationsScanner());\n }\n if (config.scanners.quality.enabled) {\n pipeline.addScanner(new QualityScanner());\n }\n if (config.scanners.cve.enabled) {\n pipeline.addScanner(new CVEScanner());\n }\n\n const isQuiet = Boolean(options.quiet || command.parent?.opts()?.quiet);\n\n // Run scan with progress\n const rawResult = await pipeline.run({\n config,\n targetPath: absolutePath,\n onProgress: (current, total, file) => {\n if (!isQuiet && !options.watch) {\n const pct = Math.round((current / total) * 100);\n const fileDisplay = file.length > 50 ? '...' + file.slice(-47) : file;\n process.stderr.write(`\\r Scanning... ${pct}% (${current}/${total}) ${fileDisplay.padEnd(50)}`);\n }\n },\n });\n\n // Clear progress line\n if (!isQuiet && !options.watch) {\n process.stderr.write('\\r' + ' '.repeat(120) + '\\r');\n }\n\n if (options.saveBaseline) {\n const baselineOut = resolve(options.saveBaseline as string);\n saveBaseline(baselineOut, rawResult.findings);\n consola.success(`Saved baseline with ${rawResult.findings.length} finding(s) to: ${baselineOut}`);\n }\n\n let result = rawResult;\n if (options.baseline) {\n const baselinePath = resolve(options.baseline as string);\n const baselineSet = loadBaseline(baselinePath);\n const applied = applyBaseline(rawResult, baselineSet);\n result = applied.result;\n if (applied.suppressedCount > 0) {\n consola.info(`Baseline suppressed ${applied.suppressedCount} existing finding(s); ${result.summary.totalFindings} new finding(s) remain.`);\n }\n }\n\n // Generate report\n const reporter = getReporter(config.output.format);\n const output = await reporter.generate(result);\n\n // Write to file or stdout\n if (options.output) {\n await reporter.writeToFile(result, options.output as string);\n consola.success(`Report written to: ${options.output}`);\n } else if (config.output.format === 'html') {\n const defaultPath = 'report.html';\n await reporter.writeToFile(result, defaultPath);\n consola.success(`Report written to: ${defaultPath}`);\n } else if (config.output.format !== 'console') {\n // For non-console formats, write to stdout\n process.stdout.write(output);\n } else {\n // Console format already printed\n process.stdout.write(output);\n }\n\n // Check failure thresholds\n const failSeverities = config.failOn || ['critical', 'high'];\n const hasFailingFindings = failSeverities.some(sev => (result.summary.bySeverity[sev] || 0) > 0);\n\n if (hasFailingFindings) {\n process.exitCode = 1;\n } else {\n process.exitCode = 0;\n }\n\n return result;\n };\n\n // Execute initial scan\n await runScanIteration();\n\n // If watch mode is enabled, listen for file changes\n if (options.watch) {\n const { watch } = await import('node:fs');\n consola.info('👀 Watch mode active. Waiting for file changes (press Ctrl+C to stop)...');\n\n let debounceTimer: NodeJS.Timeout | null = null;\n let isScanning = false;\n\n try {\n watch(absolutePath, { recursive: true }, (eventType, filename) => {\n if (!filename) return;\n const norm = filename.replace(/\\\\/g, '/');\n if (\n norm.includes('node_modules') ||\n norm.includes('.git') ||\n norm.includes('.deepscan') ||\n norm.endsWith('.tmp') ||\n norm.endsWith('.log')\n ) {\n return;\n }\n\n if (debounceTimer) clearTimeout(debounceTimer);\n debounceTimer = setTimeout(async () => {\n if (isScanning) return;\n isScanning = true;\n console.log(`\\n🔄 Change detected in ${filename}. Re-scanning...\\n`);\n try {\n await runScanIteration();\n } catch (err) {\n consola.error('Scan error during watch:', err);\n } finally {\n isScanning = false;\n }\n }, 300);\n });\n } catch (watchErr) {\n consola.warn('Recursive watch failed, falling back to non-recursive watch:', watchErr);\n }\n }\n } catch (error) {\n consola.error('Scan failed:', error);\n process.exitCode = 2;\n }\n });\n\n return scan;\n}\n","import { Command } from 'commander';\nimport { writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport yaml from 'js-yaml';\nimport { consola } from 'consola';\nimport { DEFAULT_CONFIG } from '../../config/defaults.js';\n\n/**\n * Create the 'init' command\n * Usage: deepscan init\n */\nexport function createInitCommand(): Command {\n const init = new Command('init');\n\n init\n .description('Initialize a .deepscan.yml configuration file in the current directory')\n .option('--preset <name>', 'Use a preset: node-api, python-web, java-spring, minimal')\n .option('--format <format>', 'Config file format: yml, json', 'yml')\n .action(async (options: Record<string, string | undefined>) => {\n try {\n const config = {\n version: '1.0',\n scanners: {\n security: {\n enabled: true,\n severity: ['critical', 'high', 'medium', 'low'],\n },\n quality: {\n enabled: false,\n thresholds: {\n maxComplexity: 15,\n maxFileLength: 500,\n maxFunctionLength: 50,\n },\n },\n cve: {\n enabled: false,\n sources: ['osv'],\n },\n ops: {\n enabled: true,\n severity: ['critical', 'high', 'medium', 'low'],\n },\n },\n rules: {\n include: ['*'],\n exclude: [],\n custom: [],\n },\n paths: {\n include: ['**/*'],\n exclude: [\n 'node_modules/',\n 'vendor/',\n 'dist/',\n 'build/',\n '.git/',\n 'storage/',\n 'bootstrap/cache/',\n 'public/build/',\n 'assets/',\n '**/node_modules/**',\n '**/vendor/**',\n '**/dist/**',\n '**/build/**',\n '**/.git/**',\n '**/storage/**',\n '**/bootstrap/cache/**',\n '**/public/build/**',\n '**/assets/**',\n ],\n },\n output: {\n format: 'console',\n },\n ai: {\n enabled: false,\n },\n };\n\n const format = options.format || 'yml';\n const fileName = format === 'json' ? '.deepscan.json' : '.deepscan.yml';\n const filePath = resolve(process.cwd(), fileName);\n\n let content: string;\n if (format === 'json') {\n content = JSON.stringify(config, null, 2);\n } else {\n content = '# DeepScan Configuration\\n# https://github.com/deepscan/deepscan-cli\\n\\n'\n + yaml.dump(config, { indent: 2, lineWidth: 100, quotingType: '\"' });\n }\n\n writeFileSync(filePath, content, 'utf-8');\n consola.success(`Created ${fileName}`);\n consola.info('Customize the configuration and run: deepscan scan');\n } catch (error) {\n consola.error('Init failed:', error);\n process.exitCode = 1;\n }\n });\n\n return init;\n}\n","import { Command } from 'commander';\nimport { consola } from 'consola';\nimport chalk from 'chalk';\nimport { RuleEngine } from '../../rules/rule-engine.js';\nimport { DEFAULT_CONFIG } from '../../config/defaults.js';\nimport type { DeepScanConfig } from '../../types/config.js';\nimport { RULE_CATEGORIES } from '../../types/rule.js';\n\n/**\n * Create the 'rules' command group\n * Usage: deepscan rules list|info\n */\nexport function createRulesCommand(): Command {\n const rules = new Command('rules');\n rules.description('Manage and inspect scanning rules');\n\n // Subcommand: list\n rules\n .command('list')\n .description('List all available rules')\n .option('-c, --category <category>', 'Filter by category')\n .option('-s, --severity <severity>', 'Filter by severity')\n .option('-l, --language <language>', 'Filter by language')\n .option('--scanner <type>', 'Filter by scanner type (security, ops, quality)')\n .action(async (options: Record<string, string | undefined>) => {\n try {\n const ruleEngine = new RuleEngine(DEFAULT_CONFIG as DeepScanConfig);\n await ruleEngine.initialize();\n\n let allRules = ruleEngine.getAllRules();\n\n // Apply filters\n if (options.category) {\n allRules = allRules.filter(r => r.category === options.category);\n }\n if (options.severity) {\n allRules = allRules.filter(r => r.severity === options.severity);\n }\n if (options.language) {\n allRules = allRules.filter(r => r.languages.includes(options.language!) || r.languages.includes('*'));\n }\n if (options.scanner) {\n const secCategories = ['injection', 'xss', 'secrets', 'auth', 'crypto', 'file-ops', 'api-security'];\n const opsCategories = ['oom-memory', 'timeout-resilience', 'resource-leaks', 'ops-performance'];\n if (options.scanner === 'security') {\n allRules = allRules.filter(r => secCategories.includes(r.category));\n } else if (options.scanner === 'ops') {\n allRules = allRules.filter(r => opsCategories.includes(r.category));\n } else {\n allRules = allRules.filter(\n r => !secCategories.includes(r.category) && !opsCategories.includes(r.category),\n );\n }\n }\n\n // Display results\n console.log(chalk.bold(`\\n📋 DeepScan Rules (${allRules.length} rules)\\n`));\n\n const severityColors: Record<string, (s: string) => string> = {\n critical: chalk.bgRed.white,\n high: chalk.red,\n medium: chalk.yellow,\n low: chalk.blue,\n };\n\n for (const rule of allRules) {\n const sevColor = severityColors[rule.severity] || chalk.white;\n const id = chalk.cyan(rule.id.padEnd(35));\n const sev = sevColor(rule.severity.padEnd(10));\n const langs = chalk.gray(rule.languages.join(', '));\n console.log(` ${id} ${sev} ${rule.name}`);\n console.log(` ${' '.repeat(35)} ${chalk.dim(rule.description.slice(0, 80))}`);\n console.log(` ${' '.repeat(35)} Languages: ${langs}`);\n console.log();\n }\n } catch (error) {\n consola.error('Failed to list rules:', error);\n }\n });\n\n // Subcommand: info\n rules\n .command('info <ruleId>')\n .description('Show detailed information about a specific rule')\n .action(async (ruleId: string) => {\n try {\n const ruleEngine = new RuleEngine(DEFAULT_CONFIG as DeepScanConfig);\n await ruleEngine.initialize();\n\n const rule = ruleEngine.getRule(ruleId);\n if (!rule) {\n consola.error(`Rule not found: ${ruleId}`);\n return;\n }\n\n console.log(chalk.bold(`\\n🔍 Rule: ${rule.id}\\n`));\n console.log(` ${chalk.bold('Name:')} ${rule.name}`);\n console.log(` ${chalk.bold('Category:')} ${rule.category}`);\n console.log(` ${chalk.bold('Severity:')} ${rule.severity}`);\n console.log(` ${chalk.bold('Confidence:')} ${rule.confidence}`);\n console.log(` ${chalk.bold('Languages:')} ${rule.languages.join(', ')}`);\n console.log(` ${chalk.bold('Description:')} ${rule.description}`);\n\n if (rule.cwe?.length) {\n console.log(` ${chalk.bold('CWE:')} ${rule.cwe.join(', ')}`);\n }\n if (rule.owasp?.length) {\n console.log(` ${chalk.bold('OWASP:')} ${rule.owasp.join(', ')}`);\n }\n if (rule.fix) {\n console.log(` ${chalk.bold('Fix:')} ${rule.fix.description}`);\n }\n if (rule.references?.length) {\n console.log(` ${chalk.bold('References:')}`);\n for (const ref of rule.references) {\n console.log(` - ${chalk.underline(ref)}`);\n }\n }\n if (rule.tags?.length) {\n console.log(` ${chalk.bold('Tags:')} ${rule.tags.join(', ')}`);\n }\n console.log();\n } catch (error) {\n consola.error('Failed to get rule info:', error);\n }\n });\n\n // Subcommand: categories\n rules\n .command('categories')\n .description('List all rule categories')\n .action(async () => {\n console.log(chalk.bold('\\n📂 Rule Categories\\n'));\n for (const cat of RULE_CATEGORIES) {\n const scanner =\n cat.scanner === 'security'\n ? chalk.red('🛡 Security')\n : cat.scanner === 'ops'\n ? chalk.magenta('⚙️ Ops')\n : chalk.blue('📊 Quality');\n console.log(` ${chalk.cyan(cat.id.padEnd(20))} ${scanner} ${cat.name}`);\n console.log(` ${' '.repeat(20)} ${chalk.dim(cat.description)}`);\n console.log();\n }\n });\n\n return rules;\n}\n","import type { Severity, Confidence } from './finding.js';\n\n// ─── Rule Types ────────────────────────────────────────────────────────────\n\n/** Pattern definition within a rule */\nexport interface RulePattern {\n /** Tree-sitter query or code pattern */\n pattern?: string;\n /** Message to display when this pattern matches */\n message?: string;\n /** Regex pattern (for non-AST matching) */\n regex?: string;\n /** Flags for regex */\n regexFlags?: string;\n}\n\n/** Condition for advanced rule logic */\nexport interface RuleCondition {\n type: 'taint-check' | 'context-check' | 'scope-check' | 'ast-check';\n /** For taint-check: source type */\n source?: string;\n /** For taint-check: sink variable */\n sink?: string;\n /** For context-check: contexts to include/exclude */\n in?: string[];\n notIn?: string[];\n /** For scope-check */\n scope?: string;\n}\n\n/** Fix suggestion within a rule */\nexport interface RuleFix {\n description: string;\n replacement?: string;\n}\n\n/** A single rule definition */\nexport interface Rule {\n id: string;\n name: string;\n description: string;\n category: string;\n subcategory?: string;\n severity: Severity;\n confidence: Confidence;\n cwe?: string[];\n owasp?: string[];\n languages: string[];\n patterns: RulePattern[];\n conditions?: RuleCondition[];\n fix?: RuleFix;\n tags?: string[];\n references?: string[];\n enabled?: boolean;\n}\n\n/** Collection of rules in a YAML file */\nexport interface RuleFile {\n rules: Rule[];\n}\n\n/** Rule category for organization */\nexport interface RuleCategory {\n id: string;\n name: string;\n description: string;\n scanner: 'security' | 'quality' | 'ops';\n}\n\n/** Default rule categories */\nexport const RULE_CATEGORIES: RuleCategory[] = [\n // Security categories\n { id: 'injection', name: 'Injection', description: 'SQL, Command, LDAP, XPath injection vulnerabilities', scanner: 'security' },\n { id: 'xss', name: 'Cross-Site Scripting', description: 'XSS vulnerabilities including DOM-based and reflected', scanner: 'security' },\n { id: 'secrets', name: 'Secrets & Credentials', description: 'Hardcoded passwords, API keys, tokens', scanner: 'security' },\n { id: 'auth', name: 'Authentication & Authorization', description: 'Weak auth patterns, missing authorization', scanner: 'security' },\n { id: 'crypto', name: 'Cryptography', description: 'Weak algorithms, insecure random, hardcoded keys', scanner: 'security' },\n { id: 'file-ops', name: 'File Operations', description: 'Path traversal, unsafe uploads, directory listing', scanner: 'security' },\n // Operations & Reliability categories\n { id: 'oom-memory', name: 'OOM & Unbounded Memory', description: 'Unbounded queries without pagination, full-body buffering, uncapped page limits, and unbounded caches', scanner: 'ops' },\n { id: 'timeout-resilience', name: 'Timeouts & Resilience', description: 'Missing HTTP/client timeouts, unbounded retry loops, and unsafe pool limits', scanner: 'ops' },\n { id: 'resource-leaks', name: 'Resource & Connection Leaks', description: 'Unclosed handles/connections, per-request DB clients, and uncleaned timers or listeners', scanner: 'ops' },\n { id: 'ops-performance', name: 'Operational Bottlenecks', description: 'N+1 queries in loops, blocking sync I/O in async handlers, unbounded Promise.all fan-out, and ReDoS', scanner: 'ops' },\n // Quality categories\n { id: 'complexity', name: 'Complexity', description: 'Cyclomatic and cognitive complexity issues', scanner: 'quality' },\n { id: 'duplication', name: 'Code Duplication', description: 'Duplicated code blocks', scanner: 'quality' },\n { id: 'code-smells', name: 'Code Smells', description: 'Long methods, large files, dead code', scanner: 'quality' },\n { id: 'naming', name: 'Naming Conventions', description: 'Inconsistent or unclear naming', scanner: 'quality' },\n { id: 'metrics', name: 'Code Metrics', description: 'Lines of code, comment ratio, maintainability', scanner: 'quality' },\n];\n","import { Command } from 'commander';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { consola } from 'consola';\nimport type { ScanResult } from '../../types/finding.js';\nimport type { OutputFormat } from '../../types/config.js';\nimport { getReporter } from '../../reporters/index.js';\n\n/**\n * Create the 'report' command\n * Usage: deepscan report convert <input> --to <format> --output <file>\n */\nexport function createReportCommand(): Command {\n const report = new Command('report');\n report.description('Convert and manage scan reports');\n\n report\n .command('convert <input>')\n .description('Convert scan results between formats')\n .requiredOption('--to <format>', 'Target format: json, csv, html, sarif')\n .option('-o, --output <file>', 'Output file path')\n .action(async (input: string, options: { to: string; output?: string }) => {\n try {\n const inputPath = resolve(input);\n const content = readFileSync(inputPath, 'utf-8');\n const scanResult: ScanResult = JSON.parse(content);\n\n const reporter = getReporter(options.to as OutputFormat);\n const output = await reporter.generate(scanResult);\n\n if (options.output) {\n const outputPath = resolve(options.output);\n writeFileSync(outputPath, output, 'utf-8');\n consola.success(`Report converted to ${options.to}: ${outputPath}`);\n } else if (options.to === 'html') {\n const outputPath = resolve('report.html');\n writeFileSync(outputPath, output, 'utf-8');\n consola.success(`Report converted to ${options.to}: ${outputPath}`);\n } else {\n process.stdout.write(output);\n }\n } catch (error) {\n consola.error('Report conversion failed:', error);\n process.exitCode = 1;\n }\n });\n\n return report;\n}\n","#!/usr/bin/env node\nimport { createRequire } from 'node:module';\nimport { createCLI } from '../cli/index.js';\n\n// Run the CLI\nconst cli = createCLI();\ncli.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAAA,gBAAe;;;ACAxB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,eAAe;AAejB,SAAS,oBAA6B;AAC3C,QAAM,OAAO,IAAI,QAAQ,MAAM;AAE/B,OACG,YAAY,2FAA2F,EACvG,SAAS,UAAU,6CAA6C,GAAG,EACnE,qBAAqB,IAAI,EACzB,OAAO,6BAA6B,4FAA4F,EAChI,OAAO,cAAc,2BAA2B,EAChD,OAAO,SAAS,gDAAgD,EAChE,OAAO,aAAa,0BAA0B,EAC9C,OAAO,SAAS,iCAAiC,EACjD,OAAO,yBAAyB,kDAAkD,SAAS,EAC3F,OAAO,uBAAuB,kBAAkB,EAChD,OAAO,uBAAuB,gEAAgE,EAC9F,OAAO,wBAAwB,yCAAyC,EACxE,OAAO,wBAAwB,yCAAyC,EACxE,OAAO,UAAU,0DAA0D,EAC3E,OAAO,QAAQ,kDAAkD,EACjE,OAAO,4BAA4B,gDAAgD,EACnF,OAAO,kBAAkB,gCAAgC,EACzD,OAAO,kBAAkB,8BAA8B,GAAG,EAC1D,OAAO,iBAAiB,qCAAqC,EA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,EAAE,KAAK,UAAU,EAAE;AAAA,MACpE,WAAW,QAAQ,OAAO,QAAQ;AAChC,cAAM,aAAaF,SAAQ,aAAa;AACxC,QAAAC,eAAc,YAAY,QAAQ,OAAO;AACzC,QAAAC,SAAQ,QAAQ,uBAAuB,QAAQ,EAAE,KAAK,UAAU,EAAE;AAAA,MACpE,OAAO;AACL,gBAAQ,OAAO,MAAM,MAAM;AAAA,MAC7B;AAAA,IACF,SAAS,OAAO;AACd,MAAAA,SAAQ,MAAM,6BAA6B,KAAK;AAChD,cAAQ,WAAW;AAAA,IACrB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;;;ALzCA,IAAM,UAAU;AAKT,SAAS,YAAqB;AACnC,QAAM,UAAU,IAAIC,SAAQ;AAE5B,UACG,KAAK,UAAU,EACf,YAAY,kEAA2D,EACvE,QAAQ,SAAS,iBAAiB,wBAAwB,EAC1D,OAAO,mBAAmB,4BAA4B,EACtD,OAAO,aAAa,uBAAuB,EAC3C,OAAO,WAAW,mCAAmC,EACrD,OAAO,cAAc,wBAAwB;AAGhD,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,mBAAmB,CAAC;AACvC,UAAQ,WAAW,oBAAoB,CAAC;AAGxC,UAAQ,OAAO,MAAM;AACnB,YAAQ,WAAW;AAAA,EACrB,CAAC;AAED,SAAO;AACT;;;AM/BA,IAAM,MAAM,UAAU;AACtB,IAAI,MAAM,QAAQ,IAAI;","names":["Command","Command","resolve","consola","Command","consola","Command","consola","Command","writeFileSync","resolve","consola","Command","resolve","writeFileSync","consola","Command"]}
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/scan.ts","../../src/cli/commands/init.ts","../../src/cli/commands/rules.ts","../../src/types/rule.ts","../../src/cli/commands/report.ts","../../src/bin/deepscan.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { createScanCommand } from './commands/scan.js';\nimport { createInitCommand } from './commands/init.js';\nimport { createRulesCommand } from './commands/rules.js';\nimport { createReportCommand } from './commands/report.js';\nimport { DEEPSCAN_VERSION } from '../version.js';\n\nconst VERSION = DEEPSCAN_VERSION;\n\n/**\n * Create the DeepScan CLI application\n */\nexport function createCLI(): Command {\n const program = new Command();\n\n program\n .name('deepscan')\n .description('🔍 DeepScan - Open-source security & code quality scanner')\n .version(VERSION, '-v, --version', 'Display version number')\n .option('--config <path>', 'Path to configuration file')\n .option('--verbose', 'Enable verbose output')\n .option('--quiet', 'Suppress all output except errors')\n .option('--no-color', 'Disable colored output');\n\n // Register commands\n program.addCommand(createScanCommand());\n program.addCommand(createInitCommand());\n program.addCommand(createRulesCommand());\n program.addCommand(createReportCommand());\n\n // Default action (no subcommand) → show help\n program.action(() => {\n program.outputHelp();\n });\n\n return program;\n}\n","import { Command } from 'commander';\nimport { resolve } from 'node:path';\nimport { consola } from 'consola';\nimport { loadConfig } from '../../config/loader.js';\nimport { ScanPipeline, generateFingerprint } from '../../core/pipeline.js';\nimport { applyBaseline, loadBaseline, saveBaseline } from '../../core/baseline.js';\nimport { SecurityScanner } from '../../scanners/security/index.js';\nimport { OperationsScanner } from '../../scanners/ops/index.js';\nimport { QualityScanner } from '../../scanners/quality/index.js';\nimport { CVEScanner } from '../../scanners/cve/index.js';\nimport { getReporter } from '../../reporters/index.js';\nimport type { OutputFormat } from '../../types/config.js';\n\n/**\n * Create the 'scan' command\n * Usage: deepscan scan [path] [options]\n */\nexport function createScanCommand(): Command {\n const scan = new Command('scan');\n\n scan\n .description('Scan source code for security and operational reliability issues (optional: quality, cve)')\n .argument('[path]', 'Path to scan (default: current directory)', '.')\n .allowExcessArguments(true)\n .option('-s, --scanners <scanners>', 'Scanner engines to use (comma-separated: security,ops,quality,cve) [default: security,ops]')\n .option('--security', 'Run security scanner only')\n .option('--ops', 'Run operational & OOM reliability scanner only')\n .option('--quality', 'Run quality scanner only')\n .option('--cve', 'Run CVE/dependency scanner only')\n .option('-f, --format <format>', 'Output format: json, csv, html, sarif, console', 'console')\n .option('-o, --output <file>', 'Output file path')\n .option('--severity <levels>', 'Filter by severity (comma-separated: critical,high,medium,low)')\n .option('--include <patterns>', 'Include file patterns (comma-separated)')\n .option('--exclude <patterns>', 'Exclude file patterns (comma-separated)')\n .option('--deep', 'Enable deep analysis (taint tracking, semantic analysis)')\n .option('--ai', 'Enable AI-assisted validation (requires API key)')\n .option('--ai-provider <provider>', 'AI provider: openai, anthropic, ollama, google')\n .option('--rules <path>', 'Path to custom rules directory')\n .option('--parallel <n>', 'Number of parallel workers', '4')\n .option('--incremental', 'Only scan changed files (git-based)')\n .option('--preset <name>', 'Use a preset configuration (node-api, python-web, java-spring, minimal)')\n .option('--config <path>', 'Path to configuration file')\n .option('--cache', 'Enable local result caching (default: true)', true)\n .option('--no-cache', 'Disable local result caching')\n .option('--cache-dir <dir>', 'Path to cache directory')\n .option('--fail-on <severities>', 'Fail scan (exit code 1) on matching severities (comma-separated: critical,high,medium,low)')\n .option('--baseline <file>', 'Ignore existing findings present in baseline JSON or prior scan report')\n .option('--save-baseline <file>', 'Save current finding fingerprints to a baseline JSON file')\n .option('-q, --quiet', 'Suppress progress output')\n .option('-w, --watch', 'Watch files and automatically re-scan on change')\n .action(async (targetPath: string, options: Record<string, string | boolean | undefined>, command: Command) => {\n try {\n const validScanners = new Set(['security', 'ops', 'quality', 'cve']);\n const extraArgs = (command?.args ?? []).slice(1);\n let resolvedTargetPath = targetPath;\n const extraScannerArgs: string[] = [];\n\n if (options.scanners && validScanners.has(targetPath)) {\n extraScannerArgs.push(targetPath);\n resolvedTargetPath = extraArgs.find(arg => !validScanners.has(arg)) ?? '.';\n }\n for (const arg of extraArgs) {\n if (validScanners.has(arg)) {\n extraScannerArgs.push(arg);\n }\n }\n\n const absolutePath = resolve(resolvedTargetPath);\n\n // Build CLI overrides from options\n const cliOverrides: Record<string, unknown> = {};\n\n const hasExplicitFlag = options.security || options.ops || options.quality || options.cve;\n if (hasExplicitFlag) {\n cliOverrides.scanners = {\n security: { enabled: !!options.security },\n ops: { enabled: !!options.ops },\n quality: { enabled: !!options.quality },\n cve: { enabled: !!options.cve },\n };\n } else if (options.scanners) {\n const rawScanners = String(options.scanners);\n // Windows PowerShell .ps1 shim converts unquoted comma lists (e.g. -s security,quality,cve) into \"System.Object[]\"\n if (rawScanners.includes('System.Object[]')) {\n cliOverrides.scanners = {\n security: { enabled: true },\n ops: { enabled: true },\n quality: { enabled: true },\n cve: { enabled: true },\n };\n } else {\n const scannerList = [\n ...rawScanners.split(/[\\s,]+/).map(s => s.trim().toLowerCase()).filter(Boolean),\n ...extraScannerArgs,\n ];\n const hasValidScanner = scannerList.some(s => validScanners.has(s));\n if (!hasValidScanner) {\n consola.warn(`No valid scanner found in \"${rawScanners}\". Falling back to default (security,ops).`);\n } else {\n cliOverrides.scanners = {\n security: { enabled: scannerList.includes('security') },\n ops: { enabled: scannerList.includes('ops') },\n quality: { enabled: scannerList.includes('quality') },\n cve: { enabled: scannerList.includes('cve') },\n };\n }\n }\n }\n\n if (options.format) {\n cliOverrides.output = { format: options.format };\n }\n\n if (options.severity) {\n const severities = (options.severity as string).split(/[\\s,]+/).map(s => s.trim()).filter(Boolean);\n if (!cliOverrides.scanners) cliOverrides.scanners = {};\n const scannersOverride = cliOverrides.scanners as Record<string, unknown>;\n const existingSec = (scannersOverride.security as Record<string, unknown>) || {};\n const existingOps = (scannersOverride.ops as Record<string, unknown>) || {};\n scannersOverride.security = { ...existingSec, severity: severities };\n scannersOverride.ops = { ...existingOps, severity: severities };\n }\n\n if (options.include) {\n cliOverrides.paths = {\n ...(cliOverrides.paths as Record<string, unknown> || {}),\n include: (options.include as string).split(','),\n };\n }\n\n if (options.exclude) {\n cliOverrides.paths = {\n ...(cliOverrides.paths as Record<string, unknown> || {}),\n exclude: (options.exclude as string).split(','),\n };\n }\n\n if (options.deep) cliOverrides.deep = true;\n if (options.incremental) cliOverrides.incremental = true;\n if (options.parallel) cliOverrides.parallel = parseInt(options.parallel as string, 10);\n if (options.cache === false) cliOverrides.cache = false;\n if (options.cacheDir) cliOverrides.cacheLocation = resolve(options.cacheDir as string, 'cache.json');\n if (options.failOn) cliOverrides.failOn = (options.failOn as string).split(',');\n if (options.watch) cliOverrides.watch = true;\n\n if (options.ai) {\n cliOverrides.ai = {\n enabled: true,\n provider: options.aiProvider || 'openai',\n };\n }\n\n if (options.rules) {\n cliOverrides.rules = { custom: [(options.rules as string)] };\n }\n\n const runScanIteration = async () => {\n // Load configuration\n const config = await loadConfig({\n configPath: options.config as string,\n targetPath: absolutePath,\n cliOverrides: cliOverrides as any,\n preset: options.preset as string,\n });\n\n // Override output format from CLI\n if (options.format) {\n config.output.format = options.format as OutputFormat;\n }\n\n // Create pipeline\n const pipeline = new ScanPipeline(config);\n\n // Register enabled scanners\n if (config.scanners.security.enabled) {\n pipeline.addScanner(new SecurityScanner());\n }\n if (config.scanners.ops?.enabled) {\n pipeline.addScanner(new OperationsScanner());\n }\n if (config.scanners.quality.enabled) {\n pipeline.addScanner(new QualityScanner());\n }\n if (config.scanners.cve.enabled) {\n pipeline.addScanner(new CVEScanner());\n }\n\n const isQuiet = Boolean(options.quiet || command.parent?.opts()?.quiet);\n\n // Run scan with progress\n const rawResult = await pipeline.run({\n config,\n targetPath: absolutePath,\n onProgress: (current, total, file) => {\n if (!isQuiet && !options.watch) {\n const pct = Math.round((current / total) * 100);\n const fileDisplay = file.length > 50 ? '...' + file.slice(-47) : file;\n process.stderr.write(`\\r Scanning... ${pct}% (${current}/${total}) ${fileDisplay.padEnd(50)}`);\n }\n },\n });\n\n // Clear progress line\n if (!isQuiet && !options.watch) {\n process.stderr.write('\\r' + ' '.repeat(120) + '\\r');\n }\n\n if (options.saveBaseline) {\n const baselineOut = resolve(options.saveBaseline as string);\n saveBaseline(baselineOut, rawResult.findings);\n consola.success(`Saved baseline with ${rawResult.findings.length} finding(s) to: ${baselineOut}`);\n }\n\n let result = rawResult;\n if (options.baseline) {\n const baselinePath = resolve(options.baseline as string);\n const baselineSet = loadBaseline(baselinePath);\n const applied = applyBaseline(rawResult, baselineSet);\n result = applied.result;\n if (applied.suppressedCount > 0) {\n consola.info(`Baseline suppressed ${applied.suppressedCount} existing finding(s); ${result.summary.totalFindings} new finding(s) remain.`);\n }\n }\n\n // Generate report\n const reporter = getReporter(config.output.format);\n const output = await reporter.generate(result);\n\n // Write to file or stdout\n if (options.output) {\n await reporter.writeToFile(result, options.output as string);\n consola.success(`Report written to: ${options.output}`);\n } else if (config.output.format === 'html') {\n const defaultPath = 'report.html';\n await reporter.writeToFile(result, defaultPath);\n consola.success(`Report written to: ${defaultPath}`);\n } else if (config.output.format !== 'console') {\n // For non-console formats, write to stdout\n process.stdout.write(output);\n } else {\n // Console format already printed\n process.stdout.write(output);\n }\n\n // Check failure thresholds\n const failSeverities = config.failOn || ['critical', 'high'];\n const hasFailingFindings = failSeverities.some(sev => (result.summary.bySeverity[sev] || 0) > 0);\n\n if (hasFailingFindings) {\n process.exitCode = 1;\n } else {\n process.exitCode = 0;\n }\n\n return result;\n };\n\n // Execute initial scan\n await runScanIteration();\n\n // If watch mode is enabled, listen for file changes\n if (options.watch) {\n const { watch } = await import('node:fs');\n consola.info('👀 Watch mode active. Waiting for file changes (press Ctrl+C to stop)...');\n\n let debounceTimer: NodeJS.Timeout | null = null;\n let isScanning = false;\n\n try {\n watch(absolutePath, { recursive: true }, (eventType, filename) => {\n if (!filename) return;\n const norm = filename.replace(/\\\\/g, '/');\n if (\n norm.includes('node_modules') ||\n norm.includes('.git') ||\n norm.includes('.deepscan') ||\n norm.endsWith('.tmp') ||\n norm.endsWith('.log')\n ) {\n return;\n }\n\n if (debounceTimer) clearTimeout(debounceTimer);\n debounceTimer = setTimeout(async () => {\n if (isScanning) return;\n isScanning = true;\n console.log(`\\n🔄 Change detected in ${filename}. Re-scanning...\\n`);\n try {\n await runScanIteration();\n } catch (err) {\n consola.error('Scan error during watch:', err);\n } finally {\n isScanning = false;\n }\n }, 300);\n });\n } catch (watchErr) {\n consola.warn('Recursive watch failed, falling back to non-recursive watch:', watchErr);\n }\n }\n } catch (error) {\n consola.error('Scan failed:', error);\n process.exitCode = 2;\n }\n });\n\n return scan;\n}\n","import { Command } from 'commander';\nimport { writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport yaml from 'js-yaml';\nimport { consola } from 'consola';\nimport { DEFAULT_CONFIG } from '../../config/defaults.js';\n\n/**\n * Create the 'init' command\n * Usage: deepscan init\n */\nexport function createInitCommand(): Command {\n const init = new Command('init');\n\n init\n .description('Initialize a .deepscan.yml configuration file in the current directory')\n .option('--preset <name>', 'Use a preset: node-api, python-web, java-spring, minimal')\n .option('--format <format>', 'Config file format: yml, json', 'yml')\n .action(async (options: Record<string, string | undefined>) => {\n try {\n const config = {\n version: '1.0',\n scanners: {\n security: {\n enabled: true,\n severity: ['critical', 'high', 'medium', 'low'],\n },\n quality: {\n enabled: false,\n thresholds: {\n maxComplexity: 15,\n maxFileLength: 500,\n maxFunctionLength: 50,\n },\n },\n cve: {\n enabled: false,\n sources: ['osv'],\n },\n ops: {\n enabled: true,\n severity: ['critical', 'high', 'medium', 'low'],\n },\n },\n rules: {\n include: ['*'],\n exclude: [],\n custom: [],\n },\n paths: {\n include: ['**/*'],\n exclude: [\n 'node_modules/',\n 'vendor/',\n 'dist/',\n 'build/',\n '.git/',\n 'storage/',\n 'bootstrap/cache/',\n 'public/build/',\n 'assets/',\n '**/node_modules/**',\n '**/vendor/**',\n '**/dist/**',\n '**/build/**',\n '**/.git/**',\n '**/storage/**',\n '**/bootstrap/cache/**',\n '**/public/build/**',\n '**/assets/**',\n ],\n },\n output: {\n format: 'console',\n },\n ai: {\n enabled: false,\n },\n };\n\n const format = options.format || 'yml';\n const fileName = format === 'json' ? '.deepscan.json' : '.deepscan.yml';\n const filePath = resolve(process.cwd(), fileName);\n\n let content: string;\n if (format === 'json') {\n content = JSON.stringify(config, null, 2);\n } else {\n content = '# DeepScan Configuration\\n# https://github.com/deepscan/deepscan-cli\\n\\n'\n + yaml.dump(config, { indent: 2, lineWidth: 100, quotingType: '\"' });\n }\n\n writeFileSync(filePath, content, 'utf-8');\n consola.success(`Created ${fileName}`);\n consola.info('Customize the configuration and run: deepscan scan');\n } catch (error) {\n consola.error('Init failed:', error);\n process.exitCode = 1;\n }\n });\n\n return init;\n}\n","import { Command } from 'commander';\nimport { consola } from 'consola';\nimport chalk from 'chalk';\nimport { RuleEngine } from '../../rules/rule-engine.js';\nimport { DEFAULT_CONFIG } from '../../config/defaults.js';\nimport type { DeepScanConfig } from '../../types/config.js';\nimport { RULE_CATEGORIES } from '../../types/rule.js';\n\n/**\n * Create the 'rules' command group\n * Usage: deepscan rules list|info\n */\nexport function createRulesCommand(): Command {\n const rules = new Command('rules');\n rules.description('Manage and inspect scanning rules');\n\n // Subcommand: list\n rules\n .command('list')\n .description('List all available rules')\n .option('-c, --category <category>', 'Filter by category')\n .option('-s, --severity <severity>', 'Filter by severity')\n .option('-l, --language <language>', 'Filter by language')\n .option('--scanner <type>', 'Filter by scanner type (security, ops, quality)')\n .action(async (options: Record<string, string | undefined>) => {\n try {\n const ruleEngine = new RuleEngine(DEFAULT_CONFIG as DeepScanConfig);\n await ruleEngine.initialize();\n\n let allRules = ruleEngine.getAllRules();\n\n // Apply filters\n if (options.category) {\n allRules = allRules.filter(r => r.category === options.category);\n }\n if (options.severity) {\n allRules = allRules.filter(r => r.severity === options.severity);\n }\n if (options.language) {\n allRules = allRules.filter(r => r.languages.includes(options.language!) || r.languages.includes('*'));\n }\n if (options.scanner) {\n const secCategories = ['injection', 'xss', 'secrets', 'auth', 'crypto', 'file-ops', 'api-security'];\n const opsCategories = ['oom-memory', 'timeout-resilience', 'resource-leaks', 'ops-performance', 'db-operations'];\n if (options.scanner === 'security') {\n allRules = allRules.filter(r => secCategories.includes(r.category));\n } else if (options.scanner === 'ops') {\n allRules = allRules.filter(r => opsCategories.includes(r.category));\n } else {\n allRules = allRules.filter(\n r => !secCategories.includes(r.category) && !opsCategories.includes(r.category),\n );\n }\n }\n\n // Display results\n console.log(chalk.bold(`\\n📋 DeepScan Rules (${allRules.length} rules)\\n`));\n\n const severityColors: Record<string, (s: string) => string> = {\n critical: chalk.bgRed.white,\n high: chalk.red,\n medium: chalk.yellow,\n low: chalk.blue,\n };\n\n for (const rule of allRules) {\n const sevColor = severityColors[rule.severity] || chalk.white;\n const id = chalk.cyan(rule.id.padEnd(35));\n const sev = sevColor(rule.severity.padEnd(10));\n const langs = chalk.gray(rule.languages.join(', '));\n console.log(` ${id} ${sev} ${rule.name}`);\n console.log(` ${' '.repeat(35)} ${chalk.dim(rule.description.slice(0, 80))}`);\n console.log(` ${' '.repeat(35)} Languages: ${langs}`);\n console.log();\n }\n } catch (error) {\n consola.error('Failed to list rules:', error);\n }\n });\n\n // Subcommand: info\n rules\n .command('info <ruleId>')\n .description('Show detailed information about a specific rule')\n .action(async (ruleId: string) => {\n try {\n const ruleEngine = new RuleEngine(DEFAULT_CONFIG as DeepScanConfig);\n await ruleEngine.initialize();\n\n const rule = ruleEngine.getRule(ruleId);\n if (!rule) {\n consola.error(`Rule not found: ${ruleId}`);\n return;\n }\n\n console.log(chalk.bold(`\\n🔍 Rule: ${rule.id}\\n`));\n console.log(` ${chalk.bold('Name:')} ${rule.name}`);\n console.log(` ${chalk.bold('Category:')} ${rule.category}`);\n console.log(` ${chalk.bold('Severity:')} ${rule.severity}`);\n console.log(` ${chalk.bold('Confidence:')} ${rule.confidence}`);\n console.log(` ${chalk.bold('Languages:')} ${rule.languages.join(', ')}`);\n console.log(` ${chalk.bold('Description:')} ${rule.description}`);\n\n if (rule.cwe?.length) {\n console.log(` ${chalk.bold('CWE:')} ${rule.cwe.join(', ')}`);\n }\n if (rule.owasp?.length) {\n console.log(` ${chalk.bold('OWASP:')} ${rule.owasp.join(', ')}`);\n }\n if (rule.fix) {\n console.log(` ${chalk.bold('Fix:')} ${rule.fix.description}`);\n }\n if (rule.references?.length) {\n console.log(` ${chalk.bold('References:')}`);\n for (const ref of rule.references) {\n console.log(` - ${chalk.underline(ref)}`);\n }\n }\n if (rule.tags?.length) {\n console.log(` ${chalk.bold('Tags:')} ${rule.tags.join(', ')}`);\n }\n console.log();\n } catch (error) {\n consola.error('Failed to get rule info:', error);\n }\n });\n\n // Subcommand: categories\n rules\n .command('categories')\n .description('List all rule categories')\n .action(async () => {\n console.log(chalk.bold('\\n📂 Rule Categories\\n'));\n for (const cat of RULE_CATEGORIES) {\n const scanner =\n cat.scanner === 'security'\n ? chalk.red('🛡 Security')\n : cat.scanner === 'ops'\n ? chalk.magenta('⚙️ Ops')\n : chalk.blue('📊 Quality');\n console.log(` ${chalk.cyan(cat.id.padEnd(20))} ${scanner} ${cat.name}`);\n console.log(` ${' '.repeat(20)} ${chalk.dim(cat.description)}`);\n console.log();\n }\n });\n\n return rules;\n}\n","import type { Severity, Confidence } from './finding.js';\n\n// ─── Rule Types ────────────────────────────────────────────────────────────\n\n/** Pattern definition within a rule */\nexport interface RulePattern {\n /** Tree-sitter query or code pattern */\n pattern?: string;\n /** Message to display when this pattern matches */\n message?: string;\n /** Regex pattern (for non-AST matching) */\n regex?: string;\n /** Flags for regex */\n regexFlags?: string;\n}\n\n/** Condition for advanced rule logic */\nexport interface RuleCondition {\n type: 'taint-check' | 'context-check' | 'scope-check' | 'ast-check';\n /** For taint-check: source type */\n source?: string;\n /** For taint-check: sink variable */\n sink?: string;\n /** For context-check: contexts to include/exclude */\n in?: string[];\n notIn?: string[];\n /** For scope-check */\n scope?: string;\n}\n\n/** Fix suggestion within a rule */\nexport interface RuleFix {\n description: string;\n replacement?: string;\n}\n\n/** A single rule definition */\nexport interface Rule {\n id: string;\n name: string;\n description: string;\n category: string;\n subcategory?: string;\n severity: Severity;\n confidence: Confidence;\n cwe?: string[];\n owasp?: string[];\n languages: string[];\n patterns: RulePattern[];\n conditions?: RuleCondition[];\n fix?: RuleFix;\n tags?: string[];\n references?: string[];\n enabled?: boolean;\n}\n\n/** Collection of rules in a YAML file */\nexport interface RuleFile {\n rules: Rule[];\n}\n\n/** Rule category for organization */\nexport interface RuleCategory {\n id: string;\n name: string;\n description: string;\n scanner: 'security' | 'quality' | 'ops';\n}\n\n/** Default rule categories */\nexport const RULE_CATEGORIES: RuleCategory[] = [\n // Security categories\n { id: 'injection', name: 'Injection', description: 'SQL, Command, LDAP, XPath injection vulnerabilities', scanner: 'security' },\n { id: 'xss', name: 'Cross-Site Scripting', description: 'XSS vulnerabilities including DOM-based and reflected', scanner: 'security' },\n { id: 'secrets', name: 'Secrets & Credentials', description: 'Hardcoded passwords, API keys, tokens', scanner: 'security' },\n { id: 'auth', name: 'Authentication & Authorization', description: 'Weak auth patterns, missing authorization', scanner: 'security' },\n { id: 'crypto', name: 'Cryptography', description: 'Weak algorithms, insecure random, hardcoded keys', scanner: 'security' },\n { id: 'file-ops', name: 'File Operations', description: 'Path traversal, unsafe uploads, directory listing', scanner: 'security' },\n // Operations & Reliability categories\n { id: 'oom-memory', name: 'OOM & Unbounded Memory', description: 'Unbounded queries without pagination, full-body buffering, uncapped page limits, and unbounded caches', scanner: 'ops' },\n { id: 'timeout-resilience', name: 'Timeouts & Resilience', description: 'Missing HTTP/client timeouts, unbounded retry loops, and unsafe pool limits', scanner: 'ops' },\n { id: 'resource-leaks', name: 'Resource & Connection Leaks', description: 'Unclosed handles/connections, per-request DB clients, and uncleaned timers or listeners', scanner: 'ops' },\n { id: 'ops-performance', name: 'Operational Bottlenecks', description: 'N+1 queries in loops, blocking sync I/O in async handlers, unbounded Promise.all fan-out, and ReDoS', scanner: 'ops' },\n { id: 'db-operations', name: 'Database Connections & Locks', description: 'External I/O in DB transactions, missing rollback handling, blocking locks, and pinned keep-alive DB connections', scanner: 'ops' },\n // Quality categories\n { id: 'complexity', name: 'Complexity', description: 'Cyclomatic and cognitive complexity issues', scanner: 'quality' },\n { id: 'duplication', name: 'Code Duplication', description: 'Duplicated code blocks', scanner: 'quality' },\n { id: 'code-smells', name: 'Code Smells', description: 'Long methods, large files, dead code', scanner: 'quality' },\n { id: 'naming', name: 'Naming Conventions', description: 'Inconsistent or unclear naming', scanner: 'quality' },\n { id: 'metrics', name: 'Code Metrics', description: 'Lines of code, comment ratio, maintainability', scanner: 'quality' },\n];\n","import { Command } from 'commander';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { consola } from 'consola';\nimport type { ScanResult } from '../../types/finding.js';\nimport type { OutputFormat } from '../../types/config.js';\nimport { getReporter } from '../../reporters/index.js';\n\n/**\n * Create the 'report' command\n * Usage: deepscan report convert <input> --to <format> --output <file>\n */\nexport function createReportCommand(): Command {\n const report = new Command('report');\n report.description('Convert and manage scan reports');\n\n report\n .command('convert <input>')\n .description('Convert scan results between formats')\n .requiredOption('--to <format>', 'Target format: json, csv, html, sarif')\n .option('-o, --output <file>', 'Output file path')\n .action(async (input: string, options: { to: string; output?: string }) => {\n try {\n const inputPath = resolve(input);\n const content = readFileSync(inputPath, 'utf-8');\n const scanResult: ScanResult = JSON.parse(content);\n\n const reporter = getReporter(options.to as OutputFormat);\n const output = await reporter.generate(scanResult);\n\n if (options.output) {\n const outputPath = resolve(options.output);\n writeFileSync(outputPath, output, 'utf-8');\n consola.success(`Report converted to ${options.to}: ${outputPath}`);\n } else if (options.to === 'html') {\n const outputPath = resolve('report.html');\n writeFileSync(outputPath, output, 'utf-8');\n consola.success(`Report converted to ${options.to}: ${outputPath}`);\n } else {\n process.stdout.write(output);\n }\n } catch (error) {\n consola.error('Report conversion failed:', error);\n process.exitCode = 1;\n }\n });\n\n return report;\n}\n","#!/usr/bin/env node\nimport { createRequire } from 'node:module';\nimport { createCLI } from '../cli/index.js';\n\n// Run the CLI\nconst cli = createCLI();\ncli.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAAA,gBAAe;;;ACAxB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,eAAe;AAejB,SAAS,oBAA6B;AAC3C,QAAM,OAAO,IAAI,QAAQ,MAAM;AAE/B,OACG,YA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AW,mCAAmC,EACrD,OAAO,cAAc,wBAAwB;AAGhD,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,mBAAmB,CAAC;AACvC,UAAQ,WAAW,oBAAoB,CAAC;AAGxC,UAAQ,OAAO,MAAM;AACnB,YAAQ,WAAW;AAAA,EACrB,CAAC;AAED,SAAO;AACT;;;AM/BA,IAAM,MAAM,UAAU;AACtB,IAAI,MAAM,QAAQ,IAAI;","names":["Command","Command","resolve","consola","Command","consola","Command","consola","Command","writeFileSync","resolve","consola","Command","resolve","writeFileSync","consola","Command"]}