narvy-cli 1.3.1__tar.gz → 1.3.3__tar.gz

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 (130) hide show
  1. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/CHANGELOG.md +50 -0
  2. {narvy_cli-1.3.1/narvy_cli.egg-info → narvy_cli-1.3.3}/PKG-INFO +7 -1
  3. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/README.md +6 -0
  4. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/__init__.py +1 -1
  5. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ci_templates/bitbucket.yml +11 -5
  6. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ci_templates/github.yml +1 -1
  7. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ci_templates/gitlab.yml +1 -1
  8. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/main.py +95 -15
  9. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/osv_client.py +76 -10
  10. narvy_cli-1.3.3/narvy/sca/severity_calibration.py +320 -0
  11. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/web_deps.py +312 -15
  12. {narvy_cli-1.3.1 → narvy_cli-1.3.3/narvy_cli.egg-info}/PKG-INFO +7 -1
  13. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy_cli.egg-info/SOURCES.txt +1 -0
  14. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/LICENSE +0 -0
  15. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/MANIFEST.in +0 -0
  16. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/SECURITY.md +0 -0
  17. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/__main__.py +0 -0
  18. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/android/__init__.py +0 -0
  19. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/android/source_analyzer.py +0 -0
  20. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/android/split_bundle.py +0 -0
  21. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/android_rule_context.py +0 -0
  22. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/apk_memory_preflight.py +0 -0
  23. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/auth.py +0 -0
  24. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cbom.py +0 -0
  25. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/__init__.py +0 -0
  26. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/aws_scan.py +0 -0
  27. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/gcp_scan.py +0 -0
  28. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/normalize.py +0 -0
  29. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/rule_severity.py +0 -0
  30. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/severity.py +0 -0
  31. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/cloud/upload.py +0 -0
  32. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/comment_filter.py +0 -0
  33. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/crypto_taint_lite.py +0 -0
  34. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/decompiler.py +0 -0
  35. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/doctor.py +0 -0
  36. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/gitlab_report.py +0 -0
  37. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/__init__.py +0 -0
  38. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/audit.py +0 -0
  39. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/host_knowledge.py +0 -0
  40. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/lynis_bootstrap.py +0 -0
  41. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/lynis_parser.py +0 -0
  42. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/narvy_checks.py +0 -0
  43. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/report.py +0 -0
  44. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/host/ssh_exec.py +0 -0
  45. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ios/__init__.py +0 -0
  46. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ios/binary_analyzer.py +0 -0
  47. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ios/plist_checks.py +0 -0
  48. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ios/source_analyzer.py +0 -0
  49. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ios/third_party_filter.py +0 -0
  50. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/ios/trust_all_context.py +0 -0
  51. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/native_hardening.py +0 -0
  52. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/own_reports.py +0 -0
  53. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/pathhint.py +0 -0
  54. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/pathnorm.py +0 -0
  55. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/proc.py +0 -0
  56. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/repo_identity.py +0 -0
  57. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/reporter.py +0 -0
  58. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rule_engine.py +0 -0
  59. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/android/config.yml +0 -0
  60. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/android/crypto.yml +0 -0
  61. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/android/secrets.yml +0 -0
  62. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/android/storage.yml +0 -0
  63. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/android/webview.yml +0 -0
  64. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/android.yml +0 -0
  65. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/ios/objc/crypto.yml +0 -0
  66. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/ios/objc/network.yml +0 -0
  67. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/ios/objc/secrets.yml +0 -0
  68. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/ios/objc/storage.yml +0 -0
  69. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/ios/objc/webview.yml +0 -0
  70. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/ios_swift.yml +0 -0
  71. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/go.yml +0 -0
  72. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/java.yml +0 -0
  73. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/javascript.yml +0 -0
  74. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/kotlin.yml +0 -0
  75. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/php.yml +0 -0
  76. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/python.yml +0 -0
  77. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/ruby.yml +0 -0
  78. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/rust.yml +0 -0
  79. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/secrets.yml +0 -0
  80. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/rules/web/secrets_supplement.yml +0 -0
  81. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sbom.py +0 -0
  82. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/__init__.py +0 -0
  83. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/android_deps.py +0 -0
  84. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/ios_deps.py +0 -0
  85. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/osv_localdb.py +0 -0
  86. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/sca/osv_semantic.py +0 -0
  87. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/scope_config.py +0 -0
  88. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/secret_output.py +0 -0
  89. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/secret_presentation.py +0 -0
  90. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/secret_value_grade.py +0 -0
  91. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/semgrep_engine.py +0 -0
  92. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/stack_protector_evidence.py +0 -0
  93. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/__init__.py +0 -0
  94. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/__main__.py +0 -0
  95. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/analyze.py +0 -0
  96. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/__init__.py +0 -0
  97. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/arsc.py +0 -0
  98. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/axml.py +0 -0
  99. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/checks.py +0 -0
  100. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/elf.py +0 -0
  101. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/loader.py +0 -0
  102. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/protoxml.py +0 -0
  103. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/android/xmlmodel.py +0 -0
  104. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/archive.py +0 -0
  105. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/cli.py +0 -0
  106. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/data/__init__.py +0 -0
  107. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/data/apple.py +0 -0
  108. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/data/play.py +0 -0
  109. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/ios/__init__.py +0 -0
  110. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/ios/checks.py +0 -0
  111. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/ios/loader.py +0 -0
  112. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/ios/macho.py +0 -0
  113. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/store_check/model.py +0 -0
  114. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/telemetry.py +0 -0
  115. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/third_party_filter.py +0 -0
  116. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/uploader.py +0 -0
  117. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/weak_prng_context.py +0 -0
  118. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/web/__init__.py +0 -0
  119. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/web/nuclei_binary.py +0 -0
  120. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/web/scan_blocklist.py +0 -0
  121. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/web/scanner.py +0 -0
  122. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/web/source_analyzer.py +0 -0
  123. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy/web/ssrf_guard.py +0 -0
  124. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy_cli.egg-info/dependency_links.txt +0 -0
  125. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy_cli.egg-info/entry_points.txt +0 -0
  126. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy_cli.egg-info/requires.txt +0 -0
  127. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/narvy_cli.egg-info/top_level.txt +0 -0
  128. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/pyproject.toml +0 -0
  129. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/setup.cfg +0 -0
  130. {narvy_cli-1.3.1 → narvy_cli-1.3.3}/setup.py +0 -0
