@lateos/npm-scan 0.11.5 → 0.12.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.
@@ -0,0 +1 @@
1
+ npx lint-staged
package/README.de.md CHANGED
@@ -373,7 +373,7 @@ jobs:
373
373
  with:
374
374
  node-version: 20
375
375
  - name: Scan lockfile
376
- uses: lateos/npm-scan@main
376
+ uses: lateos/npm-scan@v1
377
377
  with:
378
378
  scan-type: lockfile
379
379
  fail-on: high
@@ -401,7 +401,7 @@ jobs:
401
401
  #### Beispiel: Bestimmtes Paket mit Policy + SBOM scannen
402
402
 
403
403
  ```yaml
404
- - uses: lateos/npm-scan@main
404
+ - uses: lateos/npm-scan@v1
405
405
  with:
406
406
  scan-type: package
407
407
  package: lodash
@@ -413,7 +413,7 @@ jobs:
413
413
  #### Beispiel: Mit SIEM-Export scannen (Premium)
414
414
 
415
415
  ```yaml
416
- - uses: lateos/npm-scan@main
416
+ - uses: lateos/npm-scan@v1
417
417
  with:
418
418
  scan-type: lockfile
419
419
  siem-format: cef
@@ -467,7 +467,7 @@ jobs:
467
467
  with:
468
468
  node-version: 20
469
469
  - name: Scan lockfile
470
- uses: lateos/npm-scan@main
470
+ uses: lateos/npm-scan@v1
471
471
  with:
472
472
  scan-type: lockfile
473
473
  fail-on: high
@@ -495,7 +495,7 @@ jobs:
495
495
  #### Beispiel: Bestimmtes Paket mit Policy + SBOM scannen
496
496
 
497
497
  ```yaml
498
- - uses: lateos/npm-scan@main
498
+ - uses: lateos/npm-scan@v1
499
499
  with:
500
500
  scan-type: package
501
501
  package: lodash
@@ -507,7 +507,7 @@ jobs:
507
507
  #### Beispiel: Mit SIEM-Export scannen (Premium)
508
508
 
509
509
  ```yaml
510
- - uses: lateos/npm-scan@main
510
+ - uses: lateos/npm-scan@v1
511
511
  with:
512
512
  scan-type: lockfile
513
513
  siem-format: cef
package/README.fr.md CHANGED
@@ -373,7 +373,7 @@ jobs:
373
373
  with:
374
374
  node-version: 20
375
375
  - name: Scan lockfile
376
- uses: lateos/npm-scan@main
376
+ uses: lateos/npm-scan@v1
377
377
  with:
378
378
  scan-type: lockfile
379
379
  fail-on: high
@@ -401,7 +401,7 @@ jobs:
401
401
  #### Exemple : scanner un paquet spécifique avec politique + SBOM
402
402
 
403
403
  ```yaml
404
- - uses: lateos/npm-scan@main
404
+ - uses: lateos/npm-scan@v1
405
405
  with:
406
406
  scan-type: package
407
407
  package: lodash
@@ -413,7 +413,7 @@ jobs:
413
413
  #### Exemple : scanner avec export SIEM (premium)
414
414
 
415
415
  ```yaml
416
- - uses: lateos/npm-scan@main
416
+ - uses: lateos/npm-scan@v1
417
417
  with:
418
418
  scan-type: lockfile
419
419
  siem-format: cef
@@ -467,7 +467,7 @@ jobs:
467
467
  with:
468
468
  node-version: 20
469
469
  - name: Scan lockfile
470
- uses: lateos/npm-scan@main
470
+ uses: lateos/npm-scan@v1
471
471
  with:
472
472
  scan-type: lockfile
473
473
  fail-on: high
@@ -495,7 +495,7 @@ jobs:
495
495
  #### Exemple : scanner un paquet spécifique avec politique + SBOM
496
496
 
497
497
  ```yaml
498
- - uses: lateos/npm-scan@main
498
+ - uses: lateos/npm-scan@v1
499
499
  with:
500
500
  scan-type: package
501
501
  package: lodash
@@ -507,7 +507,7 @@ jobs:
507
507
  #### Exemple : scanner avec export SIEM (premium)
508
508
 
509
509
  ```yaml
510
- - uses: lateos/npm-scan@main
510
+ - uses: lateos/npm-scan@v1
511
511
  with:
512
512
  scan-type: lockfile
513
513
  siem-format: cef
package/README.ja.md CHANGED
@@ -369,7 +369,7 @@ jobs:
369
369
  with:
370
370
  node-version: 20
371
371
  - name: Scan lockfile
372
- uses: lateos/npm-scan@main
372
+ uses: lateos/npm-scan@v1
373
373
  with:
374
374
  scan-type: lockfile
375
375
  fail-on: high
@@ -397,7 +397,7 @@ jobs:
397
397
  #### 例:ポリシー+SBOMで特定パッケージをスキャン
