@lateos/npm-scan 1.0.0 → 1.1.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.
Files changed (129) hide show
  1. package/README.de.md +3 -98
  2. package/README.fr.md +3 -98
  3. package/README.ja.md +3 -98
  4. package/README.md +2 -122
  5. package/README.zh.md +3 -98
  6. package/backend/cra.js +113 -21
  7. package/backend/db.js +18 -10
  8. package/backend/detectors/atk-001-lifecycle.js +5 -5
  9. package/backend/detectors/atk-002-obfusc.js +126 -47
  10. package/backend/detectors/atk-003-creds.js +8 -4
  11. package/backend/detectors/atk-004-persist.js +3 -3
  12. package/backend/detectors/atk-005-exfil.js +8 -4
  13. package/backend/detectors/atk-006-depconf.js +3 -3
  14. package/backend/detectors/atk-007-typosquat.js +64 -10
  15. package/backend/detectors/atk-008-tarball-tamper.js +6 -6
  16. package/backend/detectors/atk-009-dormant-trigger.js +9 -5
  17. package/backend/detectors/atk-010-sandbox-evasion.js +25 -10
  18. package/backend/detectors/atk-011-transitive-prop.js +14 -13
  19. package/backend/detectors/axios-poisoning/d1-version-fingerprint.js +4 -4
  20. package/backend/detectors/axios-poisoning/d2-decoy-dep.js +5 -1
  21. package/backend/detectors/axios-poisoning/d3-postinstall-rat.js +64 -19
  22. package/backend/detectors/axios-poisoning/index.js +77 -60
  23. package/backend/detectors/config/thresholds.js +48 -3
  24. package/backend/detectors/cve-2026-48710-badhost/codePattern.js +26 -9
  25. package/backend/detectors/cve-2026-48710-badhost/findings.js +8 -4
  26. package/backend/detectors/cve-2026-48710-badhost/index.js +1 -1
  27. package/backend/detectors/cve-2026-48710-badhost/manifest.js +127 -39
  28. package/backend/detectors/cve-2026-48710-badhost/transitive.js +87 -28
  29. package/backend/detectors/hf-impersonation/index.js +94 -31
  30. package/backend/detectors/hf-impersonation/jaro-winkler.js +33 -12
  31. package/backend/detectors/hf-impersonation/known-orgs.js +15 -3
  32. package/backend/detectors/hf-impersonation/simhash.js +2 -2
  33. package/backend/detectors/index.js +181 -34
  34. package/backend/detectors/lib/ast-patterns.js +4 -1
  35. package/backend/detectors/lib/entropy-analyzer.js +12 -4
  36. package/backend/detectors/megalodon/d1-workflow-scan.js +40 -16
  37. package/backend/detectors/megalodon/d2-credential-harvest.js +12 -5
  38. package/backend/detectors/megalodon/d3-publish-velocity.js +17 -11
  39. package/backend/detectors/megalodon/d4-publisher-drift.js +48 -16
  40. package/backend/detectors/megalodon/d5-bot-commit-identity.js +1 -1
  41. package/backend/detectors/megalodon/d6-date-anachronism.js +1 -1
  42. package/backend/detectors/megalodon/index.js +35 -25
  43. package/backend/detectors/mini-shai-hulud/d1-burst-publish.js +3 -1
  44. package/backend/detectors/mini-shai-hulud/d2-sibling-compromise.js +22 -10
  45. package/backend/detectors/mini-shai-hulud/d3-slsa-mismatch.js +30 -10
  46. package/backend/detectors/mini-shai-hulud/d4-maintainer-anomaly.js +17 -13
  47. package/backend/detectors/mini-shai-hulud/d5-ioc-check.js +12 -4
  48. package/backend/detectors/mini-shai-hulud/d6-token-exfil.js +6 -2
  49. package/backend/detectors/mini-shai-hulud/index.js +63 -26
  50. package/backend/detectors/msh-supplement/d2-persistence.js +30 -12
  51. package/backend/detectors/msh-supplement/d3-geo-killswitch.js +20 -8
  52. package/backend/detectors/msh-supplement/d4-c2-deaddrop.js +19 -5
  53. package/backend/detectors/msh-supplement/index.js +78 -63
  54. package/backend/detectors/node-ipc-compromise/d1-version-blocklist.js +4 -2
  55. package/backend/detectors/node-ipc-compromise/d10-unauthorized-publisher.js +9 -5
  56. package/backend/detectors/node-ipc-compromise/d11-blast-radius.js +7 -3
  57. package/backend/detectors/node-ipc-compromise/d2-tarball-hash.js +9 -4
  58. package/backend/detectors/node-ipc-compromise/d3-cjs-payload-injection.js +7 -5
  59. package/backend/detectors/node-ipc-compromise/d4-injected-payload-hash.js +4 -2
  60. package/backend/detectors/node-ipc-compromise/d5-dns-c2-pattern.js +13 -10
  61. package/backend/detectors/node-ipc-compromise/d7-dns-txt-exfil.js +3 -1
  62. package/backend/detectors/node-ipc-compromise/d8-runtime-trigger.js +5 -2
  63. package/backend/detectors/node-ipc-compromise/index.js +21 -15
  64. package/backend/detectors/tier1-binary-embed.js +109 -41
  65. package/backend/detectors/tier1-cloud-imds.js +57 -37
  66. package/backend/detectors/tier1-encrypted-c2.js +198 -0
  67. package/backend/detectors/tier1-infostealer.js +121 -68
  68. package/backend/detectors/tier1-lifecycle-hook.js +63 -23
  69. package/backend/detectors/tier1-maintainer-compromise.js +157 -0
  70. package/backend/detectors/tier1-metadata-spoof.js +92 -42
  71. package/backend/detectors/tier1-multistage-postinstall.js +46 -19
  72. package/backend/detectors/tier1-obfuscation-heuristics.js +45 -17
  73. package/backend/detectors/tier1-self-propagation.js +115 -0
  74. package/backend/detectors/tier1-slsa-attestation.js +1 -1
  75. package/backend/detectors/tier1-transitive-deps.js +182 -0
  76. package/backend/detectors/tier1-typosquat.js +129 -50
  77. package/backend/detectors/tier1-version-anomaly.js +77 -41
  78. package/backend/detectors/tier1-version-confusion.js +79 -59
  79. package/backend/detectors/trapdoor/d1-campaign-marker.js +3 -1
  80. package/backend/detectors/trapdoor/d2-payload-fingerprint.js +1 -1
  81. package/backend/detectors/trapdoor/d3-publisher-blocklist.js +4 -3
  82. package/backend/detectors/trapdoor/d4-gists-exfil.js +4 -2
  83. package/backend/detectors/trapdoor/d5-ai-poisoning.js +5 -3
  84. package/backend/detectors/trapdoor/d6-lure-name.js +12 -7
  85. package/backend/detectors/trapdoor/d7-crypto-primitives.js +2 -2
  86. package/backend/detectors/trapdoor/d8-xor-key.js +7 -2
  87. package/backend/detectors/trapdoor/d9-cred-validation.js +4 -5
  88. package/backend/detectors/trapdoor/index.js +19 -14
  89. package/backend/detectors/typosquat-vpmdhaj/d1-maintainer.js +32 -8
  90. package/backend/detectors/typosquat-vpmdhaj/d2-preinstall-loader.js +5 -3
  91. package/backend/detectors/typosquat-vpmdhaj/d3-cred-exfil.js +34 -12
  92. package/backend/detectors/typosquat-vpmdhaj/index.js +78 -59
  93. package/backend/detectors.test.js +78 -19
  94. package/backend/fetch.js +37 -29
  95. package/backend/index.js +1 -1
  96. package/backend/license.js +20 -4
  97. package/backend/lockfile.js +60 -36
  98. package/backend/pdf.js +107 -28
  99. package/backend/policy.js +183 -56
  100. package/backend/provenance.js +28 -3
  101. package/backend/report.js +136 -70
  102. package/backend/sbom.js +33 -27
  103. package/backend/scripts/analyze-false-positives.js +14 -8
  104. package/backend/scripts/analyze-validation.js +27 -21
  105. package/backend/scripts/detect-false-positives.js +20 -10
  106. package/backend/scripts/fetch-top-packages.js +197 -49
  107. package/backend/scripts/validate-d10-d13.js +103 -0
  108. package/backend/scripts/validate-detectors.js +26 -17
  109. package/backend/siem/cef.js +23 -21
  110. package/backend/siem/ecs.js +3 -3
  111. package/backend/siem/index.js +1 -1
  112. package/backend/siem/qradar.js +3 -3
  113. package/backend/siem/sentinel.js +2 -2
  114. package/backend/tests-d5-enhanced.test.js +13 -12
  115. package/backend/tests-d6-version-anomaly.test.js +17 -8
  116. package/backend/tests-d6.test.js +24 -14
  117. package/backend/tests-d6c.test.js +27 -14
  118. package/backend/tests-d7-obfuscation.test.js +9 -12
  119. package/backend/tests.test.js +182 -83
  120. package/backend/vsix-scan/detectors/activation-event-risk.js +36 -19
  121. package/backend/vsix-scan/detectors/burst-publish.js +14 -7
  122. package/backend/vsix-scan/detectors/exfil-pattern.js +7 -3
  123. package/backend/vsix-scan/detectors/known-ioc.js +23 -8
  124. package/backend/vsix-scan/detectors/orphan-commit-fetch.js +11 -7
  125. package/backend/vsix-scan/detectors/publisher-anomaly.js +24 -10
  126. package/backend/vsix-scan/index.js +97 -41
  127. package/backend/vsix-scan/marketplace-client.js +29 -13
  128. package/cli/cli.js +154 -64
  129. package/package.json +12 -3