@@ -5,6 +5,56 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.3]
9
+
10
+ ### Fixed
11
+
12
+ - Dependency check: `packages/` folders are read again. JS workspaces (npm,
13
+ yarn, pnpm, Lerna, Nx, Turborepo) lost the dependencies of their members.
14
+ The members declared in `package.json` `workspaces`, `pnpm-workspace.yaml`,
15
+ `lerna.json`, Cargo `[workspace] members` and `go.work` are read even in a
16
+ folder the walk skips. A package@version found in the root lockfile and in
17
+ member manifests is one dependency; a finding lists every manifest that
18
+ declares it (`sca.manifests`). A NuGet restore folder named `packages/` is
19
+ still skipped.
20
+ - `package-lock.json`: the lock entry of a workspace member (`packages/a`) is
21
+ no longer read as a dependency named `packages/a`.
22
+
23
+ ### Changed
24
+
25
+ - `--fail-on`: an Info finding never fails the build, `any` means Low and
26
+ above (the narvy.io gate rule). Low findings fail `--fail-on low`.
27
+ - `scan --upload`: the upload line says `reactivated` when the scan brought
28
+ back an app removed in Narvy, and how it was matched.
29
+ - Info findings stay in the upload (narvy.io keeps them out of the default
30
+ view). Locked by a test; 1.3.2 already sent them.
31
+
32
+ ## [1.3.2]
33
+
34
+ ### Changed
35
+
36
+ - `scan --upload --fail-on`: findings your team dismissed in Narvy (false
37
+ positive, accepted risk, won't fix) no longer fail the build. The CLI
38
+ reads them from the `dismissed` field of the upload response and prints
39
+ how many it left out. Without `--upload`, or when the server does not
40
+ send that field, the gate uses every local finding as before. A failed
41
+ upload still exits 4 before the gate runs. Reports and the upload itself
42
+ keep every finding.
43
+ - Dependency findings of a source scan get the same severity as on
44
+ narvy.io: the platform's calibration is ported as is
45
+ (`narvy/sca/severity_calibration.py`). A CVE fixed by a release that the
46
+ declared range already admits does not set the severity, and a package
47
+ whose CVEs are all in that case is Low (morgan@1.9.0 with `^1.9.0`: Low,
48
+ was Critical). Also ported: the GitHub-reviewed advisory rating, the
49
+ local or physical attack vector cap (Medium), dev-only dependencies
50
+ (Low) and Go packages whose affected import path is not imported (Low).
51
+ Not ported: the build-only scope (lockfile graph) and the advisory
52
+ preconditions (proxy-addr, ws, nanoid). The advisory's own rating is kept
53
+ in `severity_advisory`, the reasons in `severity_calibration`.
54
+ - `init-ci` templates install `narvy-cli>=1.3.2`. The Bitbucket template
55
+ also runs on pull requests (`pull-requests: '**'`, same step), and
56
+ `init-ci` says when each template runs.
57
+
8
58
  ## [1.3.1]
9
59
 
10
60
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: narvy-cli
3
- Version: 1.3.1
3
+ Version: 1.3.3
4
4
  Summary: Local static security scanner for Android and iOS apps and source code, with offline Google Play and App Store upload checks.
5
5
  Author: Narvy
6
6
  License: Apache-2.0
@@ -366,6 +366,12 @@ scan starts: a rejected token or an unreachable server exits 4 right away.
366
366
  | 4 | The scan, login, upload or report write failed |
367
367
  | 130 | Interrupted (Ctrl-C, SIGTERM) |
368
368
 
369
+ With `--upload`, `--fail-on` leaves out the findings your team dismissed in
370
+ Narvy (false positive, accepted risk, won't fix), as listed in the upload
371
+ response, and says how many. Without `--upload`, or when the server does
372
+ not return that list, every local finding counts. An Info finding never
373
+ fails the gate; `--fail-on any` means Low and above.
374
+
369
375
  `narvy doctor` exits 0 when every required check passes and 1 when one fails.
370
376
  Missing optional tools are shown as INFO and do not change its exit code.
371
377
 
@@ -327,6 +327,12 @@ scan starts: a rejected token or an unreachable server exits 4 right away.
327
327
  | 4 | The scan, login, upload or report write failed |
328
328
  | 130 | Interrupted (Ctrl-C, SIGTERM) |
329
329
 
330
+ With `--upload`, `--fail-on` leaves out the findings your team dismissed in
331
+ Narvy (false positive, accepted risk, won't fix), as listed in the upload
332
+ response, and says how many. Without `--upload`, or when the server does
333
+ not return that list, every local finding counts. An Info finding never
334
+ fails the gate; `--fail-on any` means Low and above.
335
+
330
336
  `narvy doctor` exits 0 when every required check passes and 1 when one fails.
331
337
  Missing optional tools are shown as INFO and do not change its exit code.
332
338
 
@@ -1,3 +1,3 @@
1
1
  """Narvy CLI - free, local SAST for Android, iOS and polyglot source."""
2
2
 
3
- __version__ = "1.3.1"
3
+ __version__ = "1.3.3"
@@ -14,16 +14,22 @@ image: python:3.11
14
14
  definitions:
15
15
  caches:
16
16
  narvy-osv: ~/.cache/narvy/osv
17
-
18
- pipelines:
19
- default:
20
- - step:
17
+ steps:
18
+ - step: &narvy-sast
21
19
  name: Narvy SAST
22
20
  caches:
23
21
  - narvy-osv
24
22
  script:
25
23
  - pip install --upgrade pip
26
- - pip install narvy-cli
24
+ - pip install "narvy-cli>=1.3.2"
27
25
  - narvy scan . --output sarif --file narvy-results.sarif --fail-on high ${NARVY_TOKEN:+--upload}
28
26
  artifacts:
29
27
  - narvy-results.sarif
28
+
29
+ # Every push, and every pull request (same step).
30
+ pipelines:
31
+ default:
32
+ - step: *narvy-sast
33
+ pull-requests:
34
+ '**':
35
+ - step: *narvy-sast
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Install Narvy CLI
26
26
  run: |
27
27
  python -m pip install --upgrade pip
28
- pip install narvy-cli
28
+ pip install "narvy-cli>=1.3.2"
29
29
 
30
30
  # The dependency check downloads the OSV database (npm alone is about 220 MB).
31
31
  # Kept in the Actions cache, one key per UTC day; the CLI refreshes a copy older than 24 h.
@@ -30,7 +30,7 @@ narvy_sast:
30
30
  when: always
31
31
  before_script:
32
32
  - pip install --upgrade pip
33
- - pip install "narvy-cli>=1.3.1"
33
+ - pip install "narvy-cli>=1.3.2"
34
34
  script:
35
35
  - narvy scan . --output gitlab --file gl-sast-report.json ${NARVY_TOKEN:+--upload} --fail-on high || echo $? > narvy-exit-code
36
36
  artifacts:
@@ -11,7 +11,7 @@ import time
11
11
  import json
12
12
  import zipfile
13
13
  from pathlib import Path
14
- from typing import Any, Dict, List
14
+ from typing import Any, Dict, List, Optional
15
15
  from rich.console import Console
16
16
  from rich.table import Table
17
17
  from rich.progress import Progress
@@ -199,8 +199,9 @@ EXIT_CODES_HELP = (
199
199
 
200
200
 
201
201
  FAIL_ON_HELP = (
202
- "CI gate: exit 1 if any finding is at or above this severity ('any' = any "
203
- "finding). If nothing reaches it but part of the scan did not run, exit 2 "
202
+ "CI gate: exit 1 if any finding is at or above this severity ('any' = Low "
203
+ "and above; an Info finding never fails the gate, as on narvy.io). If "
204
+ "nothing reaches it but part of the scan did not run, exit 2 "
204
205
  "instead of 0, because the result cannot be certified clean. Without "
205
206
  "--fail-on the exit code is 0 whatever is found."
206
207
  )
@@ -1638,6 +1639,8 @@ _APP_MATCH_LABELS = {
1638
1639
  "normalized_name": "matched by repository name",
1639
1640
  "name": "matched by name",
1640
1641
  "cloud_account": "matched by cloud account",
1642
+ "package_upgrade": "matched by package id",
1643
+ "reactivated": "reactivated",
1641
1644
  }
1642
1645
 
1643
1646
 
@@ -1747,6 +1750,12 @@ def _submit_results_ingest(all_findings, scan_mode, target_path, app=None, packa
1747
1750
  console.print(f"[bold green]Results uploaded.[/bold green] scan_id={scan_id}")
1748
1751
  if data.get("app_id") is not None:
1749
1752
  _label = _app_match_label(data.get("app_matched_by"))
1753
+ if str(data.get("app_matched_by") or "").strip().lower() == "reactivated":
1754
+ # The App had been removed in Narvy and this scan brought it
1755
+ # back; app_matched_on says how it was found.
1756
+ _on = _app_match_label(data.get("app_matched_on"))
1757
+ if _on and _on != _label and _on != "new app":
1758
+ _label = f"{_label}, {_on}"
1750
1759
  console.print(f"[dim]App ID {data.get('app_id')}{f' ({_label})' if _label else ''}.[/dim]")
1751
1760
  console.print(
1752
1761
  f"[dim]CLI detected {received} -> Narvy cloud curated: {total_detected} distinct "
@@ -1768,9 +1777,42 @@ def _submit_results_ingest(all_findings, scan_mode, target_path, app=None, packa
1768
1777
  return data
1769
1778
 
1770
1779
 
1780
+ # Team triage that keeps a finding out of the build gate (the platform's
1781
+ # "dismissed" statuses: tracker false positive / accepted risk / won't fix).
1782
+ _DISMISSED_STATUSES = frozenset({"false_positive", "accepted_risk", "wont_fix"})
1783
+
1784
+
1785
+ def _dismissed_indices(data, sent_count):
1786
+ """{index: status} of the submitted findings the team dismissed in Narvy,
1787
+ or None when the response does not say (older server).
1788
+
1789
+ Contract (server side, POST /api/v1/ingest response): ``dismissed`` = a
1790
+ list of {"index": <position in the submitted ``findings`` array>,
1791
+ "status": "false_positive" | "accepted_risk" | "wont_fix"}, present (even
1792
+ empty) whenever the server applied triage. A rolled-up dependency finding
1793
+ lists every submitted index it was built from. Entries out of range or
1794
+ with another status are ignored."""
1795
+ if not isinstance(data, dict) or not isinstance(data.get("dismissed"), list):
1796
+ return None
1797
+ out = {}
1798
+ for e in data["dismissed"]:
1799
+ if not isinstance(e, dict):
1800
+ continue
1801
+ idx, status = e.get("index"), str(e.get("status") or "").strip().lower()
1802
+ if isinstance(idx, int) and not isinstance(idx, bool) and 0 <= idx < sent_count \
1803
+ and status in _DISMISSED_STATUSES:
1804
+ out[idx] = status
1805
+ return out
1806
+
1807
+
1771
1808
  def _submit_results_by_surface(all_findings, scan_mode, target_path, scan_meta=None, app=None):
1772
- """Upload each scanned surface under its own platform (nested iOS goes up as iOS source)."""
1809
+ """Upload each scanned surface under its own platform (nested iOS goes up as iOS source).
1810
+
1811
+ Returns the findings of ``all_findings`` the team dismissed in Narvy (a
1812
+ list, possibly empty) when EVERY upload's response carried the
1813
+ ``dismissed`` field, else None (the build gate then stays local)."""
1773
1814
  by_root: Dict[str, List[Dict[str, Any]]] = {}
1815
+ origin: Dict[str, List[Dict[str, Any]]] = {}
1774
1816
  main: List[Dict[str, Any]] = []
1775
1817
  for f in all_findings:
1776
1818
  root = f.get("_surface_root")
@@ -1781,18 +1823,32 @@ def _submit_results_by_surface(all_findings, scan_mode, target_path, scan_meta=N
1781
1823
  if fp.startswith(prefix):
1782
1824
  g["file_path"] = fp[len(prefix):]
1783
1825
  by_root.setdefault(root, []).append(g)
1826
+ origin.setdefault(root, []).append(f)
1784
1827
  else:
1785
1828
  main.append(f)
1786
1829
  for s in (scan_meta or {}).get("surfaces", [])[1:]:
1787
1830
  if s.get("mode") == "ios-source" and s.get("status") != "failed":
1788
1831
  by_root.setdefault(s["path"], [])
1832
+ origin.setdefault(s["path"], [])
1833
+ dismissed: Optional[List[Dict[str, Any]]] = []
1789
1834
  # --app targets the scanned project; a nested iOS project keeps its own app.
1790
- _submit_results_ingest(main, scan_mode, target_path, app=app,
1791
- package_id=(scan_meta or {}).get("package_id"),
1792
- sca_coverage=_sca_coverage_word(scan_meta))
1835
+ data = _submit_results_ingest(main, scan_mode, target_path, app=app,
1836
+ package_id=(scan_meta or {}).get("package_id"),
1837
+ sca_coverage=_sca_coverage_word(scan_meta))
1838
+ idx = _dismissed_indices(data, len(main))
1839
+ if idx is None:
1840
+ dismissed = None
1841
+ else:
1842
+ dismissed.extend(main[i] for i in sorted(idx))
1793
1843
  for root, findings in by_root.items():
1794
1844
  console.print(f"[dim]iOS project in {rich_escape(root)}/:[/dim]")
1795
- _submit_results_ingest(findings, "ios-source", os.path.join(target_path, root))
1845
+ data = _submit_results_ingest(findings, "ios-source", os.path.join(target_path, root))
1846
+ idx = _dismissed_indices(data, len(findings))
1847
+ if idx is None:
1848
+ dismissed = None
1849
+ elif dismissed is not None:
1850
+ dismissed.extend(origin[root][i] for i in sorted(idx))
1851
+ return dismissed
1796
1852
 
1797
1853
 
1798
1854
  _ENGINE_LABELS = {
@@ -2434,9 +2490,10 @@ def cmd_scan(args):
2434
2490
  if _premium_note:
2435
2491
  console.print(f"\n[dim]{rich_escape(_premium_note)}[/dim]")
2436
2492
 
2493
+ team_dismissed = None
2437
2494
  if args.upload and not getattr(args, "upload_binary", False):
2438
- _submit_results_by_surface(all_findings, scan_mode, target_path, scan_meta,
2439
- app=getattr(args, "app", None))
2495
+ team_dismissed = _submit_results_by_surface(all_findings, scan_mode, target_path, scan_meta,
2496
+ app=getattr(args, "app", None))
2440
2497
  elif args.upload:
2441
2498
  # Legacy --upload-binary: POST the binary and let the server re-scan it.
2442
2499
  # upload_scan() opens the path in binary mode, so refuse a directory.
@@ -2636,8 +2693,23 @@ def cmd_scan(args):
2636
2693
  _gap_note = semgrep_engine.degraded_coverage_note()
2637
2694
  if _gap_note:
2638
2695
  coverage_gaps.append(_gap_note)
2639
- _exit_on_fail_on(all_findings, getattr(args, "fail_on", None),
2640
- coverage_gaps=coverage_gaps)
2696
+ _exit_on_fail_on(_gate_findings(all_findings, team_dismissed, getattr(args, "fail_on", None)),
2697
+ getattr(args, "fail_on", None), coverage_gaps=coverage_gaps)
2698
+
2699
+
2700
+ def _gate_findings(all_findings, team_dismissed, fail_on):
2701
+ """The findings --fail-on gates on: all of them, minus the ones the team
2702
+ dismissed in Narvy when the upload's response said which (else the local
2703
+ gate, unchanged). Reports, SARIF and the upload keep every finding."""
2704
+ if not team_dismissed:
2705
+ return all_findings
2706
+ gone = {id(f) for f in team_dismissed}
2707
+ kept = [f for f in all_findings if id(f) not in gone]
2708
+ excluded = len(all_findings) - len(kept)
2709
+ if fail_on and excluded:
2710
+ console.print(f"[dim]--fail-on: {excluded} finding(s) excluded because your team "
2711
+ "dismissed them in Narvy (false positive, accepted risk or won't fix).[/dim]")
2712
+ return kept
2641
2713
 
2642
2714
 
2643
2715
  _UPLOAD_ALL_TARGET_EXTS = (".apk", ".aab", ".apkm", ".xapk", ".ipa")
@@ -2769,7 +2841,10 @@ def _exit_on_fail_on(findings, fail_on, get_severity=lambda f: f.get("severity",
2769
2841
  telemetry.note(findings=findings, get_severity=get_severity)
2770
2842
  if not fail_on:
2771
2843
  return
2772
- threshold = _SEVERITY_LEVEL.get(fail_on, 0) if fail_on != "any" else 1
2844
+ # Same rule as the platform gate (tier_view.blocking_findings): 'any' is
2845
+ # Low and above, and an Info finding never fails the gate.
2846
+ threshold = max(_SEVERITY_LEVEL.get(fail_on, 0) if fail_on != "any" else _SEVERITY_LEVEL["low"],
2847
+ _SEVERITY_LEVEL["low"])
2773
2848
  # Severities arrive in mixed case across the scan paths, so normalise before
2774
2849
  # ranking. One the map cannot rank fails the gate closed.
2775
2850
  breaching = []
@@ -3436,9 +3511,14 @@ def cmd_init_ci(args):
3436
3511
  raise SystemExit(EXIT_ERROR)
3437
3512
 
3438
3513
  console.print(f"[bold green]Wrote {platform} CI template to {dest}[/bold green]")
3514
+ _runs_on = {
3515
+ "github": "on pushes to main or master and on every pull request",
3516
+ "gitlab": "on every push (merge request branches included)",
3517
+ "bitbucket": "on every push and every pull request",
3518
+ }.get(platform, "on every push")
3439
3519
  console.print(
3440
- "[dim]It installs the CLI from PyPI with [bold]pip install narvy-cli[/bold] "
3441
- "and runs on every push and pull request.[/dim]"
3520
+ "[dim]It installs the CLI from PyPI with [bold]pip install \"narvy-cli>=1.3.2\"[/bold] "
3521
+ f"and runs {_runs_on}.[/dim]"
3442
3522
  )
3443
3523
  if platform == "gitlab":
3444
3524
  console.print(
@@ -209,6 +209,12 @@ class OSVFinding:
209
209
  package_name: str = ""
210
210
  package_version: str = ""
211
211
  ecosystem: str = ""
212
+ # SCA severity calibration inputs, read like the platform's osv_client:
213
+ # the GitHub-reviewed label (GHSA records only), the CVSS v3 vector (v4
214
+ # when no v3) and the Go import paths the advisory lists.
215
+ reviewed_severity: str = ""
216
+ cvss_vector: str = ""
217
+ affected_imports: List[str] = field(default_factory=list)
212
218
 
213
219
  def to_dict(self) -> Dict[str, Any]:
214
220
  return {
@@ -218,6 +224,9 @@ class OSVFinding:
218
224
  "cve_id": self.cve,
219
225
  "osv_id": self.osv_id,
220
226
  "cwe": self.cwe,
227
+ "reviewed_severity": self.reviewed_severity,
228
+ "cvss_vector": self.cvss_vector,
229
+ "affected_imports": list(self.affected_imports),
221
230
  "severity": self.severity,
222
231
  "cvss_score": self.cvss_score,
223
232
  "summary": self.summary,
@@ -559,6 +568,27 @@ def _parse_osv_vuln(
559
568
 
560
569
  fixed_version: Optional[str] = _pick_fixed_version(raw, package_name, package_version)
561
570
 
571
+ # ---- Calibration inputs (same reading as the platform's osv_client) ----
572
+ reviewed_severity = ""
573
+ if str(osv_id).startswith("GHSA-"):
574
+ _lbl = str((raw.get("database_specific") or {}).get("severity") or "").upper()
575
+ if _lbl in ("CRITICAL", "HIGH", "MODERATE", "MEDIUM", "LOW"):
576
+ reviewed_severity = "MEDIUM" if _lbl == "MODERATE" else _lbl
577
+ cvss_vector = ""
578
+ for _entry in sev_arr:
579
+ _vec = str((_entry or {}).get("score") or "") if isinstance(_entry, dict) else ""
580
+ if _vec.startswith("CVSS:3"):
581
+ cvss_vector = _vec
582
+ break
583
+ if _vec.startswith("CVSS:4") and not cvss_vector:
584
+ cvss_vector = _vec
585
+ affected_imports: List[str] = []
586
+ for _aff in raw.get("affected", []) or []:
587
+ for _imp in (((_aff or {}).get("ecosystem_specific") or {}).get("imports") or []):
588
+ _path = _imp.get("path") if isinstance(_imp, dict) else None
589
+ if _path and _path not in affected_imports:
590
+ affected_imports.append(str(_path))
591
+
562
592
  refs = []
563
593
  for ref in raw.get("references", []) or []:
564
594
  url = ref.get("url")
@@ -590,6 +620,9 @@ def _parse_osv_vuln(
590
620
  package_name=package_name,
591
621
  package_version=package_version,
592
622
  ecosystem=ecosystem,
623
+ reviewed_severity=reviewed_severity,
624
+ cvss_vector=cvss_vector,
625
+ affected_imports=affected_imports,
593
626
  )
594
627
 
595
628
 
@@ -844,16 +877,49 @@ class OSVClient:
844
877
  self.cache.put(package_name, version, ecosystem, raw_vulns)
845
878
  return self._parse_all(raw_vulns, package_name, version, ecosystem)
846
879
 
847
- def query_dict(self, package_name: str, version: str, ecosystem: str = "Maven") -> List[Dict[str, Any]]:
848
- # OSV lists one CVE under several advisory ids (GHSA/PYSEC/CVE); dedupe on the CVE.
849
- out: List[Dict[str, Any]] = []
850
- seen = set()
851
- for f in self.query(package_name, version, ecosystem):
852
- key = getattr(f, "cve", "") or getattr(f, "osv_id", "") or id(f)
853
- if key in seen:
854
- continue
855
- seen.add(key)
856
- out.append(f.to_dict())
880
+ def query_dict(self, package_name: str, version: str, ecosystem: str = "Maven",
881
+ platform_grouping: bool = False) -> List[Dict[str, Any]]:
882
+ """One dict per CVE (OSV lists one CVE under several advisory ids:
883
+ GHSA / PYSEC / CVE).
884
+
885
+ Default: the first record of each CVE. ``platform_grouping``: the
886
+ record the platform keeps (web_sca._finding_from_osv_group): the
887
+ GitHub-reviewed one when there is one, else the highest CVSS; each
888
+ dict then also carries ``mirror_worst_severity``, the worst rating
889
+ across that CVE's records, and ``advisory_worst_severity``, the worst
890
+ across every record of the package (the calibration's ceiling)."""
891
+ found = list(self.query(package_name, version, ecosystem))
892
+ if not platform_grouping:
893
+ out: List[Dict[str, Any]] = []
894
+ seen = set()
895
+ for f in found:
896
+ key = getattr(f, "cve", "") or getattr(f, "osv_id", "") or id(f)
897
+ if key in seen:
898
+ continue
899
+ seen.add(key)
900
+ out.append(f.to_dict())
901
+ return out
902
+ from . import severity_calibration as _cal
903
+ advisory_worst = _cal.worst(_cal.canonical(f.severity) for f in found)
904
+ by_key: Dict[Any, OSVFinding] = {}
905
+ group_worst: Dict[Any, str] = {}
906
+ for f in found:
907
+ key = f.cve if (f.cve and f.cve.startswith("CVE-")) else f.osv_id
908
+ group_worst[key] = _cal.worst([group_worst.get(key, "Info"), _cal.canonical(f.severity)])
909
+ existing = by_key.get(key)
910
+ if existing is None:
911
+ by_key[key] = f
912
+ elif bool(f.reviewed_severity) != bool(existing.reviewed_severity):
913
+ if f.reviewed_severity:
914
+ by_key[key] = f
915
+ elif f.cvss_score > existing.cvss_score:
916
+ by_key[key] = f
917
+ out = []
918
+ for key, f in by_key.items():
919
+ d = f.to_dict()
920
+ d["mirror_worst_severity"] = group_worst[key]
921
+ d["advisory_worst_severity"] = advisory_worst
922
+ out.append(d)
857
923
  return out
858
924
 
859
925
  @staticmethod