narvy-cli 1.3.0__tar.gz → 1.3.1__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.0 → narvy_cli-1.3.1}/CHANGELOG.md +94 -0
- {narvy_cli-1.3.0/narvy_cli.egg-info → narvy_cli-1.3.1}/PKG-INFO +23 -9
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/README.md +22 -8
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/__init__.py +1 -1
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/auth.py +7 -2
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cbom.py +1 -1
- narvy_cli-1.3.1/narvy/ci_templates/bitbucket.yml +29 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ci_templates/github.yml +9 -1
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ci_templates/gitlab.yml +7 -2
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/aws_scan.py +51 -22
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ios/binary_analyzer.py +1 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ios/source_analyzer.py +2 -7
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/main.py +217 -31
- narvy_cli-1.3.1/narvy/repo_identity.py +128 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sbom.py +1 -1
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/android_deps.py +4 -2
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/ios_deps.py +17 -4
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/osv_client.py +10 -1
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/web_deps.py +199 -30
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/secret_presentation.py +39 -10
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/semgrep_engine.py +13 -5
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/uploader.py +18 -2
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/web/source_analyzer.py +32 -6
- {narvy_cli-1.3.0 → narvy_cli-1.3.1/narvy_cli.egg-info}/PKG-INFO +23 -9
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy_cli.egg-info/SOURCES.txt +1 -0
- narvy_cli-1.3.0/narvy/ci_templates/bitbucket.yml +0 -15
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/LICENSE +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/MANIFEST.in +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/SECURITY.md +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/__main__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/android/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/android/source_analyzer.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/android/split_bundle.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/android_rule_context.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/apk_memory_preflight.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/gcp_scan.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/normalize.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/rule_severity.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/severity.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/cloud/upload.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/comment_filter.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/crypto_taint_lite.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/decompiler.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/doctor.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/gitlab_report.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/audit.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/host_knowledge.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/lynis_bootstrap.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/lynis_parser.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/narvy_checks.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/report.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/host/ssh_exec.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ios/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ios/plist_checks.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ios/third_party_filter.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/ios/trust_all_context.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/native_hardening.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/own_reports.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/pathhint.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/pathnorm.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/proc.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/reporter.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rule_engine.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/android/config.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/android/crypto.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/android/secrets.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/android/storage.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/android/webview.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/android.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/ios/objc/crypto.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/ios/objc/network.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/ios/objc/secrets.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/ios/objc/storage.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/ios/objc/webview.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/ios_swift.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/go.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/java.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/javascript.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/kotlin.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/php.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/python.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/ruby.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/rust.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/secrets.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/rules/web/secrets_supplement.yml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/osv_localdb.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/sca/osv_semantic.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/scope_config.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/secret_output.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/secret_value_grade.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/stack_protector_evidence.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/__main__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/analyze.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/arsc.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/axml.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/checks.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/elf.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/loader.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/protoxml.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/android/xmlmodel.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/archive.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/cli.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/data/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/data/apple.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/data/play.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/ios/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/ios/checks.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/ios/loader.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/ios/macho.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/store_check/model.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/telemetry.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/third_party_filter.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/weak_prng_context.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/web/__init__.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/web/nuclei_binary.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/web/scan_blocklist.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/web/scanner.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy/web/ssrf_guard.py +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy_cli.egg-info/dependency_links.txt +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy_cli.egg-info/entry_points.txt +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy_cli.egg-info/requires.txt +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/narvy_cli.egg-info/top_level.txt +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/pyproject.toml +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/setup.cfg +0 -0
- {narvy_cli-1.3.0 → narvy_cli-1.3.1}/setup.py +0 -0
|
@@ -5,6 +5,100 @@ 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.1]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `scan --upload --app NAME_OR_ID`: adds the results to an existing app.
|
|
13
|
+
Without it, the upload sends the git remote (credentials stripped) and
|
|
14
|
+
branch of the scanned folder when it is the root of a checkout, and the
|
|
15
|
+
platform matches the app on the remote, then on the folder name with and
|
|
16
|
+
without an archive suffix (`-main`, `-<sha>`...).
|
|
17
|
+
- `scans`: App ID column.
|
|
18
|
+
- `scan --upload` prints the app ID and how the platform matched it (package
|
|
19
|
+
id, repository, name, cloud account, `--app`, or new app); no qualifier
|
|
20
|
+
when the platform does not say.
|
|
21
|
+
- `scan app.apk|app.aab|app.ipa --upload` sends the package name from the
|
|
22
|
+
decoded manifest, or CFBundleIdentifier from Info.plist, as `package_id`,
|
|
23
|
+
so the server can match the results to an app with the same package id.
|
|
24
|
+
Source scans send no `package_id`.
|
|
25
|
+
- Dependency findings (SCA) carry `version_source`: `lockfile`,
|
|
26
|
+
`declared_exact` (exact pin in a manifest) or `declared_range` (lower bound
|
|
27
|
+
of a range such as `^0.4.0` in package.json, composer.json or Cargo.toml).
|
|
28
|
+
A `declared_range` finding says the installed version may be newer. The
|
|
29
|
+
platform applies the same default view as for its own scans.
|
|
30
|
+
- Source-scan dependency findings name their manifest or lockfile by its
|
|
31
|
+
path relative to the scanned folder (`backend/package.json`, was
|
|
32
|
+
`package.json`), with `/` separators, never absolute.
|
|
33
|
+
- `scan --upload` sends the dependency check status as
|
|
34
|
+
`summary.sca_coverage` (`complete`, `partial`, `degraded` or `none`).
|
|
35
|
+
The platform closes dependency findings missing from an upload only when
|
|
36
|
+
it is `complete`; no earlier CLI sent it.
|
|
37
|
+
- `NARVY_API_TOKEN` is read as an alias of `NARVY_TOKEN` (used when
|
|
38
|
+
`NARVY_TOKEN` is not set).
|
|
39
|
+
- `init-ci` templates (GitHub, GitLab, Bitbucket): the scan adds `--upload`
|
|
40
|
+
when a `NARVY_TOKEN` secret or variable is set. The comments say that
|
|
41
|
+
`--upload` needs a paid plan. The GitLab template installs `narvy-cli>=1.3.1`. The Bitbucket template
|
|
42
|
+
now caches the OSV database.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- A package version declared in several manifests is reported once, on the
|
|
47
|
+
manifest the platform's own scan picks: the first one in a top-down walk
|
|
48
|
+
(the root before its subfolders), unless another one has a stronger
|
|
49
|
+
version proof (lockfile, then exact pin, then range). A lockfile drops
|
|
50
|
+
the manifest versions of its directory and the ones below it that it
|
|
51
|
+
locks, and any declared range there (`package.json`, `composer.json`,
|
|
52
|
+
`Gemfile`), as the platform does.
|
|
53
|
+
- SCA coverage is `degraded` (was `partial`) when results came from a
|
|
54
|
+
stale vulnerability database copy.
|
|
55
|
+
- `scan . --upload` sent "." as the app name; it now sends the directory
|
|
56
|
+
name. The SBOM and CBOM component name had the same issue.
|
|
57
|
+
- `scan --upload` from the root of a git checkout with a remote sends the
|
|
58
|
+
repository name (last path segment of the remote, without `.git`) as the
|
|
59
|
+
app name, not the clone directory: Bitbucket (`build`), Azure Pipelines
|
|
60
|
+
(`s`) and CircleCI (`project`) sent the same name for every repository.
|
|
61
|
+
- A local-path remote (`C:/...`, `\\server\...`, `/srv/...`) or a `file://`
|
|
62
|
+
remote is no longer sent as `git_remote`.
|
|
63
|
+
- `scan --upload` checks the token before the scan: a rejected token
|
|
64
|
+
(401), an account the server refuses (403, with the server's reason,
|
|
65
|
+
for example an expired subscription), a missing login or an unreachable
|
|
66
|
+
server exits 4 before scanning instead of after.
|
|
67
|
+
- After a local scan, a logged-in user is told to add `--upload`, not to
|
|
68
|
+
run `narvy login`.
|
|
69
|
+
|
|
70
|
+
- `cloud-scan` (AWS): a WAF error (regional or global), an S3 bucket ACL
|
|
71
|
+
error, an IAM login profile error, a CIS 1.2 MFA error or a CIS 1.3
|
|
72
|
+
credential report error was logged and dropped, and the scan reported
|
|
73
|
+
`coverage: complete, checks_skipped: 0`. Each one now counts in
|
|
74
|
+
`checks_skipped` with its reason in `coverage.errors`, coverage is
|
|
75
|
+
`partial`, and `--fail-on` exits 2 when nothing else breached.
|
|
76
|
+
- Upload "asset limit reached" (402): says which app it looked for and how to
|
|
77
|
+
target one with `--app`.
|
|
78
|
+
- SCA summary: one count, distinct advisories.
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- Vulnerable-dependency findings name CWE-1395 (Dependency on Vulnerable
|
|
83
|
+
Third-Party Component), with CWE-1035 as secondary, as narvy.io does (was
|
|
84
|
+
CWE-1104). An iOS advisory's own CWE (curated list, GitHub) is kept in
|
|
85
|
+
`sca.advisory_cwe`.
|
|
86
|
+
- Code findings use the same severity mapping as narvy.io: a Semgrep rule
|
|
87
|
+
of severity ERROR is reported HIGH (was CRITICAL), WARNING is MEDIUM (was
|
|
88
|
+
HIGH), INFO is LOW (was MEDIUM). A `--fail-on` threshold therefore trips
|
|
89
|
+
on fewer structural findings than in 1.3.0. Pattern rules and SCA keep
|
|
90
|
+
their own severities.
|
|
91
|
+
- `login`, `scans` and the upload line show the plan by its public name
|
|
92
|
+
(`Pro`, not `titan`).
|
|
93
|
+
- SETUP.md: PyPI install (`pipx install narvy-cli`), `narvy-cli[...]`
|
|
94
|
+
extras, Python 3.10+, `scans` documented as available, exit codes 3 and
|
|
95
|
+
4, `NARVY_TOKEN` for CI. README: `NARVY_TOKEN` and the OSV cache
|
|
96
|
+
directory (`XDG_CACHE_HOME`, `NARVY_OSV_DB_DIR`).
|
|
97
|
+
- Secret masking, same as the platform: a value of 8 to 19 characters shows
|
|
98
|
+
its first 2 and last 2 characters and the description gives its length
|
|
99
|
+
(fully masked before). Below 8 characters the value stays fully masked;
|
|
100
|
+
from 20 characters, first 4 and last 4 as before.
|
|
101
|
+
|
|
8
102
|
## [1.3.0]
|
|
9
103
|
|
|
10
104
|
1.2.2 was not published on its own; its changes ship in 1.3.0.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: narvy-cli
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
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
|
|
@@ -116,15 +116,15 @@ Found 19 potential issues:
|
|
|
116
116
|
│ HIGH │ Hardcoded Cryptographic IV │ sources/com/android/insecurebankv2/… │ 26, 34 │ 2 │ MEDIUM │
|
|
117
117
|
│ │ (indirect) │ │ │ │ │
|
|
118
118
|
│ HIGH │ Application Data Backup is Enabled │ resources/AndroidManifest.xml │ 33 │ 1 │ HIGH │
|
|
119
|
-
│
|
|
119
|
+
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 163, 181 │ 2 │ LOW │
|
|
120
|
+
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 25, 29 │ 2 │ LOW │
|
|
121
|
+
│ MEDIUM │ Logging a value that looks like a │ sources/com/android/insecurebankv2/… │ 117 │ 1 │ MEDIUM │
|
|
120
122
|
│ │ credential/token/secret - readable │ │ │ │ │
|
|
121
123
|
│ │ via adb/crash reporters on many │ │ │ │ │
|
|
122
124
|
│ │ devices. │ │ │ │ │
|
|
123
|
-
│
|
|
125
|
+
│ MEDIUM │ JavaScript enabled in WebView - can │ sources/com/android/insecurebankv2/… │ 30 │ 1 │ MEDIUM │
|
|
124
126
|
│ │ enable XSS if untrusted content is │ │ │ │ │
|
|
125
127
|
│ │ loaded. │ │ │ │ │
|
|
126
|
-
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 163, 181 │ 2 │ LOW │
|
|
127
|
-
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 25, 29 │ 2 │ LOW │
|
|
128
128
|
└──────────┴──────────────────────────────────────┴──────────────────────────────────────┴─────────────────────┴──────┴────────────┘
|
|
129
129
|
Scanned the decompiled app with 48 local rules (28 pattern, 2 taint, 18 structural); 9 of them produced findings.
|
|
130
130
|
```
|
|
@@ -172,7 +172,12 @@ Three other commands work on targets you own, without an app file:
|
|
|
172
172
|
| iOS library names | only with `NARVY_GITHUB_ADVISORIES=1` (never with `--offline`) | api.github.com |
|
|
173
173
|
| JRE and jadx downloads | first APK scan, only if Java 11+ or jadx is missing | api.adoptium.net, github.com |
|
|
174
174
|
| One anonymous usage event per command (fields listed in [Telemetry](#telemetry)) | every command except `store-check` and `telemetry`, on by default | narvy.io |
|
|
175
|
-
|
|
|
175
|
+
| Your API token only, to check it (`/api/v1/whoami`) | `scan --upload`, before the scan starts; `narvy login` | narvy.io (or `NARVY_URL`) |
|
|
176
|
+
| Findings, never code or binary | only with `--upload` (needs `narvy login` or `NARVY_TOKEN`) | your Narvy account |
|
|
177
|
+
| With the findings: the app name (the repository name from the git remote, else the folder or file name), the git remote URL with any user, password or token removed (the host is kept), and the branch, when the scanned folder is the root of a git checkout; a local-path or `file://` remote is never sent | only with `scan --upload`, unless `--app` is given | your Narvy account |
|
|
178
|
+
| With the findings of an APK, AAB or IPA: its package id (manifest package or CFBundleIdentifier) | only with `scan --upload` | your Narvy account |
|
|
179
|
+
| With a dependency finding of a source scan: the path of its manifest or lockfile relative to the scanned folder (e.g. `backend/package.json`), never an absolute path | only with `scan --upload` | your Narvy account |
|
|
180
|
+
| With the findings: the dependency check status, one word (`complete`, `partial`, `degraded` or `none`) | only with `scan --upload` | your Narvy account |
|
|
176
181
|
|
|
177
182
|
`scan --offline` sends nothing: no database or tool download, no usage
|
|
178
183
|
event, no GitHub advisory lookup. If jadx or Java is missing for an APK scan,
|
|
@@ -340,10 +345,16 @@ thread), then the scan fails with the numbers. `--force` runs exactly
|
|
|
340
345
|
send its results (the findings, never your code or binary) to your account,
|
|
341
346
|
where they are de-duplicated, false-positive filtered and kept in the
|
|
342
347
|
dashboard history; the CLI prints a direct link to the scan. This needs a
|
|
343
|
-
paid plan (
|
|
348
|
+
paid plan (Solo and up) and is never on by default. `narvy upload-all
|
|
344
349
|
<directory>` does the same for every binary target found in a folder in one
|
|
345
350
|
command. `narvy scans` lists recent scans on your account from the terminal.
|
|
346
351
|
|
|
352
|
+
In CI, set the token in the `NARVY_TOKEN` environment variable instead of
|
|
353
|
+
running `narvy login` (narvy.io > Profile > API Credentials). It takes
|
|
354
|
+
precedence over a stored login. `NARVY_API_TOKEN` is read as an alias when
|
|
355
|
+
`NARVY_TOKEN` is not set. With `--upload`, the token is checked before the
|
|
356
|
+
scan starts: a rejected token or an unreachable server exits 4 right away.
|
|
357
|
+
|
|
347
358
|
### Exit codes
|
|
348
359
|
|
|
349
360
|
| Code | Meaning |
|
|
@@ -423,7 +434,8 @@ crates.io, NuGet, SwiftURL), the CLI downloads
|
|
|
423
434
|
`https://osv-vulnerabilities.storage.googleapis.com/<ecosystem>/all.zip`.
|
|
424
435
|
The request names the ecosystem and nothing else: no package name, no code,
|
|
425
436
|
no path. The file is checked (size, md5, zip integrity), stored as SQLite in
|
|
426
|
-
`~/.cache/narvy/osv/` (`
|
|
437
|
+
`~/.cache/narvy/osv/` (`$XDG_CACHE_HOME/narvy/osv/` when `XDG_CACHE_HOME` is
|
|
438
|
+
set, `NARVY_OSV_DB_DIR` to choose another directory) with a sha256
|
|
427
439
|
checked on each use, and downloaded again when older than 24 hours.
|
|
428
440
|
|
|
429
441
|
```bash
|
|
@@ -458,7 +470,9 @@ library with no known source repository URL) are counted as unverified.
|
|
|
458
470
|
### CI
|
|
459
471
|
|
|
460
472
|
Cache `~/.cache/narvy/osv` between runs, or every run downloads the
|
|
461
|
-
database again. `narvy init-ci --github` and `--
|
|
473
|
+
database again. `narvy init-ci --github`, `--gitlab` and `--bitbucket` write
|
|
474
|
+
this for you, and add `--upload` to the scan when a `NARVY_TOKEN` secret or
|
|
475
|
+
variable is set (without one the scan stays local).
|
|
462
476
|
|
|
463
477
|
GitHub Actions, one key per UTC day:
|
|
464
478
|
|
|
@@ -77,15 +77,15 @@ Found 19 potential issues:
|
|
|
77
77
|
│ HIGH │ Hardcoded Cryptographic IV │ sources/com/android/insecurebankv2/… │ 26, 34 │ 2 │ MEDIUM │
|
|
78
78
|
│ │ (indirect) │ │ │ │ │
|
|
79
79
|
│ HIGH │ Application Data Backup is Enabled │ resources/AndroidManifest.xml │ 33 │ 1 │ HIGH │
|
|
80
|
-
│
|
|
80
|
+
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 163, 181 │ 2 │ LOW │
|
|
81
|
+
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 25, 29 │ 2 │ LOW │
|
|
82
|
+
│ MEDIUM │ Logging a value that looks like a │ sources/com/android/insecurebankv2/… │ 117 │ 1 │ MEDIUM │
|
|
81
83
|
│ │ credential/token/secret - readable │ │ │ │ │
|
|
82
84
|
│ │ via adb/crash reporters on many │ │ │ │ │
|
|
83
85
|
│ │ devices. │ │ │ │ │
|
|
84
|
-
│
|
|
86
|
+
│ MEDIUM │ JavaScript enabled in WebView - can │ sources/com/android/insecurebankv2/… │ 30 │ 1 │ MEDIUM │
|
|
85
87
|
│ │ enable XSS if untrusted content is │ │ │ │ │
|
|
86
88
|
│ │ loaded. │ │ │ │ │
|
|
87
|
-
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 163, 181 │ 2 │ LOW │
|
|
88
|
-
│ MEDIUM │ Write to Unscoped External Storage │ sources/com/android/insecurebankv2/… │ 25, 29 │ 2 │ LOW │
|
|
89
89
|
└──────────┴──────────────────────────────────────┴──────────────────────────────────────┴─────────────────────┴──────┴────────────┘
|
|
90
90
|
Scanned the decompiled app with 48 local rules (28 pattern, 2 taint, 18 structural); 9 of them produced findings.
|
|
91
91
|
```
|
|
@@ -133,7 +133,12 @@ Three other commands work on targets you own, without an app file:
|
|
|
133
133
|
| iOS library names | only with `NARVY_GITHUB_ADVISORIES=1` (never with `--offline`) | api.github.com |
|
|
134
134
|
| JRE and jadx downloads | first APK scan, only if Java 11+ or jadx is missing | api.adoptium.net, github.com |
|
|
135
135
|
| One anonymous usage event per command (fields listed in [Telemetry](#telemetry)) | every command except `store-check` and `telemetry`, on by default | narvy.io |
|
|
136
|
-
|
|
|
136
|
+
| Your API token only, to check it (`/api/v1/whoami`) | `scan --upload`, before the scan starts; `narvy login` | narvy.io (or `NARVY_URL`) |
|
|
137
|
+
| Findings, never code or binary | only with `--upload` (needs `narvy login` or `NARVY_TOKEN`) | your Narvy account |
|
|
138
|
+
| With the findings: the app name (the repository name from the git remote, else the folder or file name), the git remote URL with any user, password or token removed (the host is kept), and the branch, when the scanned folder is the root of a git checkout; a local-path or `file://` remote is never sent | only with `scan --upload`, unless `--app` is given | your Narvy account |
|
|
139
|
+
| With the findings of an APK, AAB or IPA: its package id (manifest package or CFBundleIdentifier) | only with `scan --upload` | your Narvy account |
|
|
140
|
+
| With a dependency finding of a source scan: the path of its manifest or lockfile relative to the scanned folder (e.g. `backend/package.json`), never an absolute path | only with `scan --upload` | your Narvy account |
|
|
141
|
+
| With the findings: the dependency check status, one word (`complete`, `partial`, `degraded` or `none`) | only with `scan --upload` | your Narvy account |
|
|
137
142
|
|
|
138
143
|
`scan --offline` sends nothing: no database or tool download, no usage
|
|
139
144
|
event, no GitHub advisory lookup. If jadx or Java is missing for an APK scan,
|
|
@@ -301,10 +306,16 @@ thread), then the scan fails with the numbers. `--force` runs exactly
|
|
|
301
306
|
send its results (the findings, never your code or binary) to your account,
|
|
302
307
|
where they are de-duplicated, false-positive filtered and kept in the
|
|
303
308
|
dashboard history; the CLI prints a direct link to the scan. This needs a
|
|
304
|
-
paid plan (
|
|
309
|
+
paid plan (Solo and up) and is never on by default. `narvy upload-all
|
|
305
310
|
<directory>` does the same for every binary target found in a folder in one
|
|
306
311
|
command. `narvy scans` lists recent scans on your account from the terminal.
|
|
307
312
|
|
|
313
|
+
In CI, set the token in the `NARVY_TOKEN` environment variable instead of
|
|
314
|
+
running `narvy login` (narvy.io > Profile > API Credentials). It takes
|
|
315
|
+
precedence over a stored login. `NARVY_API_TOKEN` is read as an alias when
|
|
316
|
+
`NARVY_TOKEN` is not set. With `--upload`, the token is checked before the
|
|
317
|
+
scan starts: a rejected token or an unreachable server exits 4 right away.
|
|
318
|
+
|
|
308
319
|
### Exit codes
|
|
309
320
|
|
|
310
321
|
| Code | Meaning |
|
|
@@ -384,7 +395,8 @@ crates.io, NuGet, SwiftURL), the CLI downloads
|
|
|
384
395
|
`https://osv-vulnerabilities.storage.googleapis.com/<ecosystem>/all.zip`.
|
|
385
396
|
The request names the ecosystem and nothing else: no package name, no code,
|
|
386
397
|
no path. The file is checked (size, md5, zip integrity), stored as SQLite in
|
|
387
|
-
`~/.cache/narvy/osv/` (`
|
|
398
|
+
`~/.cache/narvy/osv/` (`$XDG_CACHE_HOME/narvy/osv/` when `XDG_CACHE_HOME` is
|
|
399
|
+
set, `NARVY_OSV_DB_DIR` to choose another directory) with a sha256
|
|
388
400
|
checked on each use, and downloaded again when older than 24 hours.
|
|
389
401
|
|
|
390
402
|
```bash
|
|
@@ -419,7 +431,9 @@ library with no known source repository URL) are counted as unverified.
|
|
|
419
431
|
### CI
|
|
420
432
|
|
|
421
433
|
Cache `~/.cache/narvy/osv` between runs, or every run downloads the
|
|
422
|
-
database again. `narvy init-ci --github` and `--
|
|
434
|
+
database again. `narvy init-ci --github`, `--gitlab` and `--bitbucket` write
|
|
435
|
+
this for you, and add `--upload` to the scan when a `NARVY_TOKEN` secret or
|
|
436
|
+
variable is set (without one the scan stays local).
|
|
423
437
|
|
|
424
438
|
GitHub Actions, one key per UTC day:
|
|
425
439
|
|
|
@@ -20,9 +20,14 @@ def _env(name):
|
|
|
20
20
|
return os.environ.get(f"NARVY_{name}", "").strip()
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
def token_from_env():
|
|
24
|
+
"""The CI token: NARVY_TOKEN, or NARVY_API_TOKEN (the name the narvy.io cli.sh script reads) as an alias."""
|
|
25
|
+
return _env("TOKEN") or _env("API_TOKEN")
|
|
26
|
+
|
|
27
|
+
|
|
23
28
|
def load_credentials():
|
|
24
|
-
# NARVY_TOKEN overrides the stored file for CI / parallel use.
|
|
25
|
-
env_token =
|
|
29
|
+
# NARVY_TOKEN (alias NARVY_API_TOKEN) overrides the stored file for CI / parallel use.
|
|
30
|
+
env_token = token_from_env()
|
|
26
31
|
if env_token:
|
|
27
32
|
return {
|
|
28
33
|
"token": env_token,
|
|
@@ -420,7 +420,7 @@ def build_cbom(target: str) -> Tuple[Dict[str, Any], Dict[str, Any]]:
|
|
|
420
420
|
"metadata": {
|
|
421
421
|
"timestamp": _dt.datetime.now(_dt.timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z"),
|
|
422
422
|
"tools": {"components": [{"type": "application", "name": "narvy-cli", "version": __version__}]},
|
|
423
|
-
"component": {"type": "application", "name": os.path.basename(os.path.
|
|
423
|
+
"component": {"type": "application", "name": os.path.basename(os.path.abspath(target)) or target,
|
|
424
424
|
"bom-ref": "target"},
|
|
425
425
|
"properties": meta_props,
|
|
426
426
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Narvy SAST for Bitbucket Pipelines. Written by `narvy init-ci --bitbucket`; edit freely.
|
|
2
|
+
# Already have a bitbucket-pipelines.yml? Copy the step and the cache definition below into it instead of overwriting.
|
|
3
|
+
# SARIF is kept as a build artifact (not Code Insights); --fail-on still fails the build.
|
|
4
|
+
# With a secured NARVY_TOKEN repository variable (narvy.io > Profile > API Credentials),
|
|
5
|
+
# --upload also sends the findings (never code) to your Narvy dashboard. Without it,
|
|
6
|
+
# the scan stays local. --upload needs a paid plan (Solo and up): on Community it
|
|
7
|
+
# fails the build (exit 4, HTTP 403), so set NARVY_TOKEN only on a paid account.
|
|
8
|
+
# The dependency check downloads the OSV database (npm alone is about 220 MB) into
|
|
9
|
+
# ~/.cache/narvy/osv, cached as narvy-osv. Bitbucket keeps a cache 7 days and does not
|
|
10
|
+
# replace it before then, and saves it only when the step succeeds: the CLI downloads a newer copy when the cached one is older
|
|
11
|
+
# than 24 h, and uses the cached copy if that download fails.
|
|
12
|
+
image: python:3.11
|
|
13
|
+
|
|
14
|
+
definitions:
|
|
15
|
+
caches:
|
|
16
|
+
narvy-osv: ~/.cache/narvy/osv
|
|
17
|
+
|
|
18
|
+
pipelines:
|
|
19
|
+
default:
|
|
20
|
+
- step:
|
|
21
|
+
name: Narvy SAST
|
|
22
|
+
caches:
|
|
23
|
+
- narvy-osv
|
|
24
|
+
script:
|
|
25
|
+
- pip install --upgrade pip
|
|
26
|
+
- pip install narvy-cli
|
|
27
|
+
- narvy scan . --output sarif --file narvy-results.sarif --fail-on high ${NARVY_TOKEN:+--upload}
|
|
28
|
+
artifacts:
|
|
29
|
+
- narvy-results.sarif
|
|
@@ -42,11 +42,19 @@ jobs:
|
|
|
42
42
|
|
|
43
43
|
- name: Run Narvy scan
|
|
44
44
|
# SARIF is written before the --fail-on gate, so the Security tab fills even on a failing build.
|
|
45
|
+
# With a NARVY_TOKEN repository secret (narvy.io > Profile > API Credentials), --upload also
|
|
46
|
+
# sends the findings (never code) to your Narvy dashboard. Without it, the scan stays local.
|
|
47
|
+
# --upload needs a paid plan (Solo and up): on Community it fails the build (exit 4, HTTP 403),
|
|
48
|
+
# so set NARVY_TOKEN only on a paid account.
|
|
49
|
+
# Secrets are not passed to pull requests from forks: those runs stay local.
|
|
50
|
+
env:
|
|
51
|
+
NARVY_TOKEN: ${{ secrets.NARVY_TOKEN }}
|
|
45
52
|
run: |
|
|
46
53
|
narvy scan . \
|
|
47
54
|
--output sarif \
|
|
48
55
|
--file narvy-results.sarif \
|
|
49
|
-
--fail-on high
|
|
56
|
+
--fail-on high \
|
|
57
|
+
${NARVY_TOKEN:+--upload}
|
|
50
58
|
|
|
51
59
|
- name: Save the OSV database cache
|
|
52
60
|
if: always() # also when --fail-on failed the build
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
# folders are not scanned). GitLab has no date variable for a cache key: the key
|
|
11
11
|
# is fixed and the CLI itself refreshes a copy older than 24 h, which this job
|
|
12
12
|
# then saves back (when: always).
|
|
13
|
+
# With a masked NARVY_TOKEN CI/CD variable (narvy.io > Profile > API Credentials),
|
|
14
|
+
# --upload also sends the findings (never code) to your Narvy dashboard. Without
|
|
15
|
+
# it, the scan stays local. --upload needs a paid plan (Solo and up): on
|
|
16
|
+
# Community it fails the pipeline (exit 4, HTTP 403), so set NARVY_TOKEN only on
|
|
17
|
+
# a paid account.
|
|
13
18
|
stages:
|
|
14
19
|
- test
|
|
15
20
|
|
|
@@ -25,9 +30,9 @@ narvy_sast:
|
|
|
25
30
|
when: always
|
|
26
31
|
before_script:
|
|
27
32
|
- pip install --upgrade pip
|
|
28
|
-
- pip install "narvy-cli>=1.3.
|
|
33
|
+
- pip install "narvy-cli>=1.3.1"
|
|
29
34
|
script:
|
|
30
|
-
- narvy scan . --output gitlab --file gl-sast-report.json --fail-on high || echo $? > narvy-exit-code
|
|
35
|
+
- narvy scan . --output gitlab --file gl-sast-report.json ${NARVY_TOKEN:+--upload} --fail-on high || echo $? > narvy-exit-code
|
|
31
36
|
artifacts:
|
|
32
37
|
when: always
|
|
33
38
|
reports:
|
|
@@ -7,6 +7,7 @@ never sends one anywhere.
|
|
|
7
7
|
"""
|
|
8
8
|
import boto3
|
|
9
9
|
from botocore.exceptions import ClientError, NoCredentialsError, EndpointConnectionError
|
|
10
|
+
import contextvars
|
|
10
11
|
import json
|
|
11
12
|
from datetime import datetime
|
|
12
13
|
import time
|
|
@@ -17,6 +18,19 @@ from .rule_severity import stamp_items as _stamp_rule_severity
|
|
|
17
18
|
|
|
18
19
|
logger = logging.getLogger(__name__)
|
|
19
20
|
|
|
21
|
+
# Checks that errored inside an analyzer which keeps going (one bucket, one
|
|
22
|
+
# user, one WAF scope). analyze_aws_security reads them into coverage, so a
|
|
23
|
+
# check that did not run is a gap, never a pass.
|
|
24
|
+
_partial_errors = contextvars.ContextVar("narvy_aws_partial_errors", default=None)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _note_skip(label, err):
|
|
28
|
+
"""Record that `label` could not be checked (coverage becomes partial)."""
|
|
29
|
+
logger.error(f"{label}: {err}")
|
|
30
|
+
sink = _partial_errors.get()
|
|
31
|
+
if sink is not None:
|
|
32
|
+
sink.append(f"{label}: {err}")
|
|
33
|
+
|
|
20
34
|
class CustomJSONEncoder(json.JSONEncoder):
|
|
21
35
|
def default(self, obj):
|
|
22
36
|
if isinstance(obj, datetime):
|
|
@@ -221,7 +235,7 @@ def analyze_s3_buckets(endpoint_url=None):
|
|
|
221
235
|
})
|
|
222
236
|
break
|
|
223
237
|
except ClientError as e:
|
|
224
|
-
|
|
238
|
+
_note_skip(f"s3_buckets/{bucket['Name']} acl", e)
|
|
225
239
|
|
|
226
240
|
return vulnerable_buckets
|
|
227
241
|
|
|
@@ -239,8 +253,9 @@ def _has_console_access(iam, user_name):
|
|
|
239
253
|
if e.response['Error']['Code'] == 'NoSuchEntity':
|
|
240
254
|
return False
|
|
241
255
|
# On any other error, be conservative and treat as console user so we
|
|
242
|
-
# don't silently drop a real human; the MFA finding stays MEDIUM.
|
|
243
|
-
|
|
256
|
+
# don't silently drop a real human; the MFA finding stays MEDIUM. The
|
|
257
|
+
# check is still a gap: console access was not read.
|
|
258
|
+
_note_skip(f"iam_users/{user_name} login profile", e)
|
|
244
259
|
return True
|
|
245
260
|
|
|
246
261
|
|
|
@@ -700,7 +715,7 @@ def check_cis_compliance(endpoint_url=None):
|
|
|
700
715
|
})
|
|
701
716
|
except ClientError as e:
|
|
702
717
|
if e.response['Error']['Code'] != 'NoSuchEntity':
|
|
703
|
-
|
|
718
|
+
_note_skip(f"cis_compliance/CIS 1.2 {user['UserName']}", e)
|
|
704
719
|
|
|
705
720
|
# Check 1.3: Ensure credentials unused for 90 days or greater are disabled
|
|
706
721
|
try:
|
|
@@ -718,7 +733,8 @@ def check_cis_compliance(endpoint_url=None):
|
|
|
718
733
|
raise
|
|
719
734
|
|
|
720
735
|
if credential_report is None:
|
|
721
|
-
|
|
736
|
+
_note_skip("cis_compliance/CIS 1.3 credential report",
|
|
737
|
+
"not generated after 5 attempts")
|
|
722
738
|
return compliance_issues
|
|
723
739
|
|
|
724
740
|
credential_report = credential_report.decode('utf-8').split('\n')
|
|
@@ -746,7 +762,7 @@ def check_cis_compliance(endpoint_url=None):
|
|
|
746
762
|
})
|
|
747
763
|
|
|
748
764
|
except Exception as e:
|
|
749
|
-
|
|
765
|
+
_note_skip("cis_compliance/CIS 1.3 credential report", e)
|
|
750
766
|
|
|
751
767
|
return compliance_issues
|
|
752
768
|
|
|
@@ -1048,10 +1064,7 @@ def analyze_waf(region, endpoint_url=None):
|
|
|
1048
1064
|
'Recommendation': 'Add rules to the regional Web ACL to protect against common web exploits.'
|
|
1049
1065
|
})
|
|
1050
1066
|
except ClientError as e:
|
|
1051
|
-
|
|
1052
|
-
logger.error(f"No access to WAF in region {region}. Skipping.")
|
|
1053
|
-
else:
|
|
1054
|
-
logger.error(f"Error accessing regional WAF in {region}: {str(e)}")
|
|
1067
|
+
_note_skip(f"{region}/waf_regional", e)
|
|
1055
1068
|
|
|
1056
1069
|
# Analyse WAF global (CloudFront)
|
|
1057
1070
|
try:
|
|
@@ -1067,7 +1080,7 @@ def analyze_waf(region, endpoint_url=None):
|
|
|
1067
1080
|
'Recommendation': 'Add rules to the global Web ACL to protect against common web exploits.'
|
|
1068
1081
|
})
|
|
1069
1082
|
except ClientError as e:
|
|
1070
|
-
|
|
1083
|
+
_note_skip("waf_global", e)
|
|
1071
1084
|
|
|
1072
1085
|
return issues
|
|
1073
1086
|
|
|
@@ -1168,6 +1181,32 @@ def analyze_aws_security(credentials=None, region=None, endpoint_url=None):
|
|
|
1168
1181
|
# Analyzers that couldn't finish (AccessDenied, throttling), so a blind scan
|
|
1169
1182
|
# shows up as a coverage gap instead of a clean pass.
|
|
1170
1183
|
coverage_errors = []
|
|
1184
|
+
partial_errors = []
|
|
1185
|
+
partial_token = _partial_errors.set(partial_errors)
|
|
1186
|
+
try:
|
|
1187
|
+
report, regions = _run_aws_checks(region, endpoint_url, coverage_errors)
|
|
1188
|
+
finally:
|
|
1189
|
+
_partial_errors.reset(partial_token)
|
|
1190
|
+
# The global WAF scope is read once per region: one gap, not N.
|
|
1191
|
+
for err in partial_errors:
|
|
1192
|
+
if err not in coverage_errors:
|
|
1193
|
+
coverage_errors.append(err)
|
|
1194
|
+
|
|
1195
|
+
# Coverage: a scan that could not read some services/regions is NOT a clean 0.
|
|
1196
|
+
report["account_id"] = account_id
|
|
1197
|
+
report["coverage"] = {
|
|
1198
|
+
"status": "partial" if coverage_errors else "complete",
|
|
1199
|
+
"regions_scanned": len(regions),
|
|
1200
|
+
"checks_skipped": len(coverage_errors),
|
|
1201
|
+
"errors": coverage_errors,
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
logger.info("AWS security analysis complete")
|
|
1205
|
+
return report
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
def _run_aws_checks(region, endpoint_url, coverage_errors):
|
|
1209
|
+
"""(report, regions): every analyzer, each isolated; failures go to coverage_errors."""
|
|
1171
1210
|
|
|
1172
1211
|
def _collect(dest, label, fn):
|
|
1173
1212
|
try:
|
|
@@ -1268,14 +1307,4 @@ def analyze_aws_security(credentials=None, region=None, endpoint_url=None):
|
|
|
1268
1307
|
all_vulnerable_kms_keys, all_config_issues, all_cloudtrail_issues, all_cloudwatch_issues
|
|
1269
1308
|
)
|
|
1270
1309
|
|
|
1271
|
-
|
|
1272
|
-
report["account_id"] = account_id
|
|
1273
|
-
report["coverage"] = {
|
|
1274
|
-
"status": "partial" if coverage_errors else "complete",
|
|
1275
|
-
"regions_scanned": len(regions),
|
|
1276
|
-
"checks_skipped": len(coverage_errors),
|
|
1277
|
-
"errors": coverage_errors,
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
logger.info("AWS security analysis complete")
|
|
1281
|
-
return report
|
|
1310
|
+
return report, regions
|
|
@@ -981,6 +981,7 @@ def analyze_ipa(ipa_path: str, override_config: Optional[ScopeConfig] = None) ->
|
|
|
981
981
|
return result
|
|
982
982
|
|
|
983
983
|
app_bundle_id = get_own_bundle_id(plist)
|
|
984
|
+
result["bundle_id"] = app_bundle_id
|
|
984
985
|
|
|
985
986
|
exe_name = plist.get("CFBundleExecutable")
|
|
986
987
|
if not exe_name:
|
|
@@ -31,11 +31,6 @@ _EXTRA_SKIP_DIR_NAMES = frozenset({"node_modules", ".git"})
|
|
|
31
31
|
# Suffix match: Xcode names test folders <TargetName>Tests / <TargetName>UITests.
|
|
32
32
|
_TEST_DIR_SUFFIXES = ("Tests", "UITests")
|
|
33
33
|
|
|
34
|
-
_SEMGREP_SEVERITY_MAP = {
|
|
35
|
-
"ERROR": "CRITICAL",
|
|
36
|
-
"WARNING": "HIGH",
|
|
37
|
-
"INFO": "MEDIUM",
|
|
38
|
-
}
|
|
39
34
|
|
|
40
35
|
|
|
41
36
|
def _is_test_dir_name(name: str) -> bool:
|
|
@@ -107,7 +102,7 @@ def _load_swift_semgrep_rule_defs() -> List[Dict[str, Any]]:
|
|
|
107
102
|
defs.append({
|
|
108
103
|
"id": rule["id"],
|
|
109
104
|
"name": rule.get("message", rule["id"])[:120],
|
|
110
|
-
"severity":
|
|
105
|
+
"severity": semgrep_engine.map_severity(rule.get("severity")),
|
|
111
106
|
"details": {
|
|
112
107
|
"cwe": meta.get("cwe", ""),
|
|
113
108
|
"masvs": meta.get("masvs", ""),
|
|
@@ -202,7 +197,7 @@ def _run_swift_semgrep(source_dir: str,
|
|
|
202
197
|
):
|
|
203
198
|
continue
|
|
204
199
|
|
|
205
|
-
severity =
|
|
200
|
+
severity = semgrep_engine.map_severity(extra.get("severity"))
|
|
206
201
|
message = extra.get("message", "")
|
|
207
202
|
|
|
208
203
|
# Downgrade trust-all-certs when guarded by a per-request opt-in flag.
|