deployproof 1.1.0__tar.gz → 1.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. {deployproof-1.1.0 → deployproof-1.1.2}/LICENSE +1 -1
  2. deployproof-1.1.2/PKG-INFO +529 -0
  3. deployproof-1.1.2/README.md +496 -0
  4. {deployproof-1.1.0 → deployproof-1.1.2}/pyproject.toml +23 -14
  5. deployproof-1.1.2/src/deployproof/__init__.py +2 -0
  6. deployproof-1.1.2/src/deployproof/ci.py +271 -0
  7. deployproof-1.1.2/src/deployproof/cli.py +322 -0
  8. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/coverage_plugin.py +6 -1
  9. deployproof-1.1.2/src/deployproof/cve.py +161 -0
  10. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/dependencies.py +243 -24
  11. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/diff.py +88 -36
  12. deployproof-1.1.2/src/deployproof/history_secrets.py +130 -0
  13. deployproof-1.1.2/src/deployproof/interactive.py +116 -0
  14. deployproof-1.1.2/src/deployproof/mutator.py +3231 -0
  15. deployproof-1.1.2/src/deployproof/reporter.py +734 -0
  16. deployproof-1.1.2/src/deployproof/sast.py +438 -0
  17. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/secrets.py +52 -48
  18. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/symlinks.py +9 -4
  19. deployproof-1.1.2/src/deployproof/synthesizer.py +408 -0
  20. deployproof-1.1.2/src/deployproof.egg-info/PKG-INFO +529 -0
  21. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof.egg-info/SOURCES.txt +25 -0
  22. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof.egg-info/requires.txt +2 -1
  23. deployproof-1.1.2/tests/test_advanced_mutation_operators.py +326 -0
  24. deployproof-1.1.2/tests/test_ci_github.py +182 -0
  25. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_cli.py +1 -1
  26. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_cli_dependency_scan.py +8 -0
  27. deployproof-1.1.2/tests/test_cli_symlink_integration.py +31 -0
  28. deployproof-1.1.2/tests/test_comprehensive_feature_matrix.py +140 -0
  29. deployproof-1.1.2/tests/test_config_file.py +65 -0
  30. deployproof-1.1.2/tests/test_cve.py +57 -0
  31. deployproof-1.1.2/tests/test_dynamic_test_selection.py +106 -0
  32. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_edge_cases_validation.py +3 -2
  33. deployproof-1.1.2/tests/test_env_and_poetry_dependencies.py +140 -0
  34. deployproof-1.1.2/tests/test_equivalent_mutants.py +155 -0
  35. deployproof-1.1.2/tests/test_full_parity_matrix.py +184 -0
  36. deployproof-1.1.2/tests/test_history_secrets.py +62 -0
  37. deployproof-1.1.2/tests/test_interactive.py +131 -0
  38. deployproof-1.1.2/tests/test_mutation_schemata.py +138 -0
  39. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_mutator.py +5 -5
  40. deployproof-1.1.2/tests/test_pyproject_config.py +121 -0
  41. deployproof-1.1.2/tests/test_sast.py +209 -0
  42. deployproof-1.1.2/tests/test_symlink_escapes_edge_cases.py +52 -0
  43. deployproof-1.1.2/tests/test_symlink_security_suite.py +54 -0
  44. deployproof-1.1.2/tests/test_synthesizer.py +246 -0
  45. deployproof-1.1.2/tests/test_tier1_upgrade_integration.py +88 -0
  46. deployproof-1.1.0/PKG-INFO +0 -406
  47. deployproof-1.1.0/README.md +0 -375
  48. deployproof-1.1.0/src/deployproof/__init__.py +0 -2
  49. deployproof-1.1.0/src/deployproof/cli.py +0 -191
  50. deployproof-1.1.0/src/deployproof/mutator.py +0 -1854
  51. deployproof-1.1.0/src/deployproof/reporter.py +0 -339
  52. deployproof-1.1.0/src/deployproof.egg-info/PKG-INFO +0 -406
  53. {deployproof-1.1.0 → deployproof-1.1.2}/setup.cfg +0 -0
  54. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/control_flow.py +0 -0
  55. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/mocks.py +0 -0
  56. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof/wsl.py +0 -0
  57. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof.egg-info/dependency_links.txt +0 -0
  58. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof.egg-info/entry_points.txt +0 -0
  59. {deployproof-1.1.0 → deployproof-1.1.2}/src/deployproof.egg-info/top_level.txt +0 -0
  60. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_baseline_collection_error.py +0 -0
  61. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_control_flow.py +0 -0
  62. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_dependencies_extractor.py +0 -0
  63. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_dependencies_pypi.py +0 -0
  64. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_diff.py +0 -0
  65. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_import_graph_discovery.py +0 -0
  66. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_mocks.py +0 -0
  67. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_mutation_suites.py +0 -0
  68. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_secrets.py +0 -0
  69. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_stress_regressions.py +0 -0
  70. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_symlinks.py +0 -0
  71. {deployproof-1.1.0 → deployproof-1.1.2}/tests/test_wsl.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 SVSPraveen
