narvy-cli 1.3.2__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.
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/CHANGELOG.md +24 -0
- {narvy_cli-1.3.2/narvy_cli.egg-info → narvy_cli-1.3.3}/PKG-INFO +3 -2
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/README.md +2 -1
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/__init__.py +1 -1
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/main.py +15 -3
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/web_deps.py +185 -9
- {narvy_cli-1.3.2 → narvy_cli-1.3.3/narvy_cli.egg-info}/PKG-INFO +3 -2
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/LICENSE +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/MANIFEST.in +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/SECURITY.md +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/__main__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/android/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/android/source_analyzer.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/android/split_bundle.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/android_rule_context.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/apk_memory_preflight.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/auth.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cbom.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ci_templates/bitbucket.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ci_templates/github.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ci_templates/gitlab.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/aws_scan.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/gcp_scan.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/normalize.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/rule_severity.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/severity.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/cloud/upload.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/comment_filter.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/crypto_taint_lite.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/decompiler.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/doctor.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/gitlab_report.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/audit.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/host_knowledge.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/lynis_bootstrap.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/lynis_parser.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/narvy_checks.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/report.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/host/ssh_exec.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ios/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ios/binary_analyzer.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ios/plist_checks.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ios/source_analyzer.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ios/third_party_filter.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/ios/trust_all_context.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/native_hardening.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/own_reports.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/pathhint.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/pathnorm.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/proc.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/repo_identity.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/reporter.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rule_engine.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/android/config.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/android/crypto.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/android/secrets.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/android/storage.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/android/webview.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/android.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/ios/objc/crypto.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/ios/objc/network.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/ios/objc/secrets.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/ios/objc/storage.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/ios/objc/webview.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/ios_swift.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/go.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/java.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/javascript.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/kotlin.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/php.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/python.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/ruby.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/rust.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/secrets.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/rules/web/secrets_supplement.yml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sbom.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/android_deps.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/ios_deps.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/osv_client.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/osv_localdb.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/osv_semantic.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/sca/severity_calibration.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/scope_config.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/secret_output.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/secret_presentation.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/secret_value_grade.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/semgrep_engine.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/stack_protector_evidence.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/__main__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/analyze.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/arsc.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/axml.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/checks.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/elf.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/loader.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/protoxml.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/android/xmlmodel.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/archive.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/cli.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/data/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/data/apple.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/data/play.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/ios/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/ios/checks.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/ios/loader.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/ios/macho.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/store_check/model.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/telemetry.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/third_party_filter.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/uploader.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/weak_prng_context.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/web/__init__.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/web/nuclei_binary.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/web/scan_blocklist.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/web/scanner.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/web/source_analyzer.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy/web/ssrf_guard.py +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy_cli.egg-info/SOURCES.txt +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy_cli.egg-info/dependency_links.txt +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy_cli.egg-info/entry_points.txt +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy_cli.egg-info/requires.txt +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/narvy_cli.egg-info/top_level.txt +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/pyproject.toml +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/setup.cfg +0 -0
- {narvy_cli-1.3.2 → narvy_cli-1.3.3}/setup.py +0 -0
|
@@ -5,6 +5,30 @@ 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
|
+
|
|
8
32
|
## [1.3.2]
|
|
9
33
|
|
|
10
34
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: narvy-cli
|
|
3
|
-
Version: 1.3.
|
|
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
|
|
@@ -369,7 +369,8 @@ scan starts: a rejected token or an unreachable server exits 4 right away.
|
|
|
369
369
|
With `--upload`, `--fail-on` leaves out the findings your team dismissed in
|
|
370
370
|
Narvy (false positive, accepted risk, won't fix), as listed in the upload
|
|
371
371
|
response, and says how many. Without `--upload`, or when the server does
|
|
372
|
-
not return that list, every local finding counts.
|
|
372
|
+
not return that list, every local finding counts. An Info finding never
|
|
373
|
+
fails the gate; `--fail-on any` means Low and above.
|
|
373
374
|
|
|
374
375
|
`narvy doctor` exits 0 when every required check passes and 1 when one fails.
|
|
375
376
|
Missing optional tools are shown as INFO and do not change its exit code.
|
|
@@ -330,7 +330,8 @@ scan starts: a rejected token or an unreachable server exits 4 right away.
|
|
|
330
330
|
With `--upload`, `--fail-on` leaves out the findings your team dismissed in
|
|
331
331
|
Narvy (false positive, accepted risk, won't fix), as listed in the upload
|
|
332
332
|
response, and says how many. Without `--upload`, or when the server does
|
|
333
|
-
not return that list, every local finding counts.
|
|
333
|
+
not return that list, every local finding counts. An Info finding never
|
|
334
|
+
fails the gate; `--fail-on any` means Low and above.
|
|
334
335
|
|
|
335
336
|
`narvy doctor` exits 0 when every required check passes and 1 when one fails.
|
|
336
337
|
Missing optional tools are shown as INFO and do not change its exit code.
|
|
@@ -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' =
|
|
203
|
-
"
|
|
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 "
|
|
@@ -2832,7 +2841,10 @@ def _exit_on_fail_on(findings, fail_on, get_severity=lambda f: f.get("severity",
|
|
|
2832
2841
|
telemetry.note(findings=findings, get_severity=get_severity)
|
|
2833
2842
|
if not fail_on:
|
|
2834
2843
|
return
|
|
2835
|
-
|
|
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"])
|
|
2836
2848
|
# Severities arrive in mixed case across the scan paths, so normalise before
|
|
2837
2849
|
# ranking. One the map cannot rank fails the gate closed.
|
|
2838
2850
|
breaching = []
|
|
@@ -37,6 +37,9 @@ class _WebDep:
|
|
|
37
37
|
# the file states ("runtime", "dev", or "unknown" when it does not say).
|
|
38
38
|
declared_spec: str = ""
|
|
39
39
|
scope: str = "unknown"
|
|
40
|
+
# Other manifests that carry the same package@version (a workspace
|
|
41
|
+
# member next to the root lockfile): set by _dedupe on the kept entry.
|
|
42
|
+
also_in: Tuple[str, ...] = ()
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
# version_source, as the Narvy platform's lockfile parser tags a dependency:
|
|
@@ -125,6 +128,10 @@ def _parse_package_lock(path: str) -> List[_WebDep]:
|
|
|
125
128
|
for key, meta in packages.items():
|
|
126
129
|
if not key or not isinstance(meta, dict):
|
|
127
130
|
continue
|
|
131
|
+
# A workspace member's own entry ("packages/a") is the project,
|
|
132
|
+
# not an installed package (the platform skips it too).
|
|
133
|
+
if "node_modules/" not in key:
|
|
134
|
+
continue
|
|
128
135
|
version = meta.get("version")
|
|
129
136
|
if not version:
|
|
130
137
|
continue
|
|
@@ -698,8 +705,41 @@ _MANIFEST_SKIP_DIR_NAMES = frozenset({
|
|
|
698
705
|
".git", ".gradle", ".idea", ".vscode", ".vs",
|
|
699
706
|
"build", "dist", "target", "out", "bin", "obj",
|
|
700
707
|
".next", ".nuxt", ".cache", "coverage", ".pytest_cache",
|
|
701
|
-
"packages",
|
|
702
708
|
})
|
|
709
|
+
# `packages/` is walked: it holds the members of JS workspaces (npm, yarn,
|
|
710
|
+
# pnpm, Lerna, Nx, Turborepo), Python and Go monorepos. Only the classic NuGet
|
|
711
|
+
# restore folder of that name (one <Id>.<Version>/ folder per .nupkg) is pruned.
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
def _is_nuget_restore_dir(path: str) -> bool:
|
|
715
|
+
"""A NuGet packages.config restore folder: repositories.config, or
|
|
716
|
+
sub-folders that hold a .nupkg (checks the first few only)."""
|
|
717
|
+
try:
|
|
718
|
+
entries = sorted(os.listdir(path))
|
|
719
|
+
except OSError:
|
|
720
|
+
return False
|
|
721
|
+
if "repositories.config" in entries:
|
|
722
|
+
return True
|
|
723
|
+
checked = 0
|
|
724
|
+
for name in entries:
|
|
725
|
+
sub = os.path.join(path, name)
|
|
726
|
+
if not os.path.isdir(sub):
|
|
727
|
+
continue
|
|
728
|
+
checked += 1
|
|
729
|
+
try:
|
|
730
|
+
if any(f.endswith(".nupkg") for f in os.listdir(sub)):
|
|
731
|
+
return True
|
|
732
|
+
except OSError:
|
|
733
|
+
pass
|
|
734
|
+
if checked >= 5:
|
|
735
|
+
break
|
|
736
|
+
return False
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
def _prune_dirs(cur_root: str, dirs: List[str]) -> List[str]:
|
|
740
|
+
return [d for d in dirs
|
|
741
|
+
if d not in _MANIFEST_SKIP_DIR_NAMES and not d.startswith(".")
|
|
742
|
+
and not (d == "packages" and _is_nuget_restore_dir(os.path.join(cur_root, d)))]
|
|
703
743
|
|
|
704
744
|
|
|
705
745
|
def _walk_manifests(root_path: str, matcher) -> List[str]:
|
|
@@ -711,8 +751,7 @@ def _walk_manifests(root_path: str, matcher) -> List[str]:
|
|
|
711
751
|
if depth >= _MANIFEST_WALK_MAX_DEPTH:
|
|
712
752
|
dirs[:] = []
|
|
713
753
|
continue
|
|
714
|
-
dirs[:] =
|
|
715
|
-
if d not in _MANIFEST_SKIP_DIR_NAMES and not d.startswith(".")]
|
|
754
|
+
dirs[:] = _prune_dirs(cur_root, dirs)
|
|
716
755
|
for f in files:
|
|
717
756
|
if matcher(f):
|
|
718
757
|
found.append(os.path.join(cur_root, f))
|
|
@@ -1180,14 +1219,17 @@ def _dedupe(deps: List[_WebDep]) -> List[_WebDep]:
|
|
|
1180
1219
|
# Same package@version from two manifests: the stronger version proof
|
|
1181
1220
|
# is kept (an exact pin over a range floor); on a tie, the first one.
|
|
1182
1221
|
# The broadest scope seen wins (a runtime copy is never dev-only).
|
|
1222
|
+
# Every manifest that carried it is listed (also_in), never counted twice.
|
|
1183
1223
|
prev = best.get(key)
|
|
1184
1224
|
if prev is None or (_VERSION_SOURCE_RANK.get(version_source_for(dep.source, dep.version_source), 0)
|
|
1185
1225
|
> _VERSION_SOURCE_RANK.get(version_source_for(prev.source, prev.version_source), 0)):
|
|
1186
1226
|
best[key] = dep
|
|
1187
1227
|
if prev is not None:
|
|
1188
1228
|
scope = max((prev.scope, dep.scope), key=lambda sc: _SCOPE_RANK.get(sc, 2))
|
|
1189
|
-
|
|
1190
|
-
|
|
1229
|
+
sources = [s for s in (prev.source, *prev.also_in, dep.source, *dep.also_in)
|
|
1230
|
+
if s != best[key].source]
|
|
1231
|
+
also_in = tuple(dict.fromkeys(sources))
|
|
1232
|
+
best[key] = replace(best[key], scope=scope, also_in=also_in)
|
|
1191
1233
|
return list(best.values())
|
|
1192
1234
|
|
|
1193
1235
|
|
|
@@ -1245,6 +1287,7 @@ def _finding_from_osv(dep: _WebDep, osv_finding_dict: Dict[str, Any]) -> Dict[st
|
|
|
1245
1287
|
"package": dep.name,
|
|
1246
1288
|
"version": dep.version,
|
|
1247
1289
|
"detected_via": dep.source,
|
|
1290
|
+
**({"manifests": [dep.source, *dep.also_in]} if dep.also_in else {}),
|
|
1248
1291
|
"fixed_version": fixed_version,
|
|
1249
1292
|
"references": osv_finding_dict.get("references", []),
|
|
1250
1293
|
"ecosystem": dep.ecosystem,
|
|
@@ -1347,11 +1390,16 @@ def _rule_def_from_finding(finding: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
1347
1390
|
|
|
1348
1391
|
# Run a collector once per manifest-bearing directory, so monorepos and subdir
|
|
1349
1392
|
# backends are covered (scan()'s _dedupe collapses overlap).
|
|
1350
|
-
def _collect_recursive(root_path: str, filenames, collector) -> List[_WebDep]:
|
|
1393
|
+
def _collect_recursive(root_path: str, filenames, collector, members=None) -> List[_WebDep]:
|
|
1351
1394
|
dirs = set()
|
|
1352
1395
|
for fn in filenames:
|
|
1353
1396
|
for p in _walk_manifests(root_path, lambda f, _fn=fn: f == _fn):
|
|
1354
1397
|
dirs.add(os.path.dirname(p))
|
|
1398
|
+
# Workspace members the root declares are read even where the walk does
|
|
1399
|
+
# not go (a skipped folder name, deeper than the walk).
|
|
1400
|
+
for d in (members(root_path) if members else ()):
|
|
1401
|
+
if any(os.path.isfile(os.path.join(d, fn)) for fn in filenames):
|
|
1402
|
+
dirs.add(d)
|
|
1355
1403
|
if root_path not in dirs and any(
|
|
1356
1404
|
os.path.isfile(os.path.join(root_path, fn)) for fn in filenames
|
|
1357
1405
|
):
|
|
@@ -1422,14 +1470,142 @@ def _coverage_gaps(source_dir: str, deps: List[_WebDep]) -> List[str]:
|
|
|
1422
1470
|
return gaps
|
|
1423
1471
|
|
|
1424
1472
|
|
|
1473
|
+
def _expand_member_globs(root_path: str, patterns) -> List[str]:
|
|
1474
|
+
"""Directories under root_path matched by workspace globs ('packages/*',
|
|
1475
|
+
'apps/**', '!packages/legacy'); never outside the root, never node_modules."""
|
|
1476
|
+
import glob as _glob
|
|
1477
|
+
root = os.path.realpath(root_path)
|
|
1478
|
+
include: Set[str] = set()
|
|
1479
|
+
exclude: Set[str] = set()
|
|
1480
|
+
for pat in patterns or ():
|
|
1481
|
+
if not isinstance(pat, str) or not pat.strip():
|
|
1482
|
+
continue
|
|
1483
|
+
pat = pat.strip()
|
|
1484
|
+
neg = pat.startswith("!")
|
|
1485
|
+
pat = pat.lstrip("!").strip().rstrip("/")
|
|
1486
|
+
while pat.startswith("./"):
|
|
1487
|
+
pat = pat[2:]
|
|
1488
|
+
if not pat or os.path.isabs(pat) or ".." in pat.split("/"):
|
|
1489
|
+
continue
|
|
1490
|
+
hits = _glob.glob(os.path.join(root, pat), recursive=True)
|
|
1491
|
+
if len(hits) > _MAX_MANIFEST_FILES:
|
|
1492
|
+
hits = sorted(hits)[:_MAX_MANIFEST_FILES]
|
|
1493
|
+
for h in hits:
|
|
1494
|
+
real = os.path.realpath(h)
|
|
1495
|
+
if not os.path.isdir(real) or not (real == root or real.startswith(root + os.sep)):
|
|
1496
|
+
continue
|
|
1497
|
+
if "node_modules" in os.path.relpath(real, root).split(os.sep):
|
|
1498
|
+
continue
|
|
1499
|
+
(exclude if neg else include).add(real)
|
|
1500
|
+
return sorted(include - exclude)
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
def _read_json(path: str) -> Any:
|
|
1504
|
+
try:
|
|
1505
|
+
with open(path, "r", encoding="utf-8", errors="ignore") as f:
|
|
1506
|
+
return json.load(f)
|
|
1507
|
+
except (OSError, ValueError):
|
|
1508
|
+
return None
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
def _pnpm_workspace_globs(path: str) -> List[str]:
|
|
1512
|
+
try:
|
|
1513
|
+
with open(path, "r", encoding="utf-8", errors="ignore") as f:
|
|
1514
|
+
text = f.read()
|
|
1515
|
+
except OSError:
|
|
1516
|
+
return []
|
|
1517
|
+
try:
|
|
1518
|
+
import yaml
|
|
1519
|
+
data = yaml.safe_load(text)
|
|
1520
|
+
pk = data.get("packages") if isinstance(data, dict) else None
|
|
1521
|
+
return [p for p in pk if isinstance(p, str)] if isinstance(pk, list) else []
|
|
1522
|
+
except Exception: # noqa: BLE001 - no PyYAML, or a file it rejects: line read
|
|
1523
|
+
out, in_pk = [], False
|
|
1524
|
+
for line in text.splitlines():
|
|
1525
|
+
if not line.strip() or line.lstrip().startswith("#"):
|
|
1526
|
+
continue
|
|
1527
|
+
if not line[0].isspace():
|
|
1528
|
+
in_pk = line.split("#", 1)[0].strip() == "packages:"
|
|
1529
|
+
continue
|
|
1530
|
+
m = re.match(r'^\s+-\s*["\']?([^"\'#]+?)["\']?\s*(?:#.*)?$', line)
|
|
1531
|
+
if in_pk and m:
|
|
1532
|
+
out.append(m.group(1))
|
|
1533
|
+
return out
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
def _npm_workspace_members(root_path: str) -> List[str]:
|
|
1537
|
+
"""Member dirs declared by package.json `workspaces` (npm, yarn, Nx,
|
|
1538
|
+
Turborepo), pnpm-workspace.yaml `packages` and lerna.json `packages`."""
|
|
1539
|
+
globs: List[str] = []
|
|
1540
|
+
pkg = _read_json(os.path.join(root_path, "package.json"))
|
|
1541
|
+
if isinstance(pkg, dict):
|
|
1542
|
+
ws = pkg.get("workspaces")
|
|
1543
|
+
if isinstance(ws, dict):
|
|
1544
|
+
ws = ws.get("packages")
|
|
1545
|
+
if isinstance(ws, list):
|
|
1546
|
+
globs.extend(p for p in ws if isinstance(p, str))
|
|
1547
|
+
pnpm_ws = os.path.join(root_path, "pnpm-workspace.yaml")
|
|
1548
|
+
if os.path.isfile(pnpm_ws):
|
|
1549
|
+
globs.extend(_pnpm_workspace_globs(pnpm_ws))
|
|
1550
|
+
lerna = _read_json(os.path.join(root_path, "lerna.json"))
|
|
1551
|
+
if isinstance(lerna, dict) and isinstance(lerna.get("packages"), list):
|
|
1552
|
+
globs.extend(p for p in lerna["packages"] if isinstance(p, str))
|
|
1553
|
+
return _expand_member_globs(root_path, globs)
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
_CARGO_MEMBERS_RE = re.compile(r'^\s*members\s*=\s*\[(.*?)\]', re.MULTILINE | re.DOTALL)
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
def _cargo_workspace_members(root_path: str) -> List[str]:
|
|
1560
|
+
"""Cargo.toml `[workspace] members = [...]` dirs."""
|
|
1561
|
+
try:
|
|
1562
|
+
with open(os.path.join(root_path, "Cargo.toml"), "r", encoding="utf-8", errors="ignore") as f:
|
|
1563
|
+
text = f.read()
|
|
1564
|
+
except OSError:
|
|
1565
|
+
return []
|
|
1566
|
+
m = re.search(r'^\[workspace\]\s*$(.*?)(?=^\[|\Z)', text, re.MULTILINE | re.DOTALL)
|
|
1567
|
+
if not m:
|
|
1568
|
+
return []
|
|
1569
|
+
mm = _CARGO_MEMBERS_RE.search(m.group(1))
|
|
1570
|
+
if not mm:
|
|
1571
|
+
return []
|
|
1572
|
+
body = "\n".join(l.split("#", 1)[0] for l in mm.group(1).splitlines())
|
|
1573
|
+
return _expand_member_globs(root_path, re.findall(r'"([^"]+)"', body))
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
def _go_work_members(root_path: str) -> List[str]:
|
|
1577
|
+
"""go.work `use` dirs (single line or block)."""
|
|
1578
|
+
try:
|
|
1579
|
+
with open(os.path.join(root_path, "go.work"), "r", encoding="utf-8", errors="ignore") as f:
|
|
1580
|
+
lines = f.read().splitlines()
|
|
1581
|
+
except OSError:
|
|
1582
|
+
return []
|
|
1583
|
+
uses, in_block = [], False
|
|
1584
|
+
for raw in lines:
|
|
1585
|
+
line = raw.split("//", 1)[0].strip()
|
|
1586
|
+
if line.startswith("use ("):
|
|
1587
|
+
in_block = True
|
|
1588
|
+
continue
|
|
1589
|
+
if in_block and line == ")":
|
|
1590
|
+
in_block = False
|
|
1591
|
+
continue
|
|
1592
|
+
if line.startswith("use "):
|
|
1593
|
+
uses.append(line[4:].strip())
|
|
1594
|
+
elif in_block and line:
|
|
1595
|
+
uses.append(line)
|
|
1596
|
+
return _expand_member_globs(root_path, [u.strip('"') for u in uses])
|
|
1597
|
+
|
|
1598
|
+
|
|
1425
1599
|
def collect_dependencies(source_dir: str) -> List[_WebDep]:
|
|
1426
1600
|
deps: List[_WebDep] = []
|
|
1427
|
-
deps.extend(_collect_recursive(source_dir, ("pnpm-lock.yaml", "yarn.lock", "package-lock.json", "package.json"), _collect_npm_deps
|
|
1601
|
+
deps.extend(_collect_recursive(source_dir, ("pnpm-lock.yaml", "yarn.lock", "package-lock.json", "package.json"), _collect_npm_deps,
|
|
1602
|
+
members=_npm_workspace_members))
|
|
1428
1603
|
deps.extend(_collect_recursive(source_dir, ("poetry.lock", "requirements.txt"), _collect_pypi_deps))
|
|
1429
1604
|
deps.extend(_collect_recursive(source_dir, ("composer.lock", "composer.json"), _collect_packagist_deps))
|
|
1430
|
-
deps.extend(_collect_recursive(source_dir, ("go.mod",), _collect_go_deps))
|
|
1605
|
+
deps.extend(_collect_recursive(source_dir, ("go.mod",), _collect_go_deps, members=_go_work_members))
|
|
1431
1606
|
deps.extend(_collect_recursive(source_dir, ("Gemfile.lock", "Gemfile"), _collect_rubygems_deps))
|
|
1432
|
-
deps.extend(_collect_recursive(source_dir, ("Cargo.lock", "Cargo.toml"), _collect_crates_deps
|
|
1607
|
+
deps.extend(_collect_recursive(source_dir, ("Cargo.lock", "Cargo.toml"), _collect_crates_deps,
|
|
1608
|
+
members=_cargo_workspace_members))
|
|
1433
1609
|
deps.extend(_collect_maven_deps(source_dir))
|
|
1434
1610
|
deps.extend(_collect_nuget_deps(source_dir))
|
|
1435
1611
|
return [replace(d, source=_safe_rel_source(d.source)) for d in deps]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: narvy-cli
|
|
3
|
-
Version: 1.3.
|
|
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
|
|
@@ -369,7 +369,8 @@ scan starts: a rejected token or an unreachable server exits 4 right away.
|
|
|
369
369
|
With `--upload`, `--fail-on` leaves out the findings your team dismissed in
|
|
370
370
|
Narvy (false positive, accepted risk, won't fix), as listed in the upload
|
|
371
371
|
response, and says how many. Without `--upload`, or when the server does
|
|
372
|
-
not return that list, every local finding counts.
|
|
372
|
+
not return that list, every local finding counts. An Info finding never
|
|
373
|
+
fails the gate; `--fail-on any` means Low and above.
|
|
373
374
|
|
|
374
375
|
`narvy doctor` exits 0 when every required check passes and 1 when one fails.
|
|
375
376
|
Missing optional tools are shown as INFO and do not change its exit code.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|