398
398
 
399
399
  ```yaml
400
- - uses: lateos/npm-scan@main
400
+ - uses: lateos/npm-scan@v1
401
401
  with:
402
402
  scan-type: package
403
403
  package: lodash
@@ -409,7 +409,7 @@ jobs:
409
409
  #### 例:SIEMエクスポートでスキャン(プレミアム)
410
410
 
411
411
  ```yaml
412
- - uses: lateos/npm-scan@main
412
+ - uses: lateos/npm-scan@v1
413
413
  with:
414
414
  scan-type: lockfile
415
415
  siem-format: cef
@@ -463,7 +463,7 @@ jobs:
463
463
  with:
464
464
  node-version: 20
465
465
  - name: Scan lockfile
466
- uses: lateos/npm-scan@main
466
+ uses: lateos/npm-scan@v1
467
467
  with:
468
468
  scan-type: lockfile
469
469
  fail-on: high
@@ -491,7 +491,7 @@ jobs:
491
491
  #### 例:ポリシー+SBOMで特定パッケージをスキャン
492
492
 
493
493
  ```yaml
494
- - uses: lateos/npm-scan@main
494
+ - uses: lateos/npm-scan@v1
495
495
  with:
496
496
  scan-type: package
497
497
  package: lodash
@@ -503,7 +503,7 @@ jobs:
503
503
  #### 例:SIEMエクスポートでスキャン(プレミアム)
504
504
 
505
505
  ```yaml
506
- - uses: lateos/npm-scan@main
506
+ - uses: lateos/npm-scan@v1
507
507
  with:
508
508
  scan-type: lockfile
509
509
  siem-format: cef
package/README.md CHANGED
@@ -70,6 +70,7 @@ Attackers have moved past simple typosquatting. They now ship **obfuscated prein
70
70
  | 🐳 | **Docker + GitHub Action** | Multi-arch images, one-command Compose pipeline, PR scan action |
71
71
  | 🛡️ | **Zero telemetry** | No data leaves your machine. No cloud. No callbacks. |
72
72
  | 💾 | **Local scan history** | SQLite-backed persistence, zero external dependencies |
73
+ | 🪝 | **Pre-commit hook** | Block threats before commit — one-liner install, scans `package-lock.json` changes |
73
74
 
74
75
  ---
75
76
 
@@ -439,7 +440,7 @@ jobs:
439
440
  #### Example: scan a specific package with policy + SBOM
440
441
 
441
442
  ```yaml
442
- - uses: lateos/npm-scan@main
443
+ - uses: lateos/npm-scan@v1
443
444
  with:
444
445
  scan-type: package
445
446
  package: lodash
@@ -451,7 +452,7 @@ jobs:
451
452
  #### Example: scan with SIEM export (premium)
452
453
 
453
454
  ```yaml
454
- - uses: lateos/npm-scan@main
455
+ - uses: lateos/npm-scan@v1
455
456
  with:
456
457
  scan-type: lockfile
457
458
  siem-format: cef
@@ -505,7 +506,7 @@ jobs:
505
506
  with:
506
507
  node-version: 20
507
508
  - name: Scan lockfile
508
- uses: lateos/npm-scan@main
509
+ uses: lateos/npm-scan@v1
509
510
  with:
510
511
  scan-type: lockfile
511
512
  fail-on: high
@@ -533,7 +534,7 @@ jobs:
533
534
  #### Example: scan a specific package with policy + SBOM
534
535
 
535
536
  ```yaml
536
- - uses: lateos/npm-scan@main
537
+ - uses: lateos/npm-scan@v1
537
538
  with:
538
539
  scan-type: package
539
540
  package: lodash
@@ -545,7 +546,7 @@ jobs:
545
546
  #### Example: scan with SIEM export (premium)
546
547
 
547
548
  ```yaml
548
- - uses: lateos/npm-scan@main
549
+ - uses: lateos/npm-scan@v1
549
550
  with:
550
551
  scan-type: lockfile
551
552
  siem-format: cef
@@ -576,6 +577,32 @@ npm-scan report --html > report.html
576
577
  # path: report.html