3
+ Copyright (c) 2026 SVS Praveen
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,529 @@
1
+ Metadata-Version: 2.4
2
+ Name: deployproof
3
+ Version: 1.1.2
4
+ Summary: Deterministic pre-push quality & security gate for modern Python codebases: In-memory AST mutation testing, credential scanning, and self-healing test synthesis.
5
+ Author-email: SVS Praveen <svspraveens@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/SVSPraveen/deployproof
8
+ Project-URL: Documentation, https://svspraveen.github.io/deployproof/
9
+ Project-URL: Portfolio, https://svspraveen.vercel.app/
10
+ Project-URL: Repository, https://github.com/SVSPraveen/deployproof.git
11
+ Project-URL: Bug Tracker, https://github.com/SVSPraveen/deployproof/issues
12
+ Keywords: mutation-testing,pre-push-gate,self-healing-tests,ast-mutation-testing,code-quality,developer-tools,pytest-plugin,sast-scanner,credential-scanner,supply-chain-security,slopsquatting,ai-code-defense,python-testing,devops-quality-gate
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Classifier: Topic :: Software Development :: Testing
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pytest>=7.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.0.0; extra == "dev"
29
+ Requires-Dist: twine>=4.0.0; extra == "dev"
30
+ Requires-Dist: coverage>=7.0.0; extra == "dev"
31
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # DeployProof
35
+
36
+ > Deterministic pre-push quality & security gate for modern Python codebases: In-memory AST mutation testing, credential scanning, and self-healing test synthesis. Built for human engineering teams and AI-assisted workflows alike.
37
+
38
+ [![PyPI version](https://img.shields.io/badge/pypi-v1.1.2-007ec6.svg)](https://pypi.org/project/deployproof/)
39
+ [![Python versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-3776ab.svg)](https://pypi.org/project/deployproof/)
40
+ [![CI](https://github.com/SVSPraveen/DeployProof/actions/workflows/ci.yml/badge.svg)](https://github.com/SVSPraveen/DeployProof/actions/workflows/ci.yml)
41
+ [![Tests](https://img.shields.io/badge/tests-261%20passed-2ea44f.svg)](https://github.com/SVSPraveen/DeployProof)
42
+ [![Stress Tests](https://img.shields.io/badge/stress%20tests-14%2F14%20passed-2ea44f.svg)](stress_fixtures/)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
44
+ [![Docs](https://img.shields.io/badge/docs-DeployProof%20Portal-6366f1.svg)](https://svspraveen.github.io/DeployProof/)
45
+
46
+ ---
47
+
48
+ > 📖 **[View the Complete Documentation & Interactive Product Portal](https://svspraveen.github.io/DeployProof/)**
49
+
50
+ ## Why This Exists
51
+
52
+ Modern software development — whether crafted by human engineering teams or generated through AI coding assistants — introduces subtle failure modes that standard linters and line-coverage metrics completely miss:
53
+
54
+ * **Deceptive Test Suites**: Test suites boasting 90%+ line coverage that never assert true correctness, masking near-zero mutation scores.
55
+ * **Accidental Credential Exposure**: Hardcoded API keys, bearer tokens, or service credentials generated in passing or pasted into tests.
56
+ * **Sandbox Escape Risks**: Symlinks that deceive tool approval prompts into breaking outside the repository sandbox.
57
+ * **Silently Swallowed Exceptions**: Blanket `except Exception: pass` anti-patterns that hide critical runtime bugs.
58
+ * **Dependency Hallucinations & Slopsquatting**: Package names invented by LLMs or mistyped dependencies that don't exist on public PyPI.
59
+
60
+ DeployProof serves as an uncompromising, deterministic pre-push gate that validates code quality, test integrity, and security locally before any commit reaches CI or production.
61
+
62
+ > **Privacy & Security Guarantee**: DeployProof runs 100% locally on your machine. It makes zero outbound network calls, except for querying the official PyPI registry (JSON API) to verify that newly introduced dependencies exist and are not hallucinated. DeployProof sends no source code, telemetry, test results, or secret findings to any external server.
63
+
64
+ ## Install
65
+
66
+ ```bash
67
+ # Recommended — installs into an isolated environment, exposes the CLI globally
68
+ pipx install deployproof
69
+
70
+ # Or via pip into your current environment
71
+ pip install deployproof
72
+ ```
73
+
74
+ Requires Python 3.10+. If you don't have `pipx`, install it with `pip install pipx` then run `pipx ensurepath`.
75
+
76
+ ## How to Use DeployProof
77
+
78
+ DeployProof provides two distinct modes of operation. We believe in total transparency about execution costs:
79
+
80
+ ### 1. Diff-Scoped Pre-Push Gate (`deployproof check`) — *Primary Fast Workflow*
81
+ Evaluates **only the files modified in your active session or git diff** (1–3 files typically). Because only newly edited AST nodes are mutated, it executes in **2 to 5 seconds** in local developer loops, pre-commit hooks, and pre-push gates.
82
+
83
+ ```bash
84
+ # Fast daily check: verifies modified files in your current working tree / git diff (2-5s)
85
+ deployproof check
86
+
87
+ # Output structured JSON for automation or IDE tooling
88
+ deployproof check --json
89
+
90
+ # Enforce strict gates on newly introduced mocks or swallowed errors
91
+ deployproof check --strict-mocks --strict-error-handling
92
+ ```
93
+
94
+ ### 2. Full Repository Audit Mode (`deployproof check --full-repo`) — *Thorough Codebase Audits*
95
+ Evaluates **every tracked Python file across the entire repository**. Because mutation testing generates hundreds or thousands of mutants and runs the test suite against each one in isolated multi-worker sandboxes, full repository scans take real, honest compute time:
96
+
97
+ ```bash
98
+ # Run a full-repository audit across all tracked files
99
+ deployproof check --full-repo
100
+
101
+ # Customize the parallel worker process count (defaults to auto-detected CPU count capped at 8)
102
+ deployproof check --full-repo --workers 8
103
+ ```
104
+
105
+ #### Real-World Timing Expectations:
106
+
107
+ > [!NOTE]
108
+ > **Estimated Timings Disclaimer**: The durations below are empirical estimates based on benchmark runs across various open-source projects (such as `requests`, `click`, and `colorama`). Actual execution time may be **higher or lower** depending on your specific test suite execution speed (e.g., pure unit tests vs. heavy integration/database tests), test runner timeout settings (`--timeout`), hardware profile (CPU core clock speed, available RAM), and codebase complexity.
109
+
110
+ | Scan Mode | Target Scope | Estimated Duration* | Intended Use Case |
111
+ | :--- | :--- | :--- | :--- |
112
+ | **`deployproof check`** | Git Diff (1–3 modified files) | **2 – 5 seconds** | Local pre-commit, active AI IDE coding loops, pre-push sanity checks. |
113
+ | **`deployproof check --workers 8`** | Large Multi-File Diff (100+ mutants) | **1 – 3 minutes** | Large feature branch reviews, refactors. |
114
+ | **`deployproof check --full-repo`** | Small Repo (< 100 mutants, sequential) | **30s – 2 minutes** | Single-core / lightweight auditing. |
115
+ | **`deployproof check --full-repo --workers 8`** | Small Repo (< 100 mutants, 8 workers) | **15 – 30 seconds** | Rapid full baseline verification. |
116
+ | **`deployproof check --full-repo`** | Medium Repo (200–500 mutants, sequential) | **15 – 35 minutes** | Unconstrained single-thread verification. |
117
+ | **`deployproof check --full-repo --workers 8`** | Medium Repo (200–500 mutants, 8 workers) | **3 – 7 minutes** | Release validation, pre-tag quality gates. |
118
+ | **`deployproof check --full-repo`** | Heavy / Network Lib (`requests`, 800 mutants) | **60 – 85 minutes** | Deep overnight / weekly sweep. |
119
+ | **`deployproof check --full-repo --workers 8`** | Heavy / Network Lib (`requests`, 800 mutants) | **12 – 18 minutes** | High-throughput multi-core CI release builds. |
120
+
121
+ ### Parallel Multi-Worker Sandboxing (`--workers N`)
122
+
123
+ DeployProof includes a built-in multi-process execution engine (`ProcessPoolExecutor`) for parallel mutation testing. You can supply `--workers <N>` to both diff-scoped checks and full-repo audits:
124
+
125
+ ```bash
126
+ # Parallelize a large uncommitted diff across 8 worker processes
127
+ deployproof check --workers 8
128
+
129
+ # Full repository audit distributed across 8 worker processes
130
+ deployproof check --full-repo --workers 8
131
+ ```
132
+
133
+ #### How Parallel Sandboxing Works:
134
+ 1. **Snapshot Creation**: DeployProof takes an initial atomic snapshot of your project into a clean temporary directory.
135
+ 2. **PID-Keyed Sandboxes**: Each worker process receives its own dedicated filesystem sandbox (`worker_<PID>`), with an independent `pytest` cache (`--override-ini=cache_dir=...`) and separate temporary directory (`--basetemp=...`).
136
+ 3. **Zero Mutation Leaks**: Mutants are generated and executed inside individual worker sandboxes in parallel. The working tree is untouched, and signal handlers (`SIGINT`, `SIGTERM`, `SIGBREAK`) ensure sandboxes are cleanly purged upon completion or interruption.
137
+
138
+ #### Advantages & When to Use:
139
+ * **Large Diff / Full Repo Speedup**: Near-linear execution scaling across CPU cores for batches with 50+ mutants, cutting 30-minute sweeps down to 5–8 minutes.
140
+ * **Process & Cache Isolation**: Eliminates cross-test state leakage, shared database locking, and `.pytest_cache` collisions between concurrent workers.
141
+
142
+ #### Trade-offs & When NOT to Use:
143
+ * **Small Daily Diffs (1–3 files)**: Do NOT use `--workers` for small 2-line edits. Spawning isolated sandboxes and copying file trees incurs ~1–2 seconds of snapshot overhead. Sequential in-place mutation executes in **2–5 seconds** with zero snapshot overhead.
144
+ * **Disk Space & I/O Overhead**: Running $N$ workers copies the repository snapshot $N$ times into temporary storage ($N \times \text{repo size}$ in `tempfile.gettempdir()`). On disk-constrained environments, use fewer workers (e.g. `--workers 2` or `--workers 4`).
145
+ * **Subprocess / Port Collisions**: If your test suite binds to fixed network ports (e.g. localhost:8080) without dynamic port selection, parallel workers running tests concurrently may trigger port conflicts. Use isolated ports or run sequentially in such environments.
146
+
147
+ #### Hardware & Memory Sizing Architecture (RAM & CPU Optimization):
148
+
149
+ DeployProof's parallel sandboxing engine scales throughput directly with **available physical RAM** and **logical CPU cores**. Because test execution is CPU-bound and sandbox file I/O is memory-bound, hardware capacity dictates performance:
150
+
151
+ ```
152
+ Total Memory Required ≈ Base OS Overhead (~2 GB) + [ N_workers × (Worker Process RSS + OS Page Cache Footprint) ]
153
+ ```
154
+
155
+ ##### 1. Why More RAM Directly Maximizes Verification Speed:
156
+ * **Zero-Latency In-Memory OS Page Cache**: When physical RAM comfortably exceeds the aggregate working set of all $N$ workers, the operating system holds all sandbox file trees, compiled `.pyc` modules, and pytest test fixtures directly in the **RAM page cache**. File mutations and test imports achieve sub-millisecond execution with zero physical NVMe/SSD read/write contention.
157
+ * **Elimination of Page-Fault Swapping**: If total RAM is insufficient for the requested `--workers N`, the OS kernel is forced to page memory to disk (`pagefile.sys` on Windows or swap partitions on Linux). Page thrashing introduces severe disk queue latency that can degrade multi-process test throughput by 5× to 10×. Higher RAM guarantees that all workers remain 100% compute-active in physical memory.
158
+
159
+ ##### 2. Per-Worker Memory Consumption Profile:
160
+ * **Python Runtime & AST Engine**: ~35 MB RSS per worker.
161
+ * **Pytest Test Suite & Dependencies**: ~50 MB to 150 MB RSS per worker (depending on framework imports like FastAPI, Django, SQLAlchemy, or Requests).
162
+ * **Sandbox Working Directory Snapshot**: ~15 MB to 50 MB in OS file cache per worker.
163
+ * **Total Allocation per Worker Process**: **~100 MB to 250 MB RAM per worker**.
164
+
165
+ ##### 3. Hardware Sizing & Safe Allocation Matrix:
166
+
167
+ | Installed System RAM | Recommended Worker Flag | Memory Consumed by DeployProof | System Headroom Remaining | Intended Verification Profile |
168
+ | :--- | :--- | :--- | :--- | :--- |
169
+ | **2 GB – 4 GB** | `deployproof check` *(Sequential)* | ~120 MB total | High (~2.5 GB free) | Ultra-lightweight diff checks; single-core laptops. |
170
+ | **8 GB** | `--workers 4` | ~0.8 GB – 1.0 GB | Safe (~5.5 GB free) | Standard local feature branches and medium diffs. |
171
+ | **16 GB** | **`--workers 8` to `--workers 16`** | **~1.6 GB – 3.2 GB** | **Abundant (~12.8 GB free)** | **Full CPU core saturation; rapid multi-file diffs & full-repo sweeps.** |
172
+ | **32 GB+** | `--workers 16` to `--workers 32` | ~3.5 GB – 6.5 GB | Enterprise headroom | Heavy monorepos, multi-thousand mutant CI sweeps. |
173
+
174
+ ##### 4. Diff Scoped vs Full Repo Memory Comparison:
175
+
176
+ | Metric | Git Diff (`deployproof check --workers 8`) | Full Repo (`deployproof check --full-repo --workers 8`) | Technical Rationale |
177
+ | :--- | :--- | :--- | :--- |
178
+ | **Concurrent OS Processes** | 8 worker processes | 8 worker processes | **Identical** — `ProcessPoolExecutor` only executes $N$ workers concurrently. |
179
+ | **Worker Process RSS** | ~80 MB – 120 MB per process | ~120 MB – 180 MB per process | **Slightly higher** — Full repo sweeps import broader test suites and transitive frameworks into Python's `sys.modules`. |
180
+ | **Sandbox Snapshot Cache** | ~15 MB per sandbox | ~30 MB – 60 MB per sandbox | **Higher** — Full repo snapshots clone all tracked repo files into temporary directories. |
181
+ | **Total Memory with 8 Workers** | **~1.0 GB – 1.4 GB** | **~1.6 GB – 2.2 GB** | Modest increase; easily accommodated by standard 8 GB/16 GB machines. |
182
+ | **Total Memory with 16 Workers** | **~1.8 GB – 2.5 GB** | **~3.0 GB – 3.8 GB** | Complete 16-core saturation while leaving 12+ GB RAM free on 16 GB systems. |
183
+
184
+ ##### 5. Minimum vs Recommended System Requirements:
185
+ * **Absolute Minimum System RAM**: **2 GB** (for default sequential diff-scoped `deployproof check`).
186
+ * **Minimum System RAM for Multi-Worker Mode (`--workers 4`)**: **4 GB**.
187
+ * **Recommended System RAM for Max-Throughput Parallel Mode (`--workers 8` or `16`)**: **16 GB** (provides sufficient headroom to keep 8 to 16 Python subprocesses and their entire sandboxes resident in physical memory).
188
+
189
+ Output includes a section for each check — symlink scan, secrets scan, dependency scan, mock detection, control flow analysis, and mutation score — with a pass/fail line at the bottom.
190
+
191
+ ### Exit Codes:
192
+ * `0` — **PASSED**: All verification checks passed and mutation score meets threshold.
193
+ * `1` — **FAILED**: Code quality or security gate triggered (mutation score below threshold, untested files, hardcoded secrets, sandbox-escape symlinks, hallucinated packages, or strict flags).
194
+ * `2` — **ERROR**: Test environment failure (test suite failed to collect or execute before mutation testing began due to missing dependencies or broken imports).
195
+
196
+ ### Example Walkthrough
197
+
198
+ Given a newly written function `calculator.py`:
199
+
200
+ ```python
201
+ def calculate_discount(price: float, rate: float) -> float:
202
+ if rate > 0.5:
203
+ return price * 0.5
204
+ return price * (1.0 - rate)
205
+ ```
206
+
207
+ With an AI-generated test that achieves 100% line coverage by only asserting standard discounts (`rate = 0.2`):
208
+
209
+ ```python
210
+ def test_calculate_discount_basic():
211
+ assert calculate_discount(100.0, 0.2) == 80.0
212
+ ```
213
+
214
+ Running `deployproof check` mutates AST operators and detects that boundary conditions and threshold caps are untested:
215
+
216
+ ```
217
+ $ deployproof check
218
+
219
+ DeployProof - LOCAL PRE-CHECK (approximate) - not the verified score
220
+ ====================================================================
221
+
222
+ Target Scope (1 file evaluated):
223
+ * calculator.py
224
+
225
+ Symlink & Sandbox Escape Scan (CWE-61/CWE-451):
226
+ Clean: No symlinks or sandbox-escape traversal links detected across 1 session file.
227
+
228
+ Secrets & Credentials Pre-Push Scan:
229
+ Clean: No hardcoded secrets or tracked .env files detected across 1 session file.
230
+
231
+ Dependency & Slopsquatting Scan (PyPI Registry & Age Analysis):
232
+ Clean: No new external packages introduced across 1 session file.
233
+
234
+ Mock Usage Introduced (flagged for review):
235
+ Clean: No modified test files in scope.
236
+
237
+ Control Flow & Error Handling (flagged for review):
238
+ Clean: No bare excepts, swallowed exceptions, or unreachable code detected across 1 session file.
239
+
240
+ Local Pre-Check Mutation Verification:
241
+ Score: 57.1% (4/7 mutants killed)
242
+ Status: FAILED (score 57.1% below 80.0%) (threshold: 80.0%)
243
+ Time: 2.27s
244
+
245
+ Skipped Constructs: None (No known unsupported constructs detected)
246
+
247
+ Surviving Mutants (3 unverified changes):
248
+
249
+ [1] calculator.py:2
250
+ Mutation: Replace numeric constant '0.5' with '1.5'
251
+ Original: if rate > 0.5:
252
+ Mutated: if rate > 1.5:
253
+
254
+ [2] calculator.py:3
255
+ Mutation: Replace numeric constant '0.5' with '1.5'
256
+ Original: return price * 0.5
257
+ Mutated: return price * 1.5
258
+
259
+ [3] calculator.py:3
260
+ Mutation: Replace binary operator '*' with '/'
261
+ Original: return price * 0.5
262
+ Mutated: return price / 0.5
263
+
264
+ ====================================================================
265
+ Notice: Local pre-check only. Full verified score runs in CI on push (via mutmut).
266
+ Pre-check FAILED: Score 57.1% is below threshold 80.0% (3 surviving mutants).
267
+ ```
268
+
269
+ Adding tests for threshold cap (`rate = 0.8`) and exact boundary (`rate = 0.5`) kills all mutants:
270
+
271
+ ```
272
+ Local Pre-Check Mutation Verification:
273
+ Score: 100.0% (7/7 mutants killed)
274
+ Status: PASSED (threshold: 80.0%)
275
+ Time: 2.31s
276
+
277
+ Surviving Mutants: None (All generated mutants caught by test suite)
278
+
279
+ Pre-check clean: 100% of tested basic mutations caught.
280
+ ```
281
+
282
+ ### Advanced Mutation Operators: DeployProof vs Mutmut vs Cosmic Ray
283
+
284
+ DeployProof features an enterprise-grade AST mutation engine specifically engineered for modern Python applications, AI-assisted development, and instantaneous pre-commit gates:
285
+
286
+ | Mutation Category | Operator Transformation | Why It Catches Hard Bugs | DeployProof | mutmut | Cosmic Ray |
287
+ |---|---|---|:---:|:---:|:---:|
288
+ | **Statement Deletion** | `return val` &rarr; `return None`<br>`raise Exc` &rarr; `pass`<br>`assert cond` &rarr; `pass`<br>`call()` &rarr; `pass` | Proves tests assert returned objects, enforce error branches, and verify side-effect calls. | **Yes** | **Yes** | **Yes** |
289
+ | **String Boundary** | `"admin"` &rarr; `"XXadminXX"`<br>`""` &rarr; `"XX"` | Exposes tests that pass only because strings are truthy or never strictly asserted. Docstrings preserved. | **Yes** | **Yes** | Partial |
290
+ | **Argument Swapping** | `func(a, b)` &rarr; `func(b, a)` | Catches signature confusion bugs when parameters share types (e.g. `(user_id, account_id)`). | **Yes** | No | No |
291
+ | **Async / Await Dropping** | `await coro()` &rarr; `coro()` | Exposes unawaited coroutine leaks in modern FastAPI, Starlette, and asyncio code. | **Yes** | No | No |
292
+ | **Context Manager Bypass** | `with lock:` &rarr; *bare body*<br>`async with txn:` &rarr; *bare body* | Proves test suite verifies locks, transaction boundaries, and resource cleanup. | **Yes** | No | No |
293
+ | **Dict Fallback Removal** | `d.get(k, default)` &rarr; `d.get(k, None)` | Catches implicit fallback assumptions where tests never verify default values. | **Yes** | No | No |
294
+ | **Decorator Removal** | `@auth_required` &rarr; *(stripped)*<br>`@lru_cache` &rarr; *(stripped)* | Proves tests verify authentication, caching, validation, and rate-limiting wrappers. | **Yes** | Partial | No |
295
+ | **Loop Control** | `break` &harr; `continue` | Exposes untested loop termination criteria and infinite iteration risks. | **Yes** | No | No |
296
+ | **Unary Inversion** | `not x` &rarr; `x`<br>`-x` &rarr; `+x`<br>`~x` &rarr; `x` | Catches inverted boolean flags, negative coordinate shifts, and bitwise flags. | **Yes** | **Yes** | **Yes** |
297
+ | **Comparison & Identity** | `>=` &rarr; `>`, `<` &rarr; `<=`, `==` &rarr; `!=`<br>`in` &rarr; `not in`, `is` &rarr; `is not` | Detects off-by-one boundary regressions and inverted collection filters. | **Yes** | **Yes** | **Yes** |
298
+ | **Git Diff Speed** | **2 – 5 Seconds** *(Diff-Scoped + Fail-Fast)* | Instant feedback in pre-commit hooks and local developer workflows. | **Yes** | Hours | Hours |
299
+ | **All-in-One Security** | **AST SAST + Leaked Secrets + CVEs + Slopsquatting** | Complete security & test integrity gate in a single tool and report. | **Yes** | No | No |
300
+
301
+ ### Enterprise AST SAST Scanner (OWASP Top 10 Coverage)
302
+
303
+ DeployProof includes a zero-dependency, high-precision AST SAST engine built natively into the pre-push gate, covering the most critical Python security risks:
304
+
305
+ | Rule ID | Vulnerability Class | OWASP Category | CWE | Severity | Example Pattern Detected |
306
+ |---|---|---|---|:---:|---|
307
+ | **`DP-SAST-001`** | **Arbitrary Code Execution** | A03:2021-Injection | CWE-95 | `CRITICAL` | `eval(expr)`, `exec(user_code)`, `__import__(name)` |
308
+ | **`DP-SAST-002`** | **Command Injection** | A03:2021-Injection | CWE-78 | `CRITICAL` | `os.system(cmd)`, `os.popen(cmd)`, `pty.spawn(cmd)` |
309
+ | **`DP-SAST-003`** | **Subprocess Command Injection** | A03:2021-Injection | CWE-78 | `HIGH` | `subprocess.run(cmd, shell=True)` |
310
+ | **`DP-SAST-004`** | **Insecure Deserialization** | A08:2021-Integrity | CWE-502 | `CRITICAL` | `pickle.loads(b)`, `marshal.loads(b)`, `shelve.open(p)` |
311
+ | **`DP-SAST-005`** | **Unsafe YAML Deserialization** | A08:2021-Integrity | CWE-502 | `HIGH` | `yaml.load(text)` without `SafeLoader`, `yaml.unsafe_load()` |
312
+ | **`DP-SAST-006`** | **SQL Injection (SQLi)** | A03:2021-Injection | CWE-89 | `HIGH` | `cursor.execute(f"SELECT * WHERE id={id}")` |
313
+ | **`DP-SAST-007`** | **Cross-Site Scripting (XSS) / SSTI** | A03:2021-Injection | CWE-79 | `HIGH` | `Markup(user_input)`, `render_template_string(f"...")` |
314
+ | **`DP-SAST-008`** | **Path Traversal / Arbitrary File Read** | A01:2021-Access Control | CWE-22 | `HIGH` | `open(f"/data/{filename}")`, `shutil.rmtree("/tmp/" + id)` |
315
+ | **`DP-SAST-009`** | **Insecure Cryptographic Algorithms** | A02:2021-Crypto | CWE-327 | `MEDIUM` | `hashlib.md5()`, `hashlib.sha1()`, `Crypto.Cipher.DES` |
316
+ | **`DP-SAST-010`** | **Disabled TLS/SSL Verification** | A05:2021-Misconfiguration | CWE-295 | `HIGH` | `requests.get(url, verify=False)`, `ssl._create_unverified_context()` |
317
+ | **`DP-SAST-011`** | **Production Debug / Global Bindings** | A05:2021-Misconfiguration | CWE-489 | `HIGH` | `app.run(host="0.0.0.0", debug=True)` |
318
+ | **`DP-SAST-012`** | **Insecure Randomness for Secrets** | A07:2021-Auth | CWE-338 | `MEDIUM` | `token = random.randint(...)` (instead of `secrets.token_hex`) |
319
+ | **`DP-SAST-013`** | **XML External Entity (XXE)** | A08:2021-Integrity | CWE-611 | `MEDIUM` | `ElementTree.parse(user_xml)` without `defusedxml` |
320
+
321
+ ---
322
+
323
+ ### Complete CLI Commands & Flags Reference
324
+
325
+ DeployProof provides a rich command-line interface with fine-grained control over every gate:
326
+
327
+ #### Core Commands
328
+
329
+ | Command | Syntax | Description | Default |
330
+ |---|---|---|---|
331
+ | **Check (Default Gate)** | `deployproof check [options]` | Runs all 7 deterministic pre-push verification gates on the modified files in the current git working tree session. | Evaluates git working tree diff against `HEAD` |
332
+ | **Initialize Pre-Push Hook** | `deployproof init` | Automatically installs the DeployProof pre-push hook into `.git/hooks/pre-push` and generates an initial `pyproject.toml` `[tool.deployproof]` configuration block. | Installs executable shell/powershell hook |
333
+ | **Inspect Diff Scope** | `deployproof diff` | Prints the detected git diff status, modified source files, and test files currently in scope without running tests. | Shows current diff session files |
334
+ | **Version** | `deployproof --version` | Displays the current installed version of DeployProof. | Displays `deployproof 1.1.2` |
335
+ | **Help** | `deployproof --help` | Displays full interactive command usage and flag descriptions. | Prints CLI help manual |
336
+
337
+ #### Mutation Testing & Self-Healing Options
338
+
339
+ | Flag | Short | Type | Description | Default |
340
+ |---|---|---|---|---|
341
+ | `--threshold <float>` | `-t` | `float` | Minimum mutation score percentage required to pass the verification gate (e.g. `--threshold 85.0`). | `80.0` |
342
+ | `--workers <int>` | `-w` | `int` | Number of isolated parallel worker processes for mutation test sandboxes (e.g. `--workers 12`). | Auto-detected CPU count |
343
+ | `--heal-tests [path]` | | `path` | Synthesizes verified, ready-to-run pytest test cases with boundary inversion heuristics to kill surviving mutants. Output path defaults to `tests/test_deployproof_healed.py`. | Disabled unless specified |
344
+ | `--generate-tests [path]` | | `path` | Alias for `--heal-tests`. | Disabled |
345
+ | `--interactive` | `-i` | `flag` | Interactive quick-fix mode. Prompts in the terminal with single-keystroke `[y/N]` confirmation to automatically inspect and append synthesized tests. | Disabled (auto-detects non-TTY for CI safety) |
346
+ | `--timeout <float>` | | `float` | Maximum timeout in seconds allowed for a single mutant test execution before killing the process. | `10.0`s |
347
+ | `--full-repo` | | `flag` | Audits all tracked Python files across the entire repository root (respecting `.gitignore`), using isolated multi-worker sandboxes. | Diff-scoped to current session |
348
+ | `--files <paths...>` | | `paths` | Explicitly evaluate specific files or directories, completely bypassing git diff resolution. | Git working tree diff |
349
+ | `--base <ref>` | | `string` | Base git reference (branch, commit hash, or tag) to calculate diff against (e.g. `--base origin/main`). | Auto-detected upstream ref |
350
+ | `--wsl` | | `flag` | Delegates mutation testing to native Linux environment inside Windows Subsystem for Linux (WSL). | Native OS execution |
351
+
352
+ #### Security & Quality Gates
353
+
354
+ | Flag | Description | Default |
355
+ |---|---|---|
356
+ | `--sast` / `--no-sast` | Enable or disable the AST-based OWASP Top 10 static security analysis scanner. Detects SQLi, command injection, insecure deserialization, path traversals, etc. | Enabled (`true`) |
357
+ | `--scan-git-history` / `--no-scan-git-history` | Scan past git commits using Shannon entropy analysis to catch committed API keys, tokens, and private credentials. | Enabled (`true`) |
358
+ | `--history-depth <int>` | Number of past git commits to analyze when `--scan-git-history` is active. | `50` commits |
359
+ | `--check-cve` / `--no-check-cve` | Query the open OSV (Open Source Vulnerabilities) database in real time for known CVE advisories affecting dependencies. | Enabled (`true`) |
360
+ | `--strict-mocks` / `--no-strict-mocks` | Fail the gate (exit code 1) if modified tests introduce mock imports (`unittest.mock`, `mocker`, `monkeypatch`), proving real behavior instead of mocked stubs. | Disabled (`false`) |
361
+ | `--strict-error-handling` / `--no-strict-error-handling` | Fail the gate (exit code 1) if bare `except:`, swallowed exceptions (`except Exception: pass`), or unreachable dead code are detected. | Disabled (`false`) |
362
+
363
+ #### Reporting, CI/CD & Configuration
364
+
365
+ | Flag | Short | Description | Default |
366
+ |---|---|---|---|
367
+ | `--json` | | Output structured machine-readable JSON containing all findings across all 7 verification gates. Ideal for custom CI pipelines, IDE extensions, and dashboards. | Human-readable terminal output |
368
+ | `--github-actions` | `--ci` | Emit inline GitHub Actions annotations (`::error file=...,line=...::`, `::warning::`) on PR diff lines and write a complete Markdown dashboard to `$GITHUB_STEP_SUMMARY`. | Auto-detected when `GITHUB_ACTIONS=true` |
369
+ | `--config <path>` | | Explicit path to a `pyproject.toml` or custom configuration file. | Auto-discovers `pyproject.toml` in repo root |
370
+
371
+ ### Machine-Readable Output (`--json`)
372
+
373
+ DeployProof provides a stable structured JSON schema for CI/CD pipelines, IDEs, and automation:
374
+
375
+ ```bash
376
+ deployproof check --json
377
+ ```
378
+
379
+ #### JSON Output Schema
380
+
381
+ ```json
382
+ {
383
+ "version": "1.1.11",
384
+ "status": "passed",
385
+ "summary": {
386
+ "target_files_count": 1,
387
+ "mutation_score": 100.0,
388
+ "threshold": 80.0,
389
+ "secrets_found": 0,
390
+ "symlink_escapes_found": 0,
391
+ "dependency_findings": {
392
+ "high_risk": 0,
393
+ "medium_risk": 0,
394
+ "ok": 1,
395
+ "unknown": 0,
396
+ "unscanned": 0
397
+ },
398
+ "mock_usages_found": 0,
399
+ "control_flow_findings": 0,
400
+ "strict_mocks_active": false,
401
+ "strict_mocks_triggered": false,
402
+ "strict_error_handling_active": false,
403
+ "strict_error_handling_triggered": false
404
+ },
405
+ "scope": {
406
+ "target_files": [
407
+ {
408
+ "file": "app.py",
409
+ "loc": 45,
410
+ "is_large": false
411
+ }
412
+ ]
413
+ },
414
+ "mutation_testing": {
415
+ "score": 100.0,
416
+ "threshold": 80.0,
417
+ "total_mutants": 6,
418
+ "killed_mutants": 6,
419
+ "survived_mutants_count": 0,
420
+ "duration_seconds": 1.2,
421
+ "surviving_mutants": [],
422
+ "skipped_constructs": [],
423
+ "untested_files": []
424
+ },
425
+ "secrets": {
426
+ "clean": true,
427
+ "files_scanned": 1,
428
+ "findings": []
429
+ },
430
+ "symlinks": {
431
+ "clean": true,
432
+ "files_scanned": 1,
433
+ "findings": []
434
+ },
435
+ "dependencies": {
436
+ "clean": true,
437
+ "total_scanned": 1,
438
+ "findings": [],
439
+ "unscanned_sources": []
440
+ },
441
+ "mocks": {
442
+ "clean": true,
443
+ "strict_gate_triggered": false,
444
+ "findings": []
445
+ },
446
+ "control_flow": {
447
+ "clean": true,
448
+ "strict_gate_triggered": false,
449
+ "findings": []
450
+ }
451
+ }
452
+ ```
453
+
454
+ ## What It Checks (The 7 Verification Gates)
455
+
456
+ - **Gate 1: In-Memory Schemata Mutation Testing** — Mutates AST operators (`>=`, `==`, `and`, `or`, `*`, numeric constants, string boundaries) and switches mutants in warm RAM (`__DEPLOYPROOF_MUTANT__`), completely bypassing disk I/O.
457
+ - **Gate 2: Actionable Self-Healing Test Synthesis** — When mutants survive, `--heal-tests` and `-i` synthesize ready-to-run `pytest` unit tests with argument inference, class method instantiation, and boundary value checks to eliminate gaps.
458
+ - **Gate 3: AST OWASP Top 10 SAST Scanner** — Scans AST syntax trees for critical security flaws (SQL injection, command execution with `shell=True`, insecure deserialization, SSRF, hardcoded JWT keys).
459
+ - **Gate 4: Secrets & 50-Commit Git History Scanner** — Scans modified files and past 50 git commits for hardcoded API keys (OpenAI, Anthropic, AWS, GitHub, Stripe, private keys) and high-entropy secrets using Shannon entropy analysis.
460
+ - **Gate 5: Dependency CVE & Slopsquatting Defense** — Cross-references dependencies against the OSV vulnerability database and queries PyPI JSON API to detect hallucinated LLM packages.
461
+ - **Gate 6: CWE-61 Symlink Sandbox Escape Gate** — Resolves symbolic links and flags any whose target escapes the repository root (GhostApproval sandbox traversal defense).
462
+ - **Gate 7: Control Flow & Swallowed Exceptions Gate** — AST detector for bare `except:` without re-raise, silently swallowed exceptions (`except Exception: pass`), dead code, and mock leaks (`--strict-mocks`, `--strict-error-handling`).
463
+
464
+ ## Configuration (`pyproject.toml`)
465
+
466
+ DeployProof natively supports standard PEP 518 `pyproject.toml` configuration under `[tool.deployproof]`:
467
+
468
+ ```toml
469
+ [tool.deployproof]
470
+ threshold = 85.0
471
+ workers = 8
472
+ timeout = 15.0
473
+ strict_mocks = true
474
+ strict_error_handling = true
475
+ sast_scanning = true
476
+ history_secrets_scanning = true
477
+ cve_scanning = true
478
+ generate_tests = "tests/test_deployproof_healed.py"
479
+ ```
480
+
481
+ ## CI/CD & Pre-Commit Integration
482
+
483
+ ### GitHub Actions
484
+ Add `.github/workflows/deployproof.yml` to automatically emit PR inline annotations and visual Markdown step summaries:
485
+
486
+ ```yaml
487
+ name: DeployProof Gate
488
+ on: [push, pull_request]
489
+
490
+ jobs:
491
+ verify:
492
+ runs-on: ubuntu-latest
493
+ steps:
494
+ - uses: actions/checkout@v4
495
+ with:
496
+ fetch-depth: 50
497
+ - uses: actions/setup-python@v5
498
+ with:
499
+ python-version: '3.12'
500
+ - run: pip install -e . && pip install deployproof pytest
501
+ - run: deployproof check --github-actions --workers 4
502
+ ```
503
+
504
+ ### Pre-Commit Framework (.pre-commit-config.yaml)
505
+ ```yaml
506
+ repos:
507
+ - repo: https://github.com/SVSPraveen/DeployProof
508
+ rev: v1.1.2
509
+ hooks:
510
+ - id: deployproof-check
511
+ ```
512
+
513
+ ## Status & Roadmap
514
+
515
+ - **Current (v1.1.2):** In-Memory AST Schemata Mutation Testing, Actionable Self-Healing Test Synthesizer (`--heal-tests`), Interactive Quick-Fix Mode (`-i`), `pyproject.toml` `[tool.deployproof]` configuration engine, GitHub Actions native inline annotations and `$GITHUB_STEP_SUMMARY` dashboard, `.pre-commit-hooks.yaml` support, Full Repository Audit Mode (`--full-repo`) with isolated multi-worker sandboxes, AST OWASP Top 10 SAST scanner, 50-commit git history secrets scanner, OSV CVE database verification, GhostApproval symlink sandbox escape detector, **261 unit tests**, and complete `/docs` product portal.
516
+ - **Next:** Reverse test-to-source dependency mapping (see `FUTURE_SCOPE.md`), SARIF 2.1.0 report exporter, and multi-language mutation rule packs.
517
+
518
+ ## Contributing
519
+
520
+ Issues and pull requests are welcome. Open an issue first for significant changes so the approach can be discussed before implementation.
521
+
522
+ ## License
523
+
524
+ MIT. See [LICENSE](LICENSE).
525
+
526
+ ---
527
+
528
+ *Created & Architected by [SVS Praveen](https://github.com/SVSPraveen) · [Portfolio](https://svspraveen.vercel.app/) · [LinkedIn](https://www.linkedin.com/in/svs-praveen-s/)*
529
+