supplyguard 0.3.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.
- supplyguard-0.3.0/LICENSE +21 -0
- supplyguard-0.3.0/PKG-INFO +388 -0
- supplyguard-0.3.0/README.md +344 -0
- supplyguard-0.3.0/pyproject.toml +83 -0
- supplyguard-0.3.0/setup.cfg +4 -0
- supplyguard-0.3.0/supplyguard/__init__.py +3 -0
- supplyguard-0.3.0/supplyguard/cli.py +504 -0
- supplyguard-0.3.0/supplyguard/config.py +139 -0
- supplyguard-0.3.0/supplyguard/formatters.py +301 -0
- supplyguard-0.3.0/supplyguard/models.py +113 -0
- supplyguard-0.3.0/supplyguard/remediation/__init__.py +28 -0
- supplyguard-0.3.0/supplyguard/remediation/classifier.py +104 -0
- supplyguard-0.3.0/supplyguard/remediation/deterministic_fixer.py +142 -0
- supplyguard-0.3.0/supplyguard/remediation/llm_fixer.py +202 -0
- supplyguard-0.3.0/supplyguard/remediation/loop.py +234 -0
- supplyguard-0.3.0/supplyguard/remediation/verifier.py +156 -0
- supplyguard-0.3.0/supplyguard/sast/__init__.py +5 -0
- supplyguard-0.3.0/supplyguard/sast/scanner.py +334 -0
- supplyguard-0.3.0/supplyguard/sbom/__init__.py +5 -0
- supplyguard-0.3.0/supplyguard/sbom/generator.py +153 -0
- supplyguard-0.3.0/supplyguard/scoring/__init__.py +5 -0
- supplyguard-0.3.0/supplyguard/scoring/engine.py +96 -0
- supplyguard-0.3.0/supplyguard/secrets/__init__.py +5 -0
- supplyguard-0.3.0/supplyguard/secrets/scanner.py +168 -0
- supplyguard-0.3.0/supplyguard/vulns/__init__.py +5 -0
- supplyguard-0.3.0/supplyguard/vulns/osv_client.py +251 -0
- supplyguard-0.3.0/supplyguard/web/__init__.py +5 -0
- supplyguard-0.3.0/supplyguard/web/app.py +35 -0
- supplyguard-0.3.0/supplyguard/web/routes.py +152 -0
- supplyguard-0.3.0/supplyguard.egg-info/PKG-INFO +388 -0
- supplyguard-0.3.0/supplyguard.egg-info/SOURCES.txt +45 -0
- supplyguard-0.3.0/supplyguard.egg-info/dependency_links.txt +1 -0
- supplyguard-0.3.0/supplyguard.egg-info/entry_points.txt +2 -0
- supplyguard-0.3.0/supplyguard.egg-info/requires.txt +15 -0
- supplyguard-0.3.0/supplyguard.egg-info/top_level.txt +1 -0
- supplyguard-0.3.0/tests/test_classifier.py +66 -0
- supplyguard-0.3.0/tests/test_config.py +111 -0
- supplyguard-0.3.0/tests/test_deterministic_fixer.py +76 -0
- supplyguard-0.3.0/tests/test_formatters.py +182 -0
- supplyguard-0.3.0/tests/test_llm_fixer.py +64 -0
- supplyguard-0.3.0/tests/test_osv_client.py +69 -0
- supplyguard-0.3.0/tests/test_remediation_loop.py +40 -0
- supplyguard-0.3.0/tests/test_sast.py +139 -0
- supplyguard-0.3.0/tests/test_sbom.py +70 -0
- supplyguard-0.3.0/tests/test_scoring.py +49 -0
- supplyguard-0.3.0/tests/test_secrets.py +37 -0
- supplyguard-0.3.0/tests/test_web.py +98 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SupplyGuard Maintainers
|
|
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,388 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: supplyguard
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: AI-Aware Software Supply Chain Security Scanner & Self-Healing Remediation Engine
|
|
5
|
+
Author: SupplyGuard Maintainers
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Taheraam/Supplyguard
|
|
8
|
+
Project-URL: Repository, https://github.com/Taheraam/Supplyguard
|
|
9
|
+
Project-URL: Documentation, https://github.com/Taheraam/Supplyguard#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/Taheraam/Supplyguard/issues
|
|
11
|
+
Keywords: security,supply-chain,sbom,vulnerability-scanner,sast,secrets-detection,remediation,sarif,cli
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Information Technology
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Security
|
|
23
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
24
|
+
Classifier: Topic :: Software Development :: Testing
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: click>=8.1.0
|
|
30
|
+
Requires-Dist: flask>=3.0.0
|
|
31
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
32
|
+
Requires-Dist: requests>=2.31.0
|
|
33
|
+
Requires-Dist: cyclonedx-bom>=3.11.0
|
|
34
|
+
Requires-Dist: rich>=13.0.0
|
|
35
|
+
Requires-Dist: pyyaml>=6.0
|
|
36
|
+
Requires-Dist: anthropic>=0.20.0
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
|
40
|
+
Requires-Dist: responses>=0.23.0; extra == "dev"
|
|
41
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
42
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
<div align="center">
|
|
46
|
+
|
|
47
|
+
<img src="SupplygaurdLOGO.png" alt="SupplyGuard Logo" width="280">
|
|
48
|
+
|
|
49
|
+
# SupplyGuard
|
|
50
|
+
|
|
51
|
+
**Software Supply Chain Security Scanner & Self-Healing Remediation Engine**
|
|
52
|
+
|
|
53
|
+
[](https://pypi.org/project/supplyguard/)
|
|
54
|
+
[](https://www.python.org/downloads/)
|
|
55
|
+
[](LICENSE)
|
|
56
|
+
[](https://github.com/Taheraam/Supplyguard/actions)
|
|
57
|
+
[](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html)
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
Detect supply chain vulnerabilities, leaked credentials, and AI-generated code smells in seconds.<br>
|
|
61
|
+
Compute an auditable 0–100 risk score, enforce CI/CD quality gates, and safely auto-patch fixable findings with test-backed rollbacks.
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
[Quickstart](#quickstart) •
|
|
65
|
+
[Features](#features) •
|
|
66
|
+
[Installation](#installation) •
|
|
67
|
+
[CLI Reference](#cli-reference) •
|
|
68
|
+
[CI/CD Integration](#cicd-integration) •
|
|
69
|
+
[Architecture](#architecture) •
|
|
70
|
+
[Security Principles](#security-principles)
|
|
71
|
+
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Overview
|
|
77
|
+
|
|
78
|
+
Modern software development relies heavily on third-party dependencies and AI code generation. However, automated coding workflows regularly introduce critical vulnerabilities:
|
|
79
|
+
- Unpinned or vulnerable dependencies with published CVEs
|
|
80
|
+
- Leaked API keys, database credentials, and access tokens committed to version control
|
|
81
|
+
- Antipatterns common in AI-generated code: unparameterized SQL queries, dynamic subprocess execution with `shell=True`, disabled TLS certificate verification, and unverified JWT decoding
|
|
82
|
+
|
|
83
|
+
SupplyGuard addresses this by scanning codebases across four synchronized security dimensions, unifying findings into a weighted 0–100 risk score, exporting compliant SARIF reports for GitHub Code Scanning, and providing an automated remediation loop with built-in AST verification and rollback safety.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Features
|
|
88
|
+
|
|
89
|
+
- **CycloneDX SBOM Generation**: Automated manifest parsing for dependency auditing across Python projects.
|
|
90
|
+
- **OSV.dev Vulnerability Correlation**: Real-time batch queries against the Open Source Vulnerability database for up-to-date CVE matching.
|
|
91
|
+
- **Zero-Leak Secrets Scanner**: Pattern matching for API tokens and credentials with strict zero-leakage redaction (`first 3 + ... + last 3 chars`).
|
|
92
|
+
- **AI-Code Smell SAST**: Static analysis rules targeting security weaknesses common in LLM-assisted codebases (CWE-89, CWE-78, CWE-295, CWE-489, CWE-347, CWE-916, CWE-330).
|
|
93
|
+
- **Self-Healing Remediation**: Automated patch generation backed by an in-memory backup and AST verifier that rolls back any modification that introduces syntax errors or test regressions.
|
|
94
|
+
- **Native SARIF v2.1.0 & CI Gates**: Native export to SARIF for the GitHub Security tab and configurable risk threshold exit codes (`--threshold 40`).
|
|
95
|
+
- **Zero-Config Execution**: Built-in fallback engines that operate out-of-the-box without requiring external binary installations.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Installation
|
|
100
|
+
|
|
101
|
+
### 1. Global Installation (For Users)
|
|
102
|
+
|
|
103
|
+
For the easiest experience, install SupplyGuard globally using a single command directly from GitHub. This works across all operating systems.
|
|
104
|
+
|
|
105
|
+
**Windows, Mac & Linux:**
|
|
106
|
+
```bash
|
|
107
|
+
pip install git+https://github.com/Taheraam/Supplyguard.git
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
*(Note: If you prefer isolated global CLI installations and have `pipx` installed, you can use `pipx install git+https://github.com/Taheraam/Supplyguard.git` instead).*
|
|
111
|
+
|
|
112
|
+
### 2. Docker (Containerized)
|
|
113
|
+
|
|
114
|
+
If you prefer using Docker, you can build and run the image directly:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
docker build -t supplyguard .
|
|
118
|
+
docker run --rm -v $(pwd):/src supplyguard scan /src
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. From Source (For Developers)
|
|
122
|
+
|
|
123
|
+
If you plan to modify the code, clone the repository and install it in editable mode. The activation step depends on your operating system.
|
|
124
|
+
|
|
125
|
+
**Mac & Linux:**
|
|
126
|
+
```bash
|
|
127
|
+
git clone https://github.com/Taheraam/Supplyguard.git
|
|
128
|
+
cd Supplyguard
|
|
129
|
+
python3 -m venv .venv
|
|
130
|
+
source .venv/bin/activate
|
|
131
|
+
pip install -e ".[dev]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Windows (PowerShell):**
|
|
135
|
+
```powershell
|
|
136
|
+
git clone https://github.com/Taheraam/Supplyguard.git
|
|
137
|
+
cd Supplyguard
|
|
138
|
+
python -m venv .venv
|
|
139
|
+
.\.venv\Scripts\Activate.ps1
|
|
140
|
+
pip install -e ".[dev]"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Quickstart
|
|
146
|
+
|
|
147
|
+
### 1. Initialize Configuration
|
|
148
|
+
Generate a `.supplyguard.yml` policy file for your project:
|
|
149
|
+
```bash
|
|
150
|
+
supplyguard init
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 2. Run a Read-Only Security Scan
|
|
154
|
+
```bash
|
|
155
|
+
supplyguard scan .
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 3. CI/CD Security Gate (Fail if Risk > 40)
|
|
159
|
+
```bash
|
|
160
|
+
supplyguard scan . --threshold 40 --format sarif -o results.sarif
|
|
161
|
+
```
|
|
162
|
+
*Exits with code `0` on pass, or code `1` if the risk score exceeds the threshold.*
|
|
163
|
+
|
|
164
|
+
### 4. Preview Automated Remediation (Dry Run)
|
|
165
|
+
```bash
|
|
166
|
+
supplyguard fix . --dry-run
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 5. Apply Remediation Patches
|
|
170
|
+
```bash
|
|
171
|
+
supplyguard fix . --max-iterations 3
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 6. Launch the Local Web Dashboard
|
|
175
|
+
```bash
|
|
176
|
+
supplyguard web --port 5000
|
|
177
|
+
```
|
|
178
|
+
*Navigate to `http://127.0.0.1:5000` to review scan history and patch diffs.*
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## CLI Reference
|
|
183
|
+
|
|
184
|
+
### `supplyguard scan [PATH]`
|
|
185
|
+
|
|
186
|
+
Scan a target codebase for dependencies, vulnerabilities, secrets, and static code smells.
|
|
187
|
+
|
|
188
|
+
| Option | Short | Default | Description |
|
|
189
|
+
|---|---|---|---|
|
|
190
|
+
| `--format` | `-f` | `table` | Output format: `table`, `json`, or `sarif`. |
|
|
191
|
+
| `--threshold` | `-t` | `100` | Risk score threshold (0–100). Exits with code `1` if exceeded. |
|
|
192
|
+
| `--output` | `-o` | `stdout` | Write output to a specific file path. |
|
|
193
|
+
| `--db-path` | | `supplyguard.db` | Target SQLite database path for history tracking. |
|
|
194
|
+
| `--verbose` | `-v` | `false` | Enable verbose debug output. |
|
|
195
|
+
|
|
196
|
+
#### Exit Codes:
|
|
197
|
+
- `0`: Scan passed (Risk Score <= Threshold)
|
|
198
|
+
- `1`: Policy violation (Risk Score > Threshold)
|
|
199
|
+
- `2`: Tool execution error
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### `supplyguard fix [PATH]`
|
|
204
|
+
|
|
205
|
+
Execute the self-healing remediation loop.
|
|
206
|
+
|
|
207
|
+
| Option | Default | Description |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| `--dry-run` | `false` | Simulate patches without modifying files on disk. |
|
|
210
|
+
| `--max-iterations` | `5` | Maximum number of fix-and-rescan convergence iterations. |
|
|
211
|
+
| `--no-llm` | `false` | Disable LLM-assisted patches and use only deterministic rules. |
|
|
212
|
+
| `--db-path` | `supplyguard.db` | SQLite database path. |
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### `supplyguard report <SCAN_ID>`
|
|
217
|
+
|
|
218
|
+
Retrieve and format results from a previous scan stored in SQLite:
|
|
219
|
+
```bash
|
|
220
|
+
supplyguard report 1 --format json
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Configuration (`.supplyguard.yml`)
|
|
226
|
+
|
|
227
|
+
Project-level settings can be configured via a `.supplyguard.yml` file placed at the root of the target repository:
|
|
228
|
+
|
|
229
|
+
```yaml
|
|
230
|
+
# .supplyguard.yml
|
|
231
|
+
|
|
232
|
+
# Risk score threshold for CI builds (0-100)
|
|
233
|
+
threshold: 40
|
|
234
|
+
|
|
235
|
+
# Default output format: table | json | sarif
|
|
236
|
+
format: table
|
|
237
|
+
|
|
238
|
+
# Minimum severity level to include in scan results (CRITICAL, HIGH, MEDIUM, LOW)
|
|
239
|
+
severity_minimum: MEDIUM
|
|
240
|
+
|
|
241
|
+
# Paths to exclude from scanning
|
|
242
|
+
ignore_paths:
|
|
243
|
+
- ".venv/"
|
|
244
|
+
- "tests/"
|
|
245
|
+
- "docs/"
|
|
246
|
+
- "node_modules/"
|
|
247
|
+
|
|
248
|
+
# Rule IDs or CWE identifiers to suppress
|
|
249
|
+
ignore_rules:
|
|
250
|
+
- "CWE-489" # Allow debug=True in local development
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## CI/CD Integration
|
|
256
|
+
|
|
257
|
+
### GitHub Actions
|
|
258
|
+
|
|
259
|
+
Upload scan findings directly to the **GitHub Security -> Code Scanning** tab:
|
|
260
|
+
|
|
261
|
+
```yaml
|
|
262
|
+
name: SupplyGuard Security Gate
|
|
263
|
+
|
|
264
|
+
on:
|
|
265
|
+
push:
|
|
266
|
+
branches: [ "main" ]
|
|
267
|
+
pull_request:
|
|
268
|
+
branches: [ "main" ]
|
|
269
|
+
|
|
270
|
+
jobs:
|
|
271
|
+
security-scan:
|
|
272
|
+
runs-on: ubuntu-latest
|
|
273
|
+
permissions:
|
|
274
|
+
security-events: write
|
|
275
|
+
steps:
|
|
276
|
+
- name: Checkout Code
|
|
277
|
+
uses: actions/checkout@v4
|
|
278
|
+
|
|
279
|
+
- name: Set up Python
|
|
280
|
+
uses: actions/setup-python@v5
|
|
281
|
+
with:
|
|
282
|
+
python-version: "3.11"
|
|
283
|
+
|
|
284
|
+
- name: Install SupplyGuard
|
|
285
|
+
run: pip install supplyguard
|
|
286
|
+
|
|
287
|
+
- name: Run Security Scan
|
|
288
|
+
run: |
|
|
289
|
+
supplyguard scan . \
|
|
290
|
+
--format sarif \
|
|
291
|
+
--threshold 40 \
|
|
292
|
+
-o results.sarif
|
|
293
|
+
|
|
294
|
+
- name: Upload SARIF to GitHub Security
|
|
295
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
296
|
+
if: always()
|
|
297
|
+
with:
|
|
298
|
+
sarif_file: results.sarif
|
|
299
|
+
category: supplyguard
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Architecture
|
|
305
|
+
|
|
306
|
+
```mermaid
|
|
307
|
+
graph TD
|
|
308
|
+
A[Target Codebase] --> B[SupplyGuard Core Engine]
|
|
309
|
+
|
|
310
|
+
subgraph "Signal Source Layer"
|
|
311
|
+
B --> C[CycloneDX SBOM Generator]
|
|
312
|
+
B --> D[OSV.dev REST API Client]
|
|
313
|
+
B --> E[Zero-Leak Secrets Scanner]
|
|
314
|
+
B --> F[SAST & AI Smells AST Engine]
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
C --> G[Weighted 0-100 Risk Engine]
|
|
318
|
+
D --> G
|
|
319
|
+
E --> G
|
|
320
|
+
F --> G
|
|
321
|
+
|
|
322
|
+
G --> H[(SQLite Database)]
|
|
323
|
+
G --> I[SARIF v2.1.0 & JSON Exporters]
|
|
324
|
+
H --> J[Flask Dashboard]
|
|
325
|
+
|
|
326
|
+
subgraph "Self-Healing Remediation Engine"
|
|
327
|
+
G --> K[Fixability Classifier]
|
|
328
|
+
K -->|Deterministic| L[Version Bump / Code Rewrite]
|
|
329
|
+
K -->|Hybrid| M[Secret Extraction to .env.example]
|
|
330
|
+
K -->|LLM-Assisted| N[Parameterized Query Patch]
|
|
331
|
+
K -->|Manual-Required| O[Human Review Report]
|
|
332
|
+
|
|
333
|
+
L --> P[Safety Verifier<br/>AST Validation + Test Suite]
|
|
334
|
+
N --> P
|
|
335
|
+
P -->|Rollback on Fail| K
|
|
336
|
+
P -->|Pass| Q[Diff Audit Trail]
|
|
337
|
+
end
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Fixability Classification
|
|
343
|
+
|
|
344
|
+
SupplyGuard maintains a strict separation between deterministic fixes and changes requiring architectural review:
|
|
345
|
+
|
|
346
|
+
| Finding Category | CWE | Strategy | Action |
|
|
347
|
+
|---|---|---|---|
|
|
348
|
+
| Known Vulnerable Dependency (Fix Available) | — | **Deterministic** | Bumps pinned version in `requirements.txt`. |
|
|
349
|
+
| Vulnerable Dependency (No Fix Available) | — | **Manual-Required** | Flags finding; no safe target version exists. |
|
|
350
|
+
| Hardcoded Secret | CWE-798 | **Hybrid** | Extracts stub to `.env.example`, redacts in place, flags key for rotation. |
|
|
351
|
+
| TLS Validation Disabled (`verify=False`) | CWE-295 | **Deterministic** | Restores TLS certificate validation. |
|
|
352
|
+
| Production Debug Mode (`debug=True`) | CWE-489 | **Deterministic** | Sets `debug=False`. |
|
|
353
|
+
| Unverified JWT Decode | CWE-347 | **Deterministic** | Enforces signature verification checks. |
|
|
354
|
+
| Insecure Randomness for Secrets | CWE-330 | **Deterministic** | Migrates `random` usage to `secrets` module. |
|
|
355
|
+
| SQL Injection (String Formatting) | CWE-89 | **LLM-Assisted** | Constructs parameterized query patch gated on test suite. |
|
|
356
|
+
| Subprocess Shell Injection | CWE-78 | **LLM-Assisted** | Converts shell command strings to argument lists. |
|
|
357
|
+
| Unprotected Sensitive Route | CWE-862 | **Manual-Required** | Escalated to developer; cannot infer authentication model. |
|
|
358
|
+
| Dynamic Code Execution (`eval`/`exec`/`pickle`) | CWE-94 / 502 | **Manual-Required** | Escalated to developer; requires architectural refactoring. |
|
|
359
|
+
| CORS Wildcard with Credentials | CWE-942 | **Manual-Required** | Escalated to developer; requires explicit origin allowlist. |
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Security Principles
|
|
364
|
+
|
|
365
|
+
1. **Local-Only Remediation**: `supplyguard fix` never pushes or merges changes to remote branches. All modifications remain local for developer review.
|
|
366
|
+
2. **Zero Raw Secret Storage**: The secrets scanner redacts findings (`first 3 + ... + last 3 chars`) before logging, database persistence, or display.
|
|
367
|
+
3. **Rollback-on-Failure**: Automated patches must pass syntax parsing and existing test suites before being kept. If verification fails, changes are reverted automatically.
|
|
368
|
+
4. **No Intent Guessing**: Security-critical controls such as authentication boundaries and authorization decorators are never guessed and are flagged for manual review.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Contributing
|
|
373
|
+
|
|
374
|
+
Contributions are welcome. Please ensure that all changes include appropriate test coverage and pass static checks:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
# Run unit and integration tests
|
|
378
|
+
pytest tests/ -v
|
|
379
|
+
|
|
380
|
+
# Run linting
|
|
381
|
+
ruff check .
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## License
|
|
387
|
+
|
|
388
|
+
This project is licensed under the [MIT License](LICENSE).
|