577
578
  ```
578
579
 
580
+ ### Pre-commit hook
581
+
582
+ Block supply chain threats **before** they reach version control — no CI required.
583
+
584
+ ```bash
585
+ # One-liner install (requires Node 18+, Git)
586
+ npx husky@latest init && npm install && npx husky add .husky/pre-commit "npx lint-staged"
587
+ ```
588
+
589
+ **What it does:** On every `git commit`, lint-staged detects staged changes to `package.json` or `package-lock.json` and runs `npm-scan scan-lockfile --fail-on high`. Commits are blocked if threats are found.
590
+
591
+ ```bash
592
+ $ git commit -m "bump lodash"
593
+ ✔ Preparing lint-staged configuration...
594
+ ✔ Running tasks for staged package*.json files...
595
+ ✔ npm-scan scan-lockfile --fail-on high
596
+ 🔴 ATK-003: Credential exfiltration (DNS lookup to credentialharvest.example.com)
597
+ 🔴 ATK-007: Typosquat detected (lodash@7.7.7)
598
+ ⚠ Exiting with code 1 — threat(s) found
599
+
600
+ npm scan • @lateos/npm-scan v0.11.6
601
+ error: Command failed with exit code 1.
602
+ ```
603
+
604
+ Add `--no-verify` to bypass for emergencies (`git commit -m "emergency fix" --no-verify`).
605
+
579
606
  ### Docker
580
607
 
581
608
  See the [Docker quick-start section](#-run-lateosnpm-scan-anywhere-with-docker--zero-installation) above for pull commands, Compose pipeline, and multi-arch images.
@@ -592,6 +619,7 @@ See the [Docker quick-start section](#-run-lateosnpm-scan-anywhere-with-docker--
592
619
  - Policy-as-code engine (YAML)
593
620
  - Local SQLite scan history
594
621
  - GitHub Action
622
+ - Pre-commit hook (husky + lint-staged)
595
623
  - Docker images + Compose pipeline
596
624
 
597
625
  ### Premium (🔐 license key)
package/README.zh.md CHANGED
@@ -373,7 +373,7 @@ jobs:
373
373
  with:
374
374
  node-version: 20
375
375
  - name: Scan lockfile
376
- uses: lateos/npm-scan@main
376
+ uses: lateos/npm-scan@v1
377
377
  with:
378
378
  scan-type: lockfile
379
379
  fail-on: high
@@ -401,7 +401,7 @@ jobs:
401
401
  #### 示例:使用策略 + SBOM 扫描特定包
402
402
 
403
403
  ```yaml
404
- - uses: lateos/npm-scan@main
404
+ - uses: lateos/npm-scan@v1
405
405
  with:
406
406
  scan-type: package
407
407
  package: lodash
@@ -413,7 +413,7 @@ jobs:
413
413
  #### 示例:使用 SIEM 导出扫描(高级版)
414
414
 
415
415
  ```yaml
416
- - uses: lateos/npm-scan@main
416
+ - uses: lateos/npm-scan@v1
417
417
  with:
418
418
  scan-type: lockfile
419
419
  siem-format: cef
@@ -467,7 +467,7 @@ jobs:
467
467
  with:
468
468
  node-version: 20
469
469
  - name: Scan lockfile
470
- uses: lateos/npm-scan@main
470
+ uses: lateos/npm-scan@v1
471
471
  with:
472
472
  scan-type: lockfile
473
473
  fail-on: high
@@ -495,7 +495,7 @@ jobs:
495
495
  #### 示例:使用策略 + SBOM 扫描特定包
496
496
 
497
497
  ```yaml
498
- - uses: lateos/npm-scan@main
498
+ - uses: lateos/npm-scan@v1
499
499
  with:
500
500
  scan-type: package
501
501
  package: lodash
@@ -507,7 +507,7 @@ jobs:
507
507
  #### 示例:使用 SIEM 导出扫描(高级版)
508
508
 
509
509
  ```yaml
510
- - uses: lateos/npm-scan@main
510
+ - uses: lateos/npm-scan@v1
511
511
  with:
512
512
  scan-type: lockfile
513
513
  siem-format: cef
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lateos/npm-scan",
3
- "version": "0.11.5",
3
+ "version": "0.12.0",
4
4
  "description": "Modern npm supply chain security scanner — detects obfuscated payloads, credential stealers, conditional triggers, sandbox evasion, and worm-like propagation. 11 attack types, SBOM, NIST/EU CRA compliance reporting.",
5
5
  "main": "backend/index.js",
6
6
  "bin": {
@@ -29,9 +29,13 @@
29
29
  "test": "node --test",
30
30
  "test:coverage": "node --experimental-test-coverage --test",
31
31
  "test:verbose": "node --test --test-reporter spec",
32
+ "prepare": "husky",
32
33
  "build": "echo 'Build stub'",
33
34
  "corpus": "node tests/corpus/run.js"
34
35
  },
36
+ "lint-staged": {
37
+ "**/package{,-lock}.json": "node cli/cli.js scan-lockfile --fail-on high"
38
+ },
35
39
  "publishConfig": {
36
40
  "access": "public"
37
41
  },
@@ -43,5 +47,9 @@
43
47
  "pdf-lib": "^1.17.1",
44
48
  "sql.js": "^1.11.0",
45
49
  "tar": "^7.5.15"
50
+ },
51
+ "devDependencies": {
52
+ "husky": "^9.1.7",
53
+ "lint-staged": "^16.4.0"
46
54
  }
47
55
  }