notaffected 1.0.0__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.
- notaffected-1.0.0/.github/workflows/ci.yml +61 -0
- notaffected-1.0.0/.github/workflows/publish.yml +93 -0
- notaffected-1.0.0/.gitignore +12 -0
- notaffected-1.0.0/CHANGELOG.md +17 -0
- notaffected-1.0.0/LICENSE +21 -0
- notaffected-1.0.0/PKG-INFO +206 -0
- notaffected-1.0.0/README.md +174 -0
- notaffected-1.0.0/SECURITY.md +27 -0
- notaffected-1.0.0/docs/architecture.html +229 -0
- notaffected-1.0.0/docs/architecture.png +0 -0
- notaffected-1.0.0/docs/dashboard.png +0 -0
- notaffected-1.0.0/examples/custom-rule.yaml +42 -0
- notaffected-1.0.0/examples/trivy-scan.json +46 -0
- notaffected-1.0.0/fixtures/openvex_json_schema.json +317 -0
- notaffected-1.0.0/fixtures/qa/grype_min.json +7 -0
- notaffected-1.0.0/fixtures/qa/osv/CVE-2023-38408.json.gz +0 -0
- notaffected-1.0.0/fixtures/qa/osv/CVE-2024-1086.json.gz +0 -0
- notaffected-1.0.0/fixtures/qa/osv/UBUNTU-CVE-2023-38408.json.gz +0 -0
- notaffected-1.0.0/fixtures/qa/osv/UBUNTU-CVE-2024-1086.json.gz +0 -0
- notaffected-1.0.0/fixtures/qa/trivy_langpkg.json +4 -0
- notaffected-1.0.0/fixtures/trivy_ubuntu_sample.json +32 -0
- notaffected-1.0.0/lab/inventory.yaml +13 -0
- notaffected-1.0.0/lab/setup_lab.sh +227 -0
- notaffected-1.0.0/lab/teardown_lab.sh +8 -0
- notaffected-1.0.0/notaffected/__init__.py +3 -0
- notaffected-1.0.0/notaffected/__main__.py +8 -0
- notaffected-1.0.0/notaffected/advisories/__init__.py +1 -0
- notaffected-1.0.0/notaffected/advisories/ai_advisor.py +104 -0
- notaffected-1.0.0/notaffected/advisories/builtin_specs.py +371 -0
- notaffected-1.0.0/notaffected/advisories/custom_rules.py +293 -0
- notaffected-1.0.0/notaffected/advisories/extractor.py +1088 -0
- notaffected-1.0.0/notaffected/advisories/fetcher.py +562 -0
- notaffected-1.0.0/notaffected/advisories/live_feed.py +345 -0
- notaffected-1.0.0/notaffected/cli.py +435 -0
- notaffected-1.0.0/notaffected/engine/__init__.py +1 -0
- notaffected-1.0.0/notaffected/engine/evaluator.py +269 -0
- notaffected-1.0.0/notaffected/importers/__init__.py +1 -0
- notaffected-1.0.0/notaffected/importers/scanners.py +158 -0
- notaffected-1.0.0/notaffected/inventory.py +408 -0
- notaffected-1.0.0/notaffected/local_model.py +440 -0
- notaffected-1.0.0/notaffected/model.py +251 -0
- notaffected-1.0.0/notaffected/probes/__init__.py +1 -0
- notaffected-1.0.0/notaffected/probes/patch_tracker.py +122 -0
- notaffected-1.0.0/notaffected/probes/primitives.py +2378 -0
- notaffected-1.0.0/notaffected/probes/runner.py +382 -0
- notaffected-1.0.0/notaffected/render/__init__.py +1 -0
- notaffected-1.0.0/notaffected/render/console.py +127 -0
- notaffected-1.0.0/notaffected/render/html.py +835 -0
- notaffected-1.0.0/notaffected/render/json_out.py +46 -0
- notaffected-1.0.0/notaffected/render/vex.py +91 -0
- notaffected-1.0.0/notaffected/rules/linux/kernel.yaml +153 -0
- notaffected-1.0.0/notaffected/rules/linux/services.yaml +199 -0
- notaffected-1.0.0/notaffected/rules/windows/server_roles.yaml +201 -0
- notaffected-1.0.0/notaffected/web.py +2420 -0
- notaffected-1.0.0/pyproject.toml +63 -0
- notaffected-1.0.0/tests/test_advisories.py +965 -0
- notaffected-1.0.0/tests/test_cli_e2e.py +248 -0
- notaffected-1.0.0/tests/test_custom_rules_rpm_fw.py +538 -0
- notaffected-1.0.0/tests/test_evaluator.py +241 -0
- notaffected-1.0.0/tests/test_importers.py +133 -0
- notaffected-1.0.0/tests/test_model.py +135 -0
- notaffected-1.0.0/tests/test_phase5.py +841 -0
- notaffected-1.0.0/tests/test_probes.py +983 -0
- notaffected-1.0.0/tests/test_qa_regressions.py +247 -0
- notaffected-1.0.0/tests/test_render.py +253 -0
- notaffected-1.0.0/tests/test_runners.py +86 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint-and-test:
|
|
14
|
+
name: Lint & Test (Python ${{ matrix.python-version }})
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout repository
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
cache: pip
|
|
30
|
+
|
|
31
|
+
- name: Install package and dev dependencies
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install --upgrade pip
|
|
34
|
+
pip install -e ".[dev]"
|
|
35
|
+
|
|
36
|
+
- name: Run Ruff linter
|
|
37
|
+
run: ruff check .
|
|
38
|
+
|
|
39
|
+
- name: Run Pytest suite
|
|
40
|
+
run: pytest -q
|
|
41
|
+
|
|
42
|
+
- name: Smoke test CLI demo & OpenVEX export
|
|
43
|
+
run: |
|
|
44
|
+
notaffected scan --demo-fleet --offline --emit-vex /tmp/demo.vex.json --json /tmp/demo.json --html /tmp/demo.html
|
|
45
|
+
test -s /tmp/demo.html
|
|
46
|
+
python - <<'EOF'
|
|
47
|
+
import collections
|
|
48
|
+
import json
|
|
49
|
+
|
|
50
|
+
import jsonschema
|
|
51
|
+
|
|
52
|
+
report = json.load(open("/tmp/demo.json"))
|
|
53
|
+
counts = dict(collections.Counter(v["status"] for v in report["verdicts"]))
|
|
54
|
+
print(counts)
|
|
55
|
+
# 5 demo hosts x 25 built-in CVEs (7 Python + 18 bundled YAML); a change here must be explained.
|
|
56
|
+
assert counts == {"not_affected": 112, "affected": 4, "under_investigation": 9}, counts
|
|
57
|
+
vex = json.load(open("/tmp/demo.vex.json"))
|
|
58
|
+
assert len(vex["statements"]) == 125, len(vex["statements"])
|
|
59
|
+
jsonschema.validate(vex, json.load(open("fixtures/openvex_json_schema.json")))
|
|
60
|
+
print("OpenVEX document is valid against the official v0.2.0 schema")
|
|
61
|
+
EOF
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build-and-verify:
|
|
14
|
+
name: Build & Verify Package
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python 3.12
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install build and test tools
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install build twine
|
|
29
|
+
pip install -e ".[dev]"
|
|
30
|
+
|
|
31
|
+
- name: Verify tag matches package version
|
|
32
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
33
|
+
run: |
|
|
34
|
+
TAG_VER="${GITHUB_REF_NAME#v}"
|
|
35
|
+
PKG_VER="$(python -c 'import notaffected; print(notaffected.__version__)')"
|
|
36
|
+
echo "Tag version: ${TAG_VER} | Package version: ${PKG_VER}"
|
|
37
|
+
test "${TAG_VER}" = "${PKG_VER}"
|
|
38
|
+
|
|
39
|
+
- name: Run linter and test suite
|
|
40
|
+
run: |
|
|
41
|
+
ruff check .
|
|
42
|
+
pytest -q
|
|
43
|
+
|
|
44
|
+
- name: Build sdist and wheel
|
|
45
|
+
run: python -m build --outdir dist/
|
|
46
|
+
|
|
47
|
+
- name: Validate package metadata for PyPI
|
|
48
|
+
run: twine check --strict dist/*
|
|
49
|
+
|
|
50
|
+
- name: Upload build artifacts
|
|
51
|
+
uses: actions/upload-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: release-dists
|
|
54
|
+
path: dist/
|
|
55
|
+
|
|
56
|
+
publish-pypi:
|
|
57
|
+
name: Publish to PyPI (OIDC)
|
|
58
|
+
needs: build-and-verify
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
environment:
|
|
61
|
+
name: pypi
|
|
62
|
+
url: https://pypi.org/p/notaffected
|
|
63
|
+
permissions:
|
|
64
|
+
id-token: write
|
|
65
|
+
steps:
|
|
66
|
+
- name: Download build artifacts
|
|
67
|
+
uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: release-dists
|
|
70
|
+
path: dist/
|
|
71
|
+
|
|
72
|
+
- name: Publish distributions to PyPI
|
|
73
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
74
|
+
|
|
75
|
+
github-release:
|
|
76
|
+
name: Create GitHub Release
|
|
77
|
+
needs: publish-pypi
|
|
78
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
permissions:
|
|
81
|
+
contents: write
|
|
82
|
+
steps:
|
|
83
|
+
- name: Download build artifacts
|
|
84
|
+
uses: actions/download-artifact@v4
|
|
85
|
+
with:
|
|
86
|
+
name: release-dists
|
|
87
|
+
path: dist/
|
|
88
|
+
|
|
89
|
+
- name: Create GitHub Release
|
|
90
|
+
uses: softprops/action-gh-release@v2
|
|
91
|
+
with:
|
|
92
|
+
generate_release_notes: true
|
|
93
|
+
files: dist/*
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `notaffected` are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2026-11-26
|
|
6
|
+
|
|
7
|
+
Initial public release of `notaffected`.
|
|
8
|
+
|
|
9
|
+
### Highlights
|
|
10
|
+
- **Deterministic Reachability Engine:** Three-valued (`MET` / `NOT_MET` / `UNKNOWN`) fail-closed evaluation over a closed set of 12 read-only probes for Linux (`dpkg`, `apk`, `rpm`, `systemd`, `ss`, `ufw`, `firewalld`, `nftables`, `sysctl`, `/proc/modules`, config files) and Windows Server (PowerShell over OpenSSH: build/KB, Registry, Services, Processes).
|
|
11
|
+
- **Native Multi-Distro Package & Firewall Support:** Exact `dpkg --compare-versions`, `apk version -t`, and pure-Python native RPM EVR (`rpmvercmp`) comparison with per-release fix matching (Ubuntu, Debian, Alpine, RHEL, Rocky Linux, AlmaLinux), plus fail-closed `ufw`, `firewalld`, and `nftables` inspection.
|
|
12
|
+
- **Multi-Source Advisory Feeds:** Built-in curated golden specs, OSV.dev (Ubuntu, Debian, Alpine), Red Hat Security Data API, Microsoft MSRC CVRF v3.0, MITRE CVE v5, and CISA KEV live auto-scan (`notaffected scan`) with concurrent fetching and atomic local caching.
|
|
13
|
+
- **Custom & Bundled YAML Rules (`--rules`):** Ships with 25 curated Linux & Windows Server rules (including 18 bundled YAML rules under `notaffected/rules/`) and loads/validates user-authored CheckSpec YAML files or directories across `spec`, `check`, `filter`, `scan`, and `ui`.
|
|
14
|
+
- **Standards-Compliant Outputs:** Official **OpenVEX v0.2.0** (`.vex.json`) with Package URLs (`pkg:deb/...`, `pkg:rpm/...`, `pkg:apk/...`) compatible with `trivy --vex`, full **Audit JSON**, and a self-contained Obsidian Dark/Light **Standalone HTML** report.
|
|
15
|
+
- **Local Web Dashboard (`notaffected ui`):** Zero-dependency master-detail dark console with Light/Dark toggle, False-Positive Noise Cut KPI, interactive Probe Inspector drawer, lab-only 1-click mitigations with re-verification, and strict loopback/token/CSRF hardening (`--allow-remote` + `NOTAFFECTED_REMOTE_TOKEN`).
|
|
16
|
+
- **Optional BYOM AI Advisor:** Off by default; supports any OpenAI-compatible server, Ollama, OpenAI, Anthropic, Gemini, or CLI provider for grounded parameter extraction (`--llm`) and operational remediation briefings (`--ai-explain`) without ever deciding verdicts.
|
|
17
|
+
- **Scanner & Fleet Support:** Filter Trivy and Grype JSON reports (`notaffected filter`), target local hosts, Linux/Windows SSH fleets, Docker containers, Kubernetes pods, YAML inventories (`notaffected init`), or the built-in 5-host mixed Linux + Windows Server `--demo-fleet`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thanos Katsaounis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: notaffected
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Deterministically prove whether CVEs actually affect Linux & Windows Server hosts and emit OpenVEX v0.2.0.
|
|
5
|
+
Project-URL: Homepage, https://github.com/KatsaounisThanasis/notaffected
|
|
6
|
+
Project-URL: Repository, https://github.com/KatsaounisThanasis/notaffected
|
|
7
|
+
Project-URL: Issues, https://github.com/KatsaounisThanasis/notaffected/issues
|
|
8
|
+
Author: Thanos Katsaounis
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cve,devsecops,grype,linux,openvex,reachability,security,sre,trivy,vex,vulnerability-management
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Security
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Requires-Dist: rich>=13.0.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: jsonschema>=4.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# notaffected
|
|
34
|
+
|
|
35
|
+
[](https://github.com/KatsaounisThanasis/notaffected/actions/workflows/ci.yml)
|
|
36
|
+
[](https://pypi.org/project/notaffected/)
|
|
37
|
+
[](https://www.python.org/downloads/)
|
|
38
|
+
[](https://openvex.dev/)
|
|
39
|
+
[](https://github.com/KatsaounisThanasis/notaffected/blob/main/LICENSE)
|
|
40
|
+
|
|
41
|
+
**From 10,000 noisy CVE alerts down to the 3 that actually matter — with deterministic proof and OpenVEX output for all the rest.**
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
Every week dozens of new CVEs are published, and AI-assisted research is finding them faster than ever. Traditional vulnerability scanners (Trivy, Grype, Qualys, Nessus) only check package versions: *"You have package X at version Y, therefore you are vulnerable."* They do not know whether the vulnerable code path or service can actually be triggered on your machine. It is like a smoke alarm that goes off every time you make toast: eventually you either panic or mute it.
|
|
46
|
+
|
|
47
|
+
`notaffected` bridges the gap between security advisories and the real runtime state of your Linux and Windows Server hosts, containers, and Kubernetes pods:
|
|
48
|
+
|
|
49
|
+
1. **Extracts attack preconditions** from official advisories (built-in golden specs for Linux & Windows, OSV.dev / Ubuntu / Debian / Alpine OSV records, Red Hat Security Data API, Microsoft MSRC CVRF v3.0, MITRE CVE v5, CISA KEV, and optional schema-validated LLM extraction with any provider and model you configure, local or hosted).
|
|
50
|
+
2. **Runs deterministic, read-only probes** on your targets (local host, Linux/Windows SSH fleet, Docker containers, or Kubernetes pods). **AI never decides the verdict and never runs shell commands**: the optional LLM may only propose parameters for the closed probe set, each one must be named in the advisory, it never sets the OS family or the VEX justification, and a `NOT_MET` from an LLM-proposed or keyword-heuristic check never yields `not_affected` on its own. `not_affected` needs a `NOT_MET` from a curated or structured-data check (or a probe-confirmed OS mismatch); every check that cannot compare, see or confirm something resolves to `under_investigation`.
|
|
51
|
+
3. **Delivers actionable output:**
|
|
52
|
+
- The short list of hosts that are **truly affected**, the exact temporary mitigation commands (`ufw`, `sysctl`, `modprobe -r`, `systemctl`, or PowerShell `Set-ItemProperty` / `Stop-Service`) to run right now, live APT patch status on Linux (`apt-cache policy`; Windows KB status comes from the built-in spec, not a live query), and an optional **AI Operational Risk & Remediation Briefing** (`--ai-explain`).
|
|
53
|
+
- For every unaffected host, **`not_affected` with deterministic proof** (e.g. kernel module blocked from loading, service listening only on `127.0.0.1`, firewall default deny, or Windows Registry mitigation active).
|
|
54
|
+
- A standard **OpenVEX v0.2.0** file (`.vex.json`). Statements about an installed package carry its Package URL (e.g. `pkg:deb/ubuntu/openssh-server@9.6p1-3ubuntu13.3?epoch=1`), which is what `trivy --vex` matches on: as the product when the document covers one host, as a subcomponent of the host when it covers a fleet. For Trivy, emit one VEX document per host. Dependency-Track does not import OpenVEX yet ([DependencyTrack/dependency-track#7094](https://github.com/DependencyTrack/dependency-track/issues/7094)). An optional standalone **HTML audit report** (`--html`) is also available.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Architecture
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
### Closed Set of 12 Read-Only Probes (Linux & Windows Server)
|
|
63
|
+
|
|
64
|
+
| Probe Type | OS | System Check | OpenVEX Justification (when `NOT_MET`) |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| `kernel_version_vulnerable` | Linux | `uname -r` + `dpkg --compare-versions`, only against fix data for the kernel's own track (line + flavour); a curated `mainline_from` line counts any kernel at or above it as fixed; other tracks are `UNKNOWN` | `vulnerable_code_not_present` |
|
|
67
|
+
| `package_installed_vulnerable` | Linux | `dpkg-query -W` (`apk info` / `rpm -q` when dpkg is absent) + comparator (`dpkg --compare-versions` / `apk version -t` / native RPM EVR `rpmvercmp`), against the fix for the host's own distro release; cross-distro or unlisted releases are `UNKNOWN` | `component_not_present` / `vulnerable_code_not_present` |
|
|
68
|
+
| `kernel_module_loaded` | Linux | `/proc/modules`; "not loaded" counts only when loading is blocked (`modprobe -c` `install <mod> /bin/false`, or `kernel.modules_disabled=1`) | `vulnerable_code_not_in_execute_path` |
|
|
69
|
+
| `sysctl_equals` | Linux | `sysctl -n <key>` | `inline_mitigations_already_exist` |
|
|
70
|
+
| `network_listener` | Linux | `ss -tulpnH` (loopback `127.0.0.0/8`, `::1`, `%lo` vs public); a process filter needs visible process names (root) | `vulnerable_code_not_in_execute_path` |
|
|
71
|
+
| `firewall_allows_port` | Linux | `ufw status verbose`, falling back to `firewall-cmd --list-all` (firewalld) and `nft list ruleset` (nftables); ambiguous rules, unknown services/profiles or a Docker bridge are `UNKNOWN` | `inline_mitigations_already_exist` |
|
|
72
|
+
| `systemd_service_active` | Linux | `systemctl is-active <unit>` + `LoadState` + its `.socket` unit | `vulnerable_code_not_in_execute_path` |
|
|
73
|
+
| `process_running` | Linux / Windows | `ps -eo comm,args` / PowerShell `Get-Process` | `vulnerable_code_not_in_execute_path` |
|
|
74
|
+
| `config_contains` | Linux | `cat <config_path>` (regex on lines that are not `#` / `;` comments; for sshd, `sshd -T` or the first occurrence of the directive) | `inline_mitigations_already_exist` / `vulnerable_code_not_in_execute_path` |
|
|
75
|
+
| `windows_build_vulnerable` | Windows | PowerShell `Get-HotFix` + `CurrentBuildNumber.UBR` | `vulnerable_code_not_present` |
|
|
76
|
+
| `windows_registry_equals` | Windows | PowerShell `Get-ItemProperty` (`HKLM:\` / `HKCU:\`) | `inline_mitigations_already_exist` |
|
|
77
|
+
| `windows_service_active` | Windows | PowerShell `(Get-Service -Name <svc>).Status` | `vulnerable_code_not_in_execute_path` |
|
|
78
|
+
|
|
79
|
+
The justification column shows the default per probe. Built-in specs set it per check; LLM-proposed checks always use the per-probe default, and their `NOT_MET` never yields `not_affected` on its own.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Installation
|
|
84
|
+
|
|
85
|
+
Run without installing globally via `uvx` or install with `pipx` / `pip`:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Instant run (uv)
|
|
89
|
+
uvx notaffected ui
|
|
90
|
+
|
|
91
|
+
# Isolated CLI install (pipx)
|
|
92
|
+
pipx install notaffected
|
|
93
|
+
|
|
94
|
+
# Standard pip install
|
|
95
|
+
pip install notaffected
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For local development from source:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://github.com/KatsaounisThanasis/notaffected.git
|
|
102
|
+
cd notaffected
|
|
103
|
+
uv venv && uv pip install -e ".[dev]"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Quick Start
|
|
109
|
+
|
|
110
|
+
### 1. Launch the Local Web Dashboard (`notaffected ui`)
|
|
111
|
+
```bash
|
|
112
|
+
notaffected ui --port 8484
|
|
113
|
+
# Open http://127.0.0.1:8484 in your browser
|
|
114
|
+
```
|
|
115
|
+
From the Web Dashboard you can:
|
|
116
|
+
- Auto-discover running Docker containers, load `inventory.yaml`, select a single custom Docker/SSH target, or inspect the simulated Linux + Windows Server fleet.
|
|
117
|
+
- Run **Auto-Scan** (combines built-in rules + live OSV `/v1/querybatch` queries for a fixed watch list of 7 packages, keeping up to 6 OSV CVEs, + up to 4 CISA KEV actively exploited CVEs), check specific CVE IDs, or upload a **Trivy / Grype JSON report**.
|
|
118
|
+
- Try allowlisted temporary mitigations on the lab via **Run Mitigation**, reset the lab via **Reset Lab / Demo**, and download **OpenVEX v0.2.0 (`.vex.json`)**, **Audit JSON**, or a **Standalone HTML Report**. Run Mitigation works only on the simulated fleet (where the row flip is simulated) and on Docker containers labelled `notaffected.lab=true`; it refuses local and SSH hosts and any container without that label (also when it comes from an inventory file), because the tool's design is to never change real target hosts. Apply mitigations on real hosts yourself.
|
|
119
|
+
- Every dashboard POST needs the per-process token embedded in the page, and `notaffected ui` refuses a non-loopback `--bind` unless you pass `--allow-remote` **and** set `NOTAFFECTED_REMOTE_TOKEN` (at least 16 chars, never embedded in unauthenticated HTML).
|
|
120
|
+
|
|
121
|
+
### 2. Zero-Argument Auto-Scan & Fleet Initialization
|
|
122
|
+
```bash
|
|
123
|
+
# Auto-generate an inventory file (discovering running Docker containers)
|
|
124
|
+
notaffected init --discover-docker -o inventory.yaml
|
|
125
|
+
|
|
126
|
+
# Scan your fleet against built-in rules, live OSV package batch API, and CISA KEV feed
|
|
127
|
+
notaffected scan -i inventory.yaml --emit-vex vex.json --html report.html
|
|
128
|
+
|
|
129
|
+
# Try immediately with the built-in 5-host Linux + Windows Server demo fleet (100% offline)
|
|
130
|
+
notaffected scan --demo-fleet --offline --emit-vex demo.vex.json --html demo.html
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Example CLI summary on the mixed 5-host demo fleet (125 scanner-equivalent alerts cut down to 4 real exposures):
|
|
134
|
+
```text
|
|
135
|
+
Auto-Scan Feed: 25 built-in rules | 0 live OSV package CVEs | 0 live CISA KEV CVEs
|
|
136
|
+
AFFECTED (4) prod-edge-api-01 (CVE-2026-98432, CVE-2024-6387)
|
|
137
|
+
win-dc-01 (CVE-2024-38063, CVE-2021-34527)
|
|
138
|
+
NOT AFFECTED (112) 89.6% false-positive noise cut with OpenVEX v0.2.0 proof (9 under_investigation)
|
|
139
|
+
OpenVEX v0.2.0 written to: demo.vex.json (125 statement(s))
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 3. Inspect extracted preconditions & mitigations for any CVE
|
|
143
|
+
```bash
|
|
144
|
+
notaffected spec CVE-2024-6387
|
|
145
|
+
notaffected spec CVE-2024-30080 --llm
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 4. Check specific CVEs across local, SSH, Docker, or Kubernetes targets
|
|
149
|
+
```bash
|
|
150
|
+
# Live check on your local Linux machine
|
|
151
|
+
notaffected check CVE-2024-6387 CVE-2024-47176 CVE-2023-32233 --host local
|
|
152
|
+
|
|
153
|
+
# Run against the built-in 5-host mixed Linux + Windows Server demo fleet
|
|
154
|
+
notaffected check CVE-2024-6387 CVE-2024-38063 CVE-2021-34527 --demo-fleet --ai-explain --emit-vex vex.json --html report.html
|
|
155
|
+
|
|
156
|
+
# Linux and Windows OpenSSH targets or running Docker / Kubernetes workloads
|
|
157
|
+
notaffected check CVE-2024-6387 CVE-2024-38063 --ssh ubuntu@10.0.0.10 --win-ssh Administrator@10.0.1.50
|
|
158
|
+
notaffected check CVE-2024-6387 --docker lab-ssh-vuln --win-docker lab-win-dc01 --k8s prod/worker-pod-0
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 5. Filter an existing Trivy or Grype JSON scan report
|
|
162
|
+
```bash
|
|
163
|
+
notaffected filter examples/trivy-scan.json -i lab/inventory.yaml --emit-vex vex.json --html report.html
|
|
164
|
+
|
|
165
|
+
# Feed the generated OpenVEX file back into Trivy to silence proven non-issues
|
|
166
|
+
# (one host per VEX document, so package PURLs are the products Trivy matches):
|
|
167
|
+
trivy rootfs --vex vex.json /
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 6. Custom YAML CheckSpec Rules (`--rules`)
|
|
171
|
+
Author your own deterministic rules (or override built-in specs) in YAML without editing Python. Pass a file or a directory of `.yaml`/`.yml` files to `spec`, `check`, `filter`, `scan`, or `ui` (see `examples/custom-rule.yaml`):
|
|
172
|
+
```bash
|
|
173
|
+
notaffected spec CVE-2026-40123 --rules examples/custom-rule.yaml
|
|
174
|
+
notaffected check CVE-2026-40123 --demo-fleet --rules examples/custom-rule.yaml --offline
|
|
175
|
+
notaffected scan --demo-fleet --offline --rules ./my-rules-dir/
|
|
176
|
+
notaffected ui --rules examples/custom-rule.yaml
|
|
177
|
+
```
|
|
178
|
+
Every custom rule is strictly validated against the closed set of 12 read-only probes, per-OS probe allowlists, required/optional parameter names, and OpenVEX justification values.
|
|
179
|
+
|
|
180
|
+
### 7. Local Docker Simulation Lab (`lab/`)
|
|
181
|
+
Spin up 4 ultra-lightweight containers (< 2 MB RAM total, 0% idle CPU) simulating vulnerable & mitigated Linux (`CVE-2024-6387`) and Windows Server (`CVE-2024-38063`, `CVE-2021-34527`) targets:
|
|
182
|
+
```bash
|
|
183
|
+
./lab/setup_lab.sh
|
|
184
|
+
notaffected scan -i lab/inventory.yaml
|
|
185
|
+
./lab/teardown_lab.sh
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 8. Optional AI Advisor (bring your own model)
|
|
189
|
+
The AI advisor is off until you configure it: with nothing set, `--llm` and `--ai-explain` fall back to deterministic output and nothing is sent to any model. Pick any provider and model you prefer, local or hosted:
|
|
190
|
+
|
|
191
|
+
| Provider | Set | Model |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| Any OpenAI-compatible server (vLLM, LM Studio, llama.cpp, LiteLLM, ...) | `NOTAFFECTED_LLM_URL=http://host:port/v1/chat/completions` (+ `NOTAFFECTED_LLM_API_KEY` if it needs one; `OPENAI_API_KEY` is never sent to it) | `NOTAFFECTED_LLM_MODEL` |
|
|
194
|
+
| Ollama | `NOTAFFECTED_LLM_PROVIDER=ollama` (or `NOTAFFECTED_LLM_URL=http://host:11434/api/generate`) | `NOTAFFECTED_LLM_MODEL` |
|
|
195
|
+
| OpenAI | `OPENAI_API_KEY` | `NOTAFFECTED_LLM_MODEL` |
|
|
196
|
+
| Anthropic | `ANTHROPIC_API_KEY` | `NOTAFFECTED_LLM_MODEL` |
|
|
197
|
+
| Google Gemini | `GEMINI_API_KEY` or `GOOGLE_API_KEY` | `NOTAFFECTED_LLM_MODEL` |
|
|
198
|
+
| `claude` / `agy` CLI | `NOTAFFECTED_LLM_PROVIDER=claude-cli` or `agy-cli` | the CLI's default, or `NOTAFFECTED_LLM_MODEL` |
|
|
199
|
+
|
|
200
|
+
`NOTAFFECTED_LLM_PROVIDER` overrides auto-detection; an unknown value turns the advisor off instead of guessing. Without it, a key picks the provider only when keys for exactly one provider are set. There is no built-in default model, so a key alone does not start sending advisory text anywhere. The dashboard shows the provider, the model and whether the endpoint is on this machine ("local", even if it is a proxy that forwards to a hosted API) or external, or "AI: not configured" with the reason. Whatever the model, it only proposes probe parameters: verdicts stay deterministic.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# notaffected
|
|
2
|
+
|
|
3
|
+
[](https://github.com/KatsaounisThanasis/notaffected/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/notaffected/)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](https://openvex.dev/)
|
|
7
|
+
[](https://github.com/KatsaounisThanasis/notaffected/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
**From 10,000 noisy CVE alerts down to the 3 that actually matter — with deterministic proof and OpenVEX output for all the rest.**
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
Every week dozens of new CVEs are published, and AI-assisted research is finding them faster than ever. Traditional vulnerability scanners (Trivy, Grype, Qualys, Nessus) only check package versions: *"You have package X at version Y, therefore you are vulnerable."* They do not know whether the vulnerable code path or service can actually be triggered on your machine. It is like a smoke alarm that goes off every time you make toast: eventually you either panic or mute it.
|
|
14
|
+
|
|
15
|
+
`notaffected` bridges the gap between security advisories and the real runtime state of your Linux and Windows Server hosts, containers, and Kubernetes pods:
|
|
16
|
+
|
|
17
|
+
1. **Extracts attack preconditions** from official advisories (built-in golden specs for Linux & Windows, OSV.dev / Ubuntu / Debian / Alpine OSV records, Red Hat Security Data API, Microsoft MSRC CVRF v3.0, MITRE CVE v5, CISA KEV, and optional schema-validated LLM extraction with any provider and model you configure, local or hosted).
|
|
18
|
+
2. **Runs deterministic, read-only probes** on your targets (local host, Linux/Windows SSH fleet, Docker containers, or Kubernetes pods). **AI never decides the verdict and never runs shell commands**: the optional LLM may only propose parameters for the closed probe set, each one must be named in the advisory, it never sets the OS family or the VEX justification, and a `NOT_MET` from an LLM-proposed or keyword-heuristic check never yields `not_affected` on its own. `not_affected` needs a `NOT_MET` from a curated or structured-data check (or a probe-confirmed OS mismatch); every check that cannot compare, see or confirm something resolves to `under_investigation`.
|
|
19
|
+
3. **Delivers actionable output:**
|
|
20
|
+
- The short list of hosts that are **truly affected**, the exact temporary mitigation commands (`ufw`, `sysctl`, `modprobe -r`, `systemctl`, or PowerShell `Set-ItemProperty` / `Stop-Service`) to run right now, live APT patch status on Linux (`apt-cache policy`; Windows KB status comes from the built-in spec, not a live query), and an optional **AI Operational Risk & Remediation Briefing** (`--ai-explain`).
|
|
21
|
+
- For every unaffected host, **`not_affected` with deterministic proof** (e.g. kernel module blocked from loading, service listening only on `127.0.0.1`, firewall default deny, or Windows Registry mitigation active).
|
|
22
|
+
- A standard **OpenVEX v0.2.0** file (`.vex.json`). Statements about an installed package carry its Package URL (e.g. `pkg:deb/ubuntu/openssh-server@9.6p1-3ubuntu13.3?epoch=1`), which is what `trivy --vex` matches on: as the product when the document covers one host, as a subcomponent of the host when it covers a fleet. For Trivy, emit one VEX document per host. Dependency-Track does not import OpenVEX yet ([DependencyTrack/dependency-track#7094](https://github.com/DependencyTrack/dependency-track/issues/7094)). An optional standalone **HTML audit report** (`--html`) is also available.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
### Closed Set of 12 Read-Only Probes (Linux & Windows Server)
|
|
31
|
+
|
|
32
|
+
| Probe Type | OS | System Check | OpenVEX Justification (when `NOT_MET`) |
|
|
33
|
+
|---|---|---|---|
|
|
34
|
+
| `kernel_version_vulnerable` | Linux | `uname -r` + `dpkg --compare-versions`, only against fix data for the kernel's own track (line + flavour); a curated `mainline_from` line counts any kernel at or above it as fixed; other tracks are `UNKNOWN` | `vulnerable_code_not_present` |
|
|
35
|
+
| `package_installed_vulnerable` | Linux | `dpkg-query -W` (`apk info` / `rpm -q` when dpkg is absent) + comparator (`dpkg --compare-versions` / `apk version -t` / native RPM EVR `rpmvercmp`), against the fix for the host's own distro release; cross-distro or unlisted releases are `UNKNOWN` | `component_not_present` / `vulnerable_code_not_present` |
|
|
36
|
+
| `kernel_module_loaded` | Linux | `/proc/modules`; "not loaded" counts only when loading is blocked (`modprobe -c` `install <mod> /bin/false`, or `kernel.modules_disabled=1`) | `vulnerable_code_not_in_execute_path` |
|
|
37
|
+
| `sysctl_equals` | Linux | `sysctl -n <key>` | `inline_mitigations_already_exist` |
|
|
38
|
+
| `network_listener` | Linux | `ss -tulpnH` (loopback `127.0.0.0/8`, `::1`, `%lo` vs public); a process filter needs visible process names (root) | `vulnerable_code_not_in_execute_path` |
|
|
39
|
+
| `firewall_allows_port` | Linux | `ufw status verbose`, falling back to `firewall-cmd --list-all` (firewalld) and `nft list ruleset` (nftables); ambiguous rules, unknown services/profiles or a Docker bridge are `UNKNOWN` | `inline_mitigations_already_exist` |
|
|
40
|
+
| `systemd_service_active` | Linux | `systemctl is-active <unit>` + `LoadState` + its `.socket` unit | `vulnerable_code_not_in_execute_path` |
|
|
41
|
+
| `process_running` | Linux / Windows | `ps -eo comm,args` / PowerShell `Get-Process` | `vulnerable_code_not_in_execute_path` |
|
|
42
|
+
| `config_contains` | Linux | `cat <config_path>` (regex on lines that are not `#` / `;` comments; for sshd, `sshd -T` or the first occurrence of the directive) | `inline_mitigations_already_exist` / `vulnerable_code_not_in_execute_path` |
|
|
43
|
+
| `windows_build_vulnerable` | Windows | PowerShell `Get-HotFix` + `CurrentBuildNumber.UBR` | `vulnerable_code_not_present` |
|
|
44
|
+
| `windows_registry_equals` | Windows | PowerShell `Get-ItemProperty` (`HKLM:\` / `HKCU:\`) | `inline_mitigations_already_exist` |
|
|
45
|
+
| `windows_service_active` | Windows | PowerShell `(Get-Service -Name <svc>).Status` | `vulnerable_code_not_in_execute_path` |
|
|
46
|
+
|
|
47
|
+
The justification column shows the default per probe. Built-in specs set it per check; LLM-proposed checks always use the per-probe default, and their `NOT_MET` never yields `not_affected` on its own.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
Run without installing globally via `uvx` or install with `pipx` / `pip`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Instant run (uv)
|
|
57
|
+
uvx notaffected ui
|
|
58
|
+
|
|
59
|
+
# Isolated CLI install (pipx)
|
|
60
|
+
pipx install notaffected
|
|
61
|
+
|
|
62
|
+
# Standard pip install
|
|
63
|
+
pip install notaffected
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For local development from source:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/KatsaounisThanasis/notaffected.git
|
|
70
|
+
cd notaffected
|
|
71
|
+
uv venv && uv pip install -e ".[dev]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
### 1. Launch the Local Web Dashboard (`notaffected ui`)
|
|
79
|
+
```bash
|
|
80
|
+
notaffected ui --port 8484
|
|
81
|
+
# Open http://127.0.0.1:8484 in your browser
|
|
82
|
+
```
|
|
83
|
+
From the Web Dashboard you can:
|
|
84
|
+
- Auto-discover running Docker containers, load `inventory.yaml`, select a single custom Docker/SSH target, or inspect the simulated Linux + Windows Server fleet.
|
|
85
|
+
- Run **Auto-Scan** (combines built-in rules + live OSV `/v1/querybatch` queries for a fixed watch list of 7 packages, keeping up to 6 OSV CVEs, + up to 4 CISA KEV actively exploited CVEs), check specific CVE IDs, or upload a **Trivy / Grype JSON report**.
|
|
86
|
+
- Try allowlisted temporary mitigations on the lab via **Run Mitigation**, reset the lab via **Reset Lab / Demo**, and download **OpenVEX v0.2.0 (`.vex.json`)**, **Audit JSON**, or a **Standalone HTML Report**. Run Mitigation works only on the simulated fleet (where the row flip is simulated) and on Docker containers labelled `notaffected.lab=true`; it refuses local and SSH hosts and any container without that label (also when it comes from an inventory file), because the tool's design is to never change real target hosts. Apply mitigations on real hosts yourself.
|
|
87
|
+
- Every dashboard POST needs the per-process token embedded in the page, and `notaffected ui` refuses a non-loopback `--bind` unless you pass `--allow-remote` **and** set `NOTAFFECTED_REMOTE_TOKEN` (at least 16 chars, never embedded in unauthenticated HTML).
|
|
88
|
+
|
|
89
|
+
### 2. Zero-Argument Auto-Scan & Fleet Initialization
|
|
90
|
+
```bash
|
|
91
|
+
# Auto-generate an inventory file (discovering running Docker containers)
|
|
92
|
+
notaffected init --discover-docker -o inventory.yaml
|
|
93
|
+
|
|
94
|
+
# Scan your fleet against built-in rules, live OSV package batch API, and CISA KEV feed
|
|
95
|
+
notaffected scan -i inventory.yaml --emit-vex vex.json --html report.html
|
|
96
|
+
|
|
97
|
+
# Try immediately with the built-in 5-host Linux + Windows Server demo fleet (100% offline)
|
|
98
|
+
notaffected scan --demo-fleet --offline --emit-vex demo.vex.json --html demo.html
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Example CLI summary on the mixed 5-host demo fleet (125 scanner-equivalent alerts cut down to 4 real exposures):
|
|
102
|
+
```text
|
|
103
|
+
Auto-Scan Feed: 25 built-in rules | 0 live OSV package CVEs | 0 live CISA KEV CVEs
|
|
104
|
+
AFFECTED (4) prod-edge-api-01 (CVE-2026-98432, CVE-2024-6387)
|
|
105
|
+
win-dc-01 (CVE-2024-38063, CVE-2021-34527)
|
|
106
|
+
NOT AFFECTED (112) 89.6% false-positive noise cut with OpenVEX v0.2.0 proof (9 under_investigation)
|
|
107
|
+
OpenVEX v0.2.0 written to: demo.vex.json (125 statement(s))
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Inspect extracted preconditions & mitigations for any CVE
|
|
111
|
+
```bash
|
|
112
|
+
notaffected spec CVE-2024-6387
|
|
113
|
+
notaffected spec CVE-2024-30080 --llm
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 4. Check specific CVEs across local, SSH, Docker, or Kubernetes targets
|
|
117
|
+
```bash
|
|
118
|
+
# Live check on your local Linux machine
|
|
119
|
+
notaffected check CVE-2024-6387 CVE-2024-47176 CVE-2023-32233 --host local
|
|
120
|
+
|
|
121
|
+
# Run against the built-in 5-host mixed Linux + Windows Server demo fleet
|
|
122
|
+
notaffected check CVE-2024-6387 CVE-2024-38063 CVE-2021-34527 --demo-fleet --ai-explain --emit-vex vex.json --html report.html
|
|
123
|
+
|
|
124
|
+
# Linux and Windows OpenSSH targets or running Docker / Kubernetes workloads
|
|
125
|
+
notaffected check CVE-2024-6387 CVE-2024-38063 --ssh ubuntu@10.0.0.10 --win-ssh Administrator@10.0.1.50
|
|
126
|
+
notaffected check CVE-2024-6387 --docker lab-ssh-vuln --win-docker lab-win-dc01 --k8s prod/worker-pod-0
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 5. Filter an existing Trivy or Grype JSON scan report
|
|
130
|
+
```bash
|
|
131
|
+
notaffected filter examples/trivy-scan.json -i lab/inventory.yaml --emit-vex vex.json --html report.html
|
|
132
|
+
|
|
133
|
+
# Feed the generated OpenVEX file back into Trivy to silence proven non-issues
|
|
134
|
+
# (one host per VEX document, so package PURLs are the products Trivy matches):
|
|
135
|
+
trivy rootfs --vex vex.json /
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 6. Custom YAML CheckSpec Rules (`--rules`)
|
|
139
|
+
Author your own deterministic rules (or override built-in specs) in YAML without editing Python. Pass a file or a directory of `.yaml`/`.yml` files to `spec`, `check`, `filter`, `scan`, or `ui` (see `examples/custom-rule.yaml`):
|
|
140
|
+
```bash
|
|
141
|
+
notaffected spec CVE-2026-40123 --rules examples/custom-rule.yaml
|
|
142
|
+
notaffected check CVE-2026-40123 --demo-fleet --rules examples/custom-rule.yaml --offline
|
|
143
|
+
notaffected scan --demo-fleet --offline --rules ./my-rules-dir/
|
|
144
|
+
notaffected ui --rules examples/custom-rule.yaml
|
|
145
|
+
```
|
|
146
|
+
Every custom rule is strictly validated against the closed set of 12 read-only probes, per-OS probe allowlists, required/optional parameter names, and OpenVEX justification values.
|
|
147
|
+
|
|
148
|
+
### 7. Local Docker Simulation Lab (`lab/`)
|
|
149
|
+
Spin up 4 ultra-lightweight containers (< 2 MB RAM total, 0% idle CPU) simulating vulnerable & mitigated Linux (`CVE-2024-6387`) and Windows Server (`CVE-2024-38063`, `CVE-2021-34527`) targets:
|
|
150
|
+
```bash
|
|
151
|
+
./lab/setup_lab.sh
|
|
152
|
+
notaffected scan -i lab/inventory.yaml
|
|
153
|
+
./lab/teardown_lab.sh
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 8. Optional AI Advisor (bring your own model)
|
|
157
|
+
The AI advisor is off until you configure it: with nothing set, `--llm` and `--ai-explain` fall back to deterministic output and nothing is sent to any model. Pick any provider and model you prefer, local or hosted:
|
|
158
|
+
|
|
159
|
+
| Provider | Set | Model |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| Any OpenAI-compatible server (vLLM, LM Studio, llama.cpp, LiteLLM, ...) | `NOTAFFECTED_LLM_URL=http://host:port/v1/chat/completions` (+ `NOTAFFECTED_LLM_API_KEY` if it needs one; `OPENAI_API_KEY` is never sent to it) | `NOTAFFECTED_LLM_MODEL` |
|
|
162
|
+
| Ollama | `NOTAFFECTED_LLM_PROVIDER=ollama` (or `NOTAFFECTED_LLM_URL=http://host:11434/api/generate`) | `NOTAFFECTED_LLM_MODEL` |
|
|
163
|
+
| OpenAI | `OPENAI_API_KEY` | `NOTAFFECTED_LLM_MODEL` |
|
|
164
|
+
| Anthropic | `ANTHROPIC_API_KEY` | `NOTAFFECTED_LLM_MODEL` |
|
|
165
|
+
| Google Gemini | `GEMINI_API_KEY` or `GOOGLE_API_KEY` | `NOTAFFECTED_LLM_MODEL` |
|
|
166
|
+
| `claude` / `agy` CLI | `NOTAFFECTED_LLM_PROVIDER=claude-cli` or `agy-cli` | the CLI's default, or `NOTAFFECTED_LLM_MODEL` |
|
|
167
|
+
|
|
168
|
+
`NOTAFFECTED_LLM_PROVIDER` overrides auto-detection; an unknown value turns the advisor off instead of guessing. Without it, a key picks the provider only when keys for exactly one provider are set. There is no built-in default model, so a key alone does not start sending advisory text anywhere. The dashboard shows the provider, the model and whether the endpoint is on this machine ("local", even if it is a proxy that forwards to a hosted API) or external, or "AI: not configured" with the reason. Whatever the model, it only proposes probe parameters: verdicts stay deterministic.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
If you discover a security vulnerability in `notaffected` (for example: command injection in a probe or runner, SSRF bypass in advisory fetchers, authentication or CSRF bypass in the local Web UI, or a false `not_affected` verdict under normal fail-closed guarantees), please report it privately rather than opening a public GitHub issue.
|
|
6
|
+
|
|
7
|
+
- **Preferred:** Use [GitHub Private Vulnerability Reporting](https://github.com/KatsaounisThanasis/notaffected/security/advisories/new) on this repository.
|
|
8
|
+
- **Response target:** Initial acknowledgement within 72 hours.
|
|
9
|
+
|
|
10
|
+
Please include reproduction steps, affected version (`notaffected --version`), and impact assessment.
|
|
11
|
+
|
|
12
|
+
## Security Model & Trust Boundaries
|
|
13
|
+
|
|
14
|
+
`notaffected` is designed to evaluate untrusted advisory text and untrusted scanner output against real hosts without mutating targets:
|
|
15
|
+
|
|
16
|
+
1. **Read-only host probing:** All 12 built-in probes execute fixed argument vectors (`subprocess` / `ssh` / `docker exec` / `kubectl exec` with `shell=False`) and validate parameters against option injection, path traversal, and PowerShell quote breakout.
|
|
17
|
+
2. **Fail-closed verdicts:** Transport errors, missing permissions, unreadable configs, cross-distro version mismatches, ambiguous firewall rules, or Docker bridge bypasses resolve to `under_investigation`, never `not_affected`.
|
|
18
|
+
3. **AI advisor boundary:** Optional BYOM LLM integration is disabled by default. When enabled, the LLM may only propose probe parameters grounded in advisory text; it never executes commands, never sets the OS family or OpenVEX justification, and a `NOT_MET` from an LLM-proposed or keyword-heuristic check never produces `not_affected` on its own.
|
|
19
|
+
4. **Lab-only mitigations:** The Web UI **Run Mitigation** action refuses local hosts, SSH hosts, and any Docker container without the explicit `notaffected.lab=true` label.
|
|
20
|
+
5. **Local Web Dashboard (`notaffected ui`):** Binds strictly to `127.0.0.1` by default, validates `Host` and `Origin` headers, and requires a per-process `X-Notaffected-Token`. Non-loopback binding is refused unless both `--allow-remote` and `NOTAFFECTED_REMOTE_TOKEN` (>= 16 characters) are set; in remote mode the token is never embedded in HTML and is required on all `/api/*` endpoints.
|
|
21
|
+
6. **Advisory fetching:** Outbound reference fetching enforces HTTPS-only public-IP SSRF checks (blocking loopback, RFC1918, link-local, metadata endpoints, and DNS resolution failures) and writes cache files atomically.
|
|
22
|
+
|
|
23
|
+
## Supported Versions
|
|
24
|
+
|
|
25
|
+
| Version | Supported |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `1.x` | Yes |
|