@lateos/npm-scan 0.3.0 → 0.3.1

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.
@@ -1 +1,32 @@
1
- -- SQLite schema for local CLI mode (free tier)\n-- Tables: scans, findings (ATK-linked)\n\nCREATE TABLE IF NOT EXISTS scans (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n package_name TEXT NOT NULL,\n version TEXT,\n scanned_at DATETIME DEFAULT CURRENT_TIMESTAMP,\n status TEXT DEFAULT 'completed',\n sbom_json TEXT\n);\n\nCREATE TABLE IF NOT EXISTS findings (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n scan_id INTEGER NOT NULL,\n atk_id TEXT NOT NULL REFERENCES attack_taxonomy(id),\n severity TEXT CHECK (severity IN ('info', 'low', 'medium', 'high', 'critical')),\n description TEXT,\n evidence TEXT,\n mitigation TEXT,\n FOREIGN KEY (scan_id) REFERENCES scans(id) ON DELETE CASCADE\n);\n\n-- View for reports\nCREATE VIEW scan_findings AS\nSELECT s.*, f.* FROM scans s\nJOIN findings f ON s.id = f.scan_id;\n\n-- Indexes\nCREATE INDEX idx_scans_package ON scans(package_name);\nCREATE INDEX idx_findings_atk ON findings(atk_id);\nCREATE INDEX idx_findings_severity ON findings(severity);
1
+ -- SQLite schema for local CLI mode (free tier)
2
+ -- Tables: scans, findings (ATK-linked)
3
+
4
+ CREATE TABLE IF NOT EXISTS scans (
5
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
6
+ package_name TEXT NOT NULL,
7
+ version TEXT,
8
+ scanned_at DATETIME DEFAULT CURRENT_TIMESTAMP,
9
+ status TEXT DEFAULT 'completed',
10
+ sbom_json TEXT
11
+ );
12
+
13
+ CREATE TABLE IF NOT EXISTS findings (
14
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
15
+ scan_id INTEGER NOT NULL,
16
+ atk_id TEXT NOT NULL,
17
+ severity TEXT CHECK (severity IN ('info', 'low', 'medium', 'high', 'critical')),
18
+ description TEXT,
19
+ evidence TEXT,
20
+ mitigation TEXT,
21
+ FOREIGN KEY (scan_id) REFERENCES scans(id) ON DELETE CASCADE
22
+ );
23
+
24
+ -- View for reports
25
+ CREATE VIEW IF NOT EXISTS scan_findings AS
26
+ SELECT s.*, f.* FROM scans s
27
+ JOIN findings f ON s.id = f.scan_id;
28
+
29
+ -- Indexes
30
+ CREATE INDEX IF NOT EXISTS idx_scans_package ON scans(package_name);
31
+ CREATE INDEX IF NOT EXISTS idx_findings_atk ON findings(atk_id);
32
+ CREATE INDEX IF NOT EXISTS idx_findings_severity ON findings(severity);
package/backend/sbom.js CHANGED
@@ -17,13 +17,16 @@ function generateCycloneDX(pkgJson, findings) {
17
17
  },
18
18
  tools: [{ name: 'npm-scan', version: '0.2.5' }]
19
19
  },
20
- vulnerabilities: findings.map(f => ({
21
- id: f.id,
20
+ vulnerabilities: findings.map(f => {
21
+ const atkId = f.atk_id || f.id;
22
+ return {
23
+ id: atkId,
22
24
  source: { name: 'npm-scan' },
23
25
  ratings: [{ severity: f.severity }],
24
- description: f.title || '',
26
+ description: f.description || f.title || '',
25
27
  recommendation: f.mitigation || 'Review evidence'
26
- }))
28
+ };
29
+ })
27
30
  };
28
31
  return JSON.stringify(bom, null, 2);
29
32
  }
package/cli/cli.js CHANGED
@@ -12,7 +12,7 @@ program
12
12
  .description('Scan a package')
13
13
  .argument('<target>', 'package name')
14
14
  .option('-l, --license-key <key>', 'Premium license')
15
- .option('--sbom [format]', 'Generate SBOM (json/xml/spdx)', 'json')
15
+ .option('--sbom [format]', 'Generate SBOM (json/xml/spdx)')
16
16
  .action(async (target, options) => {
17
17
  try {
18
18
  const { pkgJson, jsFiles, tmpDir } = await import('../backend/fetch.js').then(m => m.fetchPackage(target));
@@ -46,7 +46,7 @@ program
46
46
  .command('report')
47
47
  .description('Generate report')
48
48
  .option('-i, --id <id>', 'Scan ID')
49
- .option('--sbom [format]', 'SBOM format (json/xml/spdx)', 'json')
49
+ .option('--sbom [format]', 'SBOM format (json/xml/spdx)')
50
50
  .option('--html', 'HTML report')
51
51
  .option('--nist', 'NIST 800-161 compliance report')
52
52
  .action(async (options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lateos/npm-scan",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Powerful npm supply chain security scanner - detects malicious packages (Shai-Hulud style), behavioral analysis, SBOM, and compliance reporting.",
5
5
  "main": "backend/index.js",
6
6
  "bin": {