package/README.de.md CHANGED
@@ -9,8 +9,8 @@
9
9
  [![npm version](https://img.shields.io/npm/v/@lateos/npm-scan?style=flat-square)](https://www.npmjs.com/package/@lateos/npm-scan)
10
10
  [![License](https://img.shields.io/badge/license-Apache%202.0%20%2B%20Commons%20Clause-blue?style=flat-square)](LICENSING.md)
11
11
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square)](package.json)
12
- [![Tests](https://img.shields.io/badge/tests-459%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
- [![Coverage](https://img.shields.io/badge/coverage-85%25-yellowgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
12
+ [![Tests](https://img.shields.io/badge/tests-696%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
+ [![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
14
14
  [![Docker](https://img.shields.io/badge/docker-lateos%2Fnpm--scan-2496ED?style=flat-square&logo=docker)](https://hub.docker.com/r/lateos/npm-scan)
15
15
  [![Sigstore](https://img.shields.io/static/v1?label=Sigstore&message=Provenance&color=green&style=flat-square&logo=sigstore)](https://github.com/lateos-ai/npm-scan/actions/workflows/publish.yml)
16
16
 
@@ -485,102 +485,6 @@ npm-scan report --html > report.html
485
485
 
486
486
  ### Docker
487
487
 
488
- Siehe den obigen [Docker-Schnellstart-Abschnitt](#-lateosnpm-scan-überall-mit-docker-ausführen--keine-installation) für Pull-Befehle, Compose-Pipeline und Multi-Arch-Images.
489
-
490
- Scannen Sie die `package-lock.json` Ihres Projekts bei jedem PR — erkennt Typosquatting, obfuskierte Payloads, Credential-Stealer und Wurmverbreitung, bevor sie die Produktion erreichen:
491
-
492
- ```yaml
493
- # .github/workflows/scan.yml
494
- name: npm-scan
495
- on:
496
- pull_request:
497
- paths:
498
- - 'package-lock.json'
499
- - '**/package.json'
500
- jobs:
501
- scan:
502
- runs-on: ubuntu-latest
503
- steps:
504
- - uses: actions/checkout@v4
505
- - uses: actions/setup-node@v4
506
- with:
507
- node-version: 20
508
- - name: Scan lockfile
509
- uses: lateos/npm-scan@v1
510
- with:
511
- scan-type: lockfile
512
- fail-on: high
513
- ```
514
-
515
- #### Action-Eingaben
516
-
517
- | Eingabe | Standard | Beschreibung |
518
- |-------|---------|-------------|
519
- | `scan-type` | `lockfile` | `lockfile` zum Scannen von `package-lock.json` oder `package` zum Scannen eines bestimmten npm-Pakets |
520
- | `package` | — | Paketname (erforderlich bei `scan-type=package`) |
521
- | `fail-on` | `high` | Workflow bei diesem Schweregrad-Schwellwert fehlschlagen lassen: `none`, `low`, `medium`, `high`, `critical` |
522
- | `policy-file` | — | Pfad zu einer YAML/JSON-Policy-Datei für Whitelists, Schweregrad-Überschreibungen und Unterdrückungen |
523
- | `license-key` | — | Premium-Lizenzschlüssel für SIEM-Export und PDF-Berichte |
524
- | `siem-format` | — | SIEM-Ausgabe: `cef`, `ecs`, `sentinel`, `qradar` (Premium) |
525
- | `sbom-format` | — | SBOM-Ausgabe: `json`, `xml`, `spdx` |
526
-
527
- #### Action-Ausgaben
528
-
529
- | Ausgabe | Beschreibung |
530
- |--------|-------------|
531
- | `findings-count` | Anzahl der erkannten Ergebnisse |
532
- | `scan-id` | Scan-ID für spätere Referenz in Berichten |
533
-
534
- #### Beispiel: Bestimmtes Paket mit Policy + SBOM scannen
535
-
536
- ```yaml
537
- - uses: lateos/npm-scan@v1
538
- with:
539
- scan-type: package
540
- package: lodash
541
- policy-file: .npm-scan.yml
542
- sbom-format: spdx
543
- fail-on: critical
544
- ```
545
-
546
- #### Beispiel: Mit SIEM-Export scannen (Premium)
547
-
548
- ```yaml
549
- - uses: lateos/npm-scan@v1
550
- with:
551
- scan-type: lockfile
552
- siem-format: cef
553
- license-key: ${{ secrets.NPM_SCAN_LICENSE_KEY }}
554
- ```
555
-
556
- ### CI/CD-Pipeline
557
-
558
- Direkte Integration in Ihre bestehende Pipeline ohne die Composite-Action:
559
-
560
- ```bash
561
- # Lock-Datei scannen, Build bei hohem Schweregrad fehlschlagen lassen
562
- npm-scan scan-lockfile --policy .npm-scan.yml || exit 1
563
-
564
- # Bestimmtes Paket scannen, nur bei kritisch fehlschlagen
565
- npm-scan scan lodash --policy .npm-scan.yml || exit 1
566
-
567
- # SBOM als Build-Artefakt generieren
568
- npm-scan scan express --sbom spdx > express-sbom.spdx.json
569
-
570
- # HTML-Compliance-Bericht in CI generieren
571
- npm-scan report --html > report.html
572
-
573
- # Bericht als Artefakt hochladen
574
- # uses: actions/upload-artifact@v4
575
- # with:
576
- # name: npm-scan-report
577
- # path: report.html
578
- ```
579
-
580
- ### Docker
581
-
582
- Siehe den obigen [Docker-Schnellstart-Abschnitt](#-lateosnpm-scan-überall-mit-docker-ausführen--keine-installation) für Pull-Befehle, Compose-Pipeline und Multi-Arch-Images.
583
-
584
488
  ---
585
489
 
586
490
  ## 🗺️ Roadmap und Enterprise-Funktionen
@@ -706,4 +610,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
706
610
 
707
611
  ```bash
708
612
  npx @lateos/npm-scan scan lodash
613
+ ```
709
614
  ```
package/README.fr.md CHANGED
@@ -9,8 +9,8 @@
9
9
  [![npm version](https://img.shields.io/npm/v/@lateos/npm-scan?style=flat-square)](https://www.npmjs.com/package/@lateos/npm-scan)
10
10
  [![License](https://img.shields.io/badge/license-Apache%202.0%20%2B%20Commons%20Clause-blue?style=flat-square)](LICENSING.md)
11
11
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square)](package.json)
12
- [![Tests](https://img.shields.io/badge/tests-459%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
- [![Coverage](https://img.shields.io/badge/coverage-85%25-yellowgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
12
+ [![Tests](https://img.shields.io/badge/tests-696%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
+ [![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
14
14
  [![Docker](https://img.shields.io/badge/docker-lateos%2Fnpm--scan-2496ED?style=flat-square&logo=docker)](https://hub.docker.com/r/lateos/npm-scan)
15
15
  [![Sigstore](https://img.shields.io/static/v1?label=Sigstore&message=Provenance&color=green&style=flat-square&logo=sigstore)](https://github.com/lateos-ai/npm-scan/actions/workflows/publish.yml)
16
16
 
@@ -485,102 +485,6 @@ npm-scan report --html > report.html
485
485
 
486
486
  ### Docker
487
487
 
488
- Voir la [section Démarrage rapide Docker](#-exécutez-lateosnpm-scan-partout-avec-docker--zéro-installation) ci-dessus pour les commandes de tirage, le pipeline Compose et les images multi-arch.
489
-
490
- Scannez le `package-lock.json` de votre projet à chaque PR — détecte les typosquattings, les charges utiles obfusquées, les voleurs d'identifiants et la propagation de ver avant qu'ils n'atteignent la production :
491
-
492
- ```yaml
493
- # .github/workflows/scan.yml
494
- name: npm-scan
495
- on:
496
- pull_request:
497
- paths:
498
- - 'package-lock.json'
499
- - '**/package.json'
500
- jobs:
501
- scan:
502
- runs-on: ubuntu-latest
503
- steps:
504
- - uses: actions/checkout@v4
505
- - uses: actions/setup-node@v4
506
- with:
507
- node-version: 20
508
- - name: Scan lockfile
509
- uses: lateos/npm-scan@v1
510
- with:
511
- scan-type: lockfile
512
- fail-on: high
513
- ```
514
-
515
- #### Entrées de l'action
516
-
517
- | Entrée | Défaut | Description |
518
- |-------|---------|-------------|
519
- | `scan-type` | `lockfile` | `lockfile` pour scanner `package-lock.json` ou `package` pour scanner un paquet npm spécifique |
520
- | `package` | — | Nom du paquet (requis quand `scan-type=package`) |
521
- | `fail-on` | `high` | Faire échouer le workflow à ce seuil de sévérité : `none`, `low`, `medium`, `high`, `critical` |
522
- | `policy-file` | — | Chemin vers un fichier de politique YAML/JSON pour listes blanches, surcharges de sévérité et suppressions |
523
- | `license-key` | — | Clé de licence premium pour l'export SIEM et les rapports PDF |
524
- | `siem-format` | — | Sortie SIEM : `cef`, `ecs`, `sentinel`, `qradar` (premium) |
525
- | `sbom-format` | — | Sortie SBOM : `json`, `xml`, `spdx` |
526
-
527
- #### Sorties de l'action
528
-
529
- | Sortie | Description |
530
- |--------|-------------|
531
- | `findings-count` | Nombre de résultats détectés |
532
- | `scan-id` | ID du scan pour référence ultérieure dans les rapports |
533
-
534
- #### Exemple : scanner un paquet spécifique avec politique + SBOM
535
-
536
- ```yaml
537
- - uses: lateos/npm-scan@v1
538
- with:
539
- scan-type: package
540
- package: lodash
541
- policy-file: .npm-scan.yml
542
- sbom-format: spdx
543
- fail-on: critical
544
- ```
545
-
546
- #### Exemple : scanner avec export SIEM (premium)
547
-
548
- ```yaml
549
- - uses: lateos/npm-scan@v1
550
- with:
551
- scan-type: lockfile
552
- siem-format: cef
553
- license-key: ${{ secrets.NPM_SCAN_LICENSE_KEY }}
554
- ```
555
-
556
- ### Pipeline CI/CD
557
-
558
- Intégrez directement dans votre pipeline existant sans l'action composite :
559
-
560
- ```bash
561
- # Scanner le fichier de verrouillage, échouer le build en sévérité élevée
562
- npm-scan scan-lockfile --policy .npm-scan.yml || exit 1
563
-
564
- # Scanner un paquet spécifique, échouer seulement sur critique
565
- npm-scan scan lodash --policy .npm-scan.yml || exit 1
566
-
567
- # Générer un SBOM comme artefact de build
568
- npm-scan scan express --sbom spdx > express-sbom.spdx.json
569
-
570
- # Générer un rapport de conformité HTML dans le CI
571
- npm-scan report --html > report.html
572
-
573
- # Télécharger le rapport comme artefact
574
- # uses: actions/upload-artifact@v4
575
- # with:
576
- # name: npm-scan-report
577
- # path: report.html
578
- ```
579
-
580
- ### Docker
581
-
582
- Voir la [section Démarrage rapide Docker](#-exécutez-lateosnpm-scan-partout-avec-docker--zéro-installation) ci-dessus pour les commandes de tirage, le pipeline Compose et les images multi-arch.
583
-
584
488
  ---
585
489
 
586
490
  ## 🗺️ Feuille de route et fonctionnalités Enterprise
@@ -706,4 +610,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
706
610
 
707
611
  ```bash
708
612
  npx @lateos/npm-scan scan lodash
613
+ ```
709
614
  ```
package/README.ja.md CHANGED
@@ -9,8 +9,8 @@
9
9
  [![npm version](https://img.shields.io/npm/v/@lateos/npm-scan?style=flat-square)](https://www.npmjs.com/package/@lateos/npm-scan)
10
10
  [![License](https://img.shields.io/badge/license-Apache%202.0%20%2B%20Commons%20Clause-blue?style=flat-square)](LICENSING.md)
11
11
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square)](package.json)
12
- [![Tests](https://img.shields.io/badge/tests-459%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
- [![Coverage](https://img.shields.io/badge/coverage-85%25-yellowgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
12
+ [![Tests](https://img.shields.io/badge/tests-696%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
+ [![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
14
14
  [![Docker](https://img.shields.io/badge/docker-lateos%2Fnpm--scan-2496ED?style=flat-square&logo=docker)](https://hub.docker.com/r/lateos/npm-scan)
15
15
  [![Sigstore](https://img.shields.io/static/v1?label=Sigstore&message=Provenance&color=green&style=flat-square&logo=sigstore)](https://github.com/lateos-ai/npm-scan/actions/workflows/publish.yml)
16
16
 
@@ -481,102 +481,6 @@ npm-scan report --html > report.html
481
481
 
482
482
  ### Docker
483
483
 
484
- 上記の[Dockerクイックスタート](#-dockerでlateosnpm-scanをどこでも実行--インストール不要)セクションを参照してください。プルコマンド、Composeパイプライン、マルチアーキテクチャイメージについて説明しています。
485
-
486
- すべてのPRでプロジェクトの`package-lock.json`をスキャン——タイポスクワッティング、難読化ペイロード、認証情報窃取ツール、ワーム伝播を本番環境に到達する前に検出:
487
-
488
- ```yaml
489
- # .github/workflows/scan.yml
490
- name: npm-scan
491
- on:
492
- pull_request:
493
- paths:
494
- - 'package-lock.json'
495
- - '**/package.json'
496
- jobs:
497
- scan:
498
- runs-on: ubuntu-latest
499
- steps:
500
- - uses: actions/checkout@v4
501
- - uses: actions/setup-node@v4
502
- with:
503
- node-version: 20
504
- - name: Scan lockfile
505
- uses: lateos/npm-scan@v1
506
- with:
507
- scan-type: lockfile
508
- fail-on: high
509
- ```
510
-
511
- #### Action入力
512
-
513
- | 入力 | デフォルト | 説明 |
514
- |-------|---------|-------------|
515
- | `scan-type` | `lockfile` | `lockfile`は`package-lock.json`をスキャン、`package`は特定のnpmパッケージをスキャン |
516
- | `package` | — | パッケージ名(`scan-type=package`時に必須) |
517
- | `fail-on` | `high` | この重要度しきい値でワークフローを失敗させる:`none`、`low`、`medium`、`high`、`critical` |
518
- | `policy-file` | — | 許可リスト、重要度上書き、抑制用のYAML/JSONポリシーファイルへのパス |
519
- | `license-key` | — | SIEMエクスポートとPDFレポート用のプレミアムライセンスキー |
520
- | `siem-format` | — | SIEM出力:`cef`、`ecs`、`sentinel`、`qradar`(プレミアム) |
521
- | `sbom-format` | — | SBOM出力:`json`、`xml`、`spdx` |
522
-
523
- #### Action出力
524
-
525
- | 出力 | 説明 |
526
- |--------|-------------|
527
- | `findings-count` | 検出された発見項目の数 |
528
- | `scan-id` | 後でレポートで参照するためのスキャンID |
529
-
530
- #### 例:ポリシー+SBOMで特定パッケージをスキャン
531
-
532
- ```yaml
533
- - uses: lateos/npm-scan@v1
534
- with:
535
- scan-type: package
536
- package: lodash
537
- policy-file: .npm-scan.yml
538
- sbom-format: spdx
539
- fail-on: critical
540
- ```
541
-
542
- #### 例:SIEMエクスポートでスキャン(プレミアム)
543
-
544
- ```yaml
545
- - uses: lateos/npm-scan@v1
546
- with:
547
- scan-type: lockfile
548
- siem-format: cef
549
- license-key: ${{ secrets.NPM_SCAN_LICENSE_KEY }}
550
- ```
551
-
552
- ### CI/CDパイプライン
553
-
554
- 複合アクションを使わずに既存のパイプラインに直接統合:
555
-
556
- ```bash
557
- # ロックファイルをスキャン、高重要度でビルドを失敗
558
- npm-scan scan-lockfile --policy .npm-scan.yml || exit 1
559
-
560
- # 特定のパッケージをスキャン、クリティカルのみで失敗
561
- npm-scan scan lodash --policy .npm-scan.yml || exit 1
562
-
563
- # SBOMをビルドアーティファクトとして生成
564
- npm-scan scan express --sbom spdx > express-sbom.spdx.json
565
-
566
- # CIでHTMLコンプライアンスレポートを生成
567
- npm-scan report --html > report.html
568
-
569
- # レポートをアーティファクトとしてアップロード
570
- # uses: actions/upload-artifact@v4
571
- # with:
572
- # name: npm-scan-report
573
- # path: report.html
574
- ```
575
-
576
- ### Docker
577
-
578
- 上記の[Dockerクイックスタート](#-dockerでlateosnpm-scanをどこでも実行--インストール不要)セクションを参照してください。プルコマンド、Composeパイプライン、マルチアーキテクチャイメージについて説明しています。
579
-
580
484
  ---
581
485
 
582
486
  ## 🗺️ ロードマップとエンタープライズ機能
@@ -702,4 +606,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
702
606
 
703
607
  ```bash
704
608
  npx @lateos/npm-scan scan lodash
609
+ ```
705
610
  ```
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@lateos/npm-scan?style=flat-square)](https://www.npmjs.com/package/@lateos/npm-scan)
4
4
  [![License](https://img.shields.io/badge/license-Apache%202.0%20%2B%20Commons%20Clause-blue?style=flat-square)](LICENSING.md)
5
5
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square)](package.json)
6
- [![Tests](https://img.shields.io/badge/tests-536%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
6
+ [![Tests](https://img.shields.io/badge/tests-696%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
7
7
  [![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
8
8
  [![Docker](https://img.shields.io/badge/docker-lateos%2Fnpm--scan-2496ED?style=flat-square&logo=docker)](https://hub.docker.com/r/lateos/npm-scan)
9
9
  [![Sigstore](https://img.shields.io/static/v1?label=Sigstore&message=Provenance&color=green&style=flat-square&logo=sigstore)](https://github.com/lateos-ai/npm-scan/actions/workflows/publish.yml)
@@ -596,126 +596,6 @@ npm-scan report --html > report.html
596
596
 
597
597
  See the [Docker quick-start section](#-run-lateosnpm-scan-anywhere-with-docker--zero-installation) above for pull commands, Compose pipeline, and multi-arch images.
598
598
 
599
- Scan your project's `package-lock.json` on every PR — detects typosquats, obfuscated payloads, credential harvesters, and worm propagation before they reach production:
600
-
601
- ```yaml
602
- # .github/workflows/scan.yml
603
- name: npm-scan
604
- on:
605
- pull_request:
606
- paths:
607
- - 'package-lock.json'
608
- - '**/package.json'
609
- jobs:
610
- scan:
611
- runs-on: ubuntu-latest
612
- steps:
613
- - uses: actions/checkout@v4
614
- - uses: actions/setup-node@v4
615
- with:
616
- node-version: 20
617
- - name: Scan lockfile
618
- uses: lateos/npm-scan@v1
619
- with:
620
- scan-type: lockfile
621
- fail-on: high
622
- ```
623
-
624
- #### Action inputs
625
-
626
- | Input | Default | Description |
627
- |-------|---------|-------------|
628
- | `scan-type` | `lockfile` | `lockfile` to scan `package-lock.json` or `package` to scan a specific npm package |
629
- | `package` | — | Package name (required when `scan-type=package`) |
630
- | `fail-on` | `high` | Fail the workflow at this severity threshold: `none`, `low`, `medium`, `high`, `critical` |
631
- | `policy-file` | — | Path to a YAML/JSON policy file for allowlists, severity overrides, and suppressions |
632
- | `license-key` | — | Premium license key for SIEM export and PDF reports |
633
- | `siem-format` | — | SIEM output: `cef`, `ecs`, `sentinel`, `qradar` (premium) |
634
- | `sbom-format` | — | SBOM output: `json`, `xml`, `spdx` |
635
-
636
- #### Action outputs
637
-
638
- | Output | Description |
639
- |--------|-------------|
640
- | `findings-count` | Number of findings detected |
641
- | `scan-id` | Scan ID for later reference in reports |
642
-
643
- #### Example: scan a specific package with policy + SBOM
644
-
645
- ```yaml
646
- - uses: lateos/npm-scan@v1
647
- with:
648
- scan-type: package
649
- package: lodash
650
- policy-file: .npm-scan.yml
651
- sbom-format: spdx
652
- fail-on: critical
653
- ```
654
-
655
- #### Example: scan with SIEM export (premium)
656
-
657
- ```yaml
658
- - uses: lateos/npm-scan@v1
659
- with:
660
- scan-type: lockfile
661
- siem-format: cef
662
- license-key: ${{ secrets.NPM_SCAN_LICENSE_KEY }}
663
- ```
664
-
665
- ### CI/CD pipeline
666
-
667
- Integrate directly into your existing pipeline without the composite action:
668
-
669
- ```bash
670
- # Scan lockfile, fail build on high severity
671
- npm-scan scan-lockfile --policy .npm-scan.yml || exit 1
672
-
673
- # Scan a specific package, fail on critical only
674
- npm-scan scan lodash --policy .npm-scan.yml || exit 1
675
-
676
- # Generate SBOM as a build artifact
677
- npm-scan scan express --sbom spdx > express-sbom.spdx.json
678
-
679
- # Generate HTML compliance report in CI
680
- npm-scan report --html > report.html
681
-
682
- # Upload report as an artifact
683
- # uses: actions/upload-artifact@v4
684
- # with:
685
- # name: npm-scan-report
686
- # path: report.html
687
- ```
688
-
689
- ### Pre-commit hook
690
-
691
- Block supply chain threats **before** they reach version control — no CI required.
692
-
693
- ```bash
694
- # One-liner install (requires Node 18+, Git)
695
- npx husky@latest init && npm install && npx husky add .husky/pre-commit "npx lint-staged"
696
- ```
697
-
698
- **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.
699
-
700
- ```bash
701
- $ git commit -m "bump lodash"
702
- ✔ Preparing lint-staged configuration...
703
- ✔ Running tasks for staged package*.json files...
704
- ✔ npm-scan scan-lockfile --fail-on high
705
- 🔴 ATK-003: Credential exfiltration (DNS lookup to credentialharvest.example.com)
706
- 🔴 ATK-007: Typosquat detected (lodash@7.7.7)
707
- ⚠ Exiting with code 1 — threat(s) found
708
-
709
- npm scan • @lateos/npm-scan v0.11.6
710
- error: Command failed with exit code 1.
711
- ```
712
-
713
- Add `--no-verify` to bypass for emergencies (`git commit -m "emergency fix" --no-verify`).
714
-
715
- ### Docker
716
-
717
- See the [Docker quick-start section](#-run-lateosnpm-scan-anywhere-with-docker--zero-installation) above for pull commands, Compose pipeline, and multi-arch images.
718
-
719
599
  ---
720
600
 
721
601
  ## 🗺️ Roadmap & Enterprise Features
@@ -858,4 +738,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
858
738
 
859
739
  ```bash
860
740
  npx @lateos/npm-scan scan lodash
861
- ```
741
+ ```
package/README.zh.md CHANGED
@@ -9,8 +9,8 @@
9
9
  [![npm version](https://img.shields.io/npm/v/@lateos/npm-scan?style=flat-square)](https://www.npmjs.com/package/@lateos/npm-scan)
10
10
  [![License](https://img.shields.io/badge/license-Apache%202.0%20%2B%20Commons%20Clause-blue?style=flat-square)](LICENSING.md)
11
11
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square)](package.json)
12
- [![Tests](https://img.shields.io/badge/tests-459%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
- [![Coverage](https://img.shields.io/badge/coverage-85%25-yellowgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
12
+ [![Tests](https://img.shields.io/badge/tests-696%20passing-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
13
+ [![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen?style=flat-square)](https://github.com/lateos-ai/npm-scan)
14
14
  [![Docker](https://img.shields.io/badge/docker-lateos%2Fnpm--scan-2496ED?style=flat-square&logo=docker)](https://hub.docker.com/r/lateos/npm-scan)
15
15
  [![Sigstore](https://img.shields.io/static/v1?label=Sigstore&message=Provenance&color=green&style=flat-square&logo=sigstore)](https://github.com/lateos-ai/npm-scan/actions/workflows/publish.yml)
16
16
 
@@ -485,102 +485,6 @@ npm-scan report --html > report.html
485
485
 
486
486
  ### Docker
487
487
 
488
- 请参见上方的 [Docker 快速入门部分](#-在任何地方通过-docker-运行-lateosnpm-scan--零安装),了解拉取命令、Compose 流水线和多架构镜像。
489
-
490
- 在每个 PR 上扫描您项目的 `package-lock.json`——在它们进入生产环境之前检测域名抢注、混淆载荷、凭证窃取器和蠕虫传播:
491
-
492
- ```yaml
493
- # .github/workflows/scan.yml
494
- name: npm-scan
495
- on:
496
- pull_request:
497
- paths:
498
- - 'package-lock.json'
499
- - '**/package.json'
500
- jobs:
501
- scan:
502
- runs-on: ubuntu-latest
503
- steps:
504
- - uses: actions/checkout@v4
505
- - uses: actions/setup-node@v4
506
- with:
507
- node-version: 20
508
- - name: Scan lockfile
509
- uses: lateos/npm-scan@v1
510
- with:
511
- scan-type: lockfile
512
- fail-on: high
513
- ```
514
-
515
- #### Action 输入
516
-
517
- | 输入 | 默认值 | 描述 |
518
- |-------|---------|-------------|
519
- | `scan-type` | `lockfile` | `lockfile` 扫描 `package-lock.json` 或 `package` 扫描特定 npm 包 |
520
- | `package` | — | 包名(`scan-type=package` 时需要) |
521
- | `fail-on` | `high` | 在此严重性阈值处使工作流失败:`none`、`low`、`medium`、`high`、`critical` |
522
- | `policy-file` | — | YAML/JSON 策略文件路径,用于白名单、严重性覆盖和抑制 |
523
- | `license-key` | — | 用于 SIEM 导出和 PDF 报告的高级版许可证密钥 |
524
- | `siem-format` | — | SIEM 输出:`cef`、`ecs`、`sentinel`、`qradar`(高级版) |
525
- | `sbom-format` | — | SBOM 输出:`json`、`xml`、`spdx` |
526
-
527
- #### Action 输出
528
-
529
- | 输出 | 描述 |
530
- |--------|-------------|
531
- | `findings-count` | 检测到的发现项数量 |
532
- | `scan-id` | 扫描 ID,用于后续报告引用 |
533
-
534
- #### 示例:使用策略 + SBOM 扫描特定包
535
-
536
- ```yaml
537
- - uses: lateos/npm-scan@v1
538
- with:
539
- scan-type: package
540
- package: lodash
541
- policy-file: .npm-scan.yml
542
- sbom-format: spdx
543
- fail-on: critical
544
- ```
545
-
546
- #### 示例:使用 SIEM 导出扫描(高级版)
547
-
548
- ```yaml
549
- - uses: lateos/npm-scan@v1
550
- with:
551
- scan-type: lockfile
552
- siem-format: cef
553
- license-key: ${{ secrets.NPM_SCAN_LICENSE_KEY }}
554
- ```
555
-
556
- ### CI/CD 流水线
557
-
558
- 直接集成到您现有的流水线中,无需复合操作:
559
-
560
- ```bash
561
- # 扫描锁定文件,在高严重性时使构建失败
562
- npm-scan scan-lockfile --policy .npm-scan.yml || exit 1
563
-
564
- # 扫描特定包,仅在严重时失败
565
- npm-scan scan lodash --policy .npm-scan.yml || exit 1
566
-
567
- # 生成 SBOM 作为构建产物
568
- npm-scan scan express --sbom spdx > express-sbom.spdx.json
569
-
570
- # 在 CI 中生成 HTML 合规报告
571
- npm-scan report --html > report.html
572
-
573
- # 上传报告作为产物
574
- # uses: actions/upload-artifact@v4
575
- # with:
576
- # name: npm-scan-report
577
- # path: report.html
578
- ```
579
-
580
- ### Docker
581
-
582
- 请参见上方的 [Docker 快速入门部分](#-在任何地方通过-docker-运行-lateosnpm-scan--零安装),了解拉取命令、Compose 流水线和多架构镜像。
583
-
584
488
  ---
585
489
 
586
490
  ## 🗺️ 路线图与企业功能
@@ -706,4 +610,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
706
610
 
707
611
  ```bash
708
612
  npx @lateos/npm-scan scan lodash
613
+ ```
709
614
  ```