deployproof 0.1.0__py3-none-any.whl
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.
- deployproof/__init__.py +3 -0
- deployproof/cli.py +288 -0
- deployproof/dependencies.py +874 -0
- deployproof/diff.py +234 -0
- deployproof/mutator.py +475 -0
- deployproof/reporter.py +281 -0
- deployproof/secrets.py +221 -0
- deployproof/symlinks.py +156 -0
- deployproof/wsl.py +147 -0
- deployproof-0.1.0.dist-info/METADATA +111 -0
- deployproof-0.1.0.dist-info/RECORD +15 -0
- deployproof-0.1.0.dist-info/WHEEL +5 -0
- deployproof-0.1.0.dist-info/entry_points.txt +2 -0
- deployproof-0.1.0.dist-info/licenses/LICENSE +21 -0
- deployproof-0.1.0.dist-info/top_level.txt +1 -0
deployproof/wsl.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"""WSL (Windows Subsystem for Linux) bridge for DeployProof."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import platform
|
|
6
|
+
import subprocess
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
9
|
+
|
|
10
|
+
DEFAULT_WSL_VENV = "~/.deployproof-wsl-venv"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def is_windows() -> bool:
|
|
14
|
+
"""Check if host system is Windows."""
|
|
15
|
+
return platform.system() == "Windows"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def is_wsl_available() -> bool:
|
|
19
|
+
"""Check if WSL is installed and accessible on Windows host."""
|
|
20
|
+
if not is_windows():
|
|
21
|
+
return False
|
|
22
|
+
try:
|
|
23
|
+
res = subprocess.run(
|
|
24
|
+
["wsl", "--status"],
|
|
25
|
+
capture_output=True,
|
|
26
|
+
text=True,
|
|
27
|
+
encoding="utf-8",
|
|
28
|
+
errors="replace",
|
|
29
|
+
timeout=5,
|
|
30
|
+
check=False,
|
|
31
|
+
)
|
|
32
|
+
return res.returncode == 0
|
|
33
|
+
except (FileNotFoundError, subprocess.SubprocessError):
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_wsl_path(path: Path) -> Optional[str]:
|
|
38
|
+
"""Convert a Windows Path to a WSL POSIX path."""
|
|
39
|
+
if not is_windows():
|
|
40
|
+
return str(path.resolve())
|
|
41
|
+
posix_style = str(path.resolve()).replace("\\", "/")
|
|
42
|
+
try:
|
|
43
|
+
res = subprocess.run(
|
|
44
|
+
["wsl", "wslpath", "-u", posix_style],
|
|
45
|
+
capture_output=True,
|
|
46
|
+
text=True,
|
|
47
|
+
encoding="utf-8",
|
|
48
|
+
errors="replace",
|
|
49
|
+
timeout=5,
|
|
50
|
+
check=False,
|
|
51
|
+
)
|
|
52
|
+
if res.returncode == 0:
|
|
53
|
+
return res.stdout.strip()
|
|
54
|
+
except (FileNotFoundError, subprocess.SubprocessError):
|
|
55
|
+
pass
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def is_wsl_venv_configured(venv_path: str = DEFAULT_WSL_VENV) -> bool:
|
|
60
|
+
"""Check if Linux venv with mutmut exists inside WSL."""
|
|
61
|
+
if not is_windows():
|
|
62
|
+
return False
|
|
63
|
+
try:
|
|
64
|
+
res = subprocess.run(
|
|
65
|
+
["wsl", "bash", "-c", f"test -f {venv_path}/bin/mutmut"],
|
|
66
|
+
capture_output=True,
|
|
67
|
+
text=True,
|
|
68
|
+
encoding="utf-8",
|
|
69
|
+
errors="replace",
|
|
70
|
+
timeout=5,
|
|
71
|
+
check=False,
|
|
72
|
+
)
|
|
73
|
+
return res.returncode == 0
|
|
74
|
+
except (FileNotFoundError, subprocess.SubprocessError):
|
|
75
|
+
return False
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def check_wsl_readiness(venv_path: str = DEFAULT_WSL_VENV) -> Tuple[bool, str]:
|
|
79
|
+
"""
|
|
80
|
+
Evaluate WSL readiness for mutmut execution.
|
|
81
|
+
|
|
82
|
+
Returns (ready: bool, message: str).
|
|
83
|
+
"""
|
|
84
|
+
if not is_windows():
|
|
85
|
+
return False, "Host is not Windows; WSL delegation is only applicable on Windows."
|
|
86
|
+
|
|
87
|
+
if not is_wsl_available():
|
|
88
|
+
return False, (
|
|
89
|
+
"[!] WSL (Windows Subsystem for Linux) not detected.\n"
|
|
90
|
+
" To run verified mutation tests locally on Windows, install WSL (wsl --install),\n"
|
|
91
|
+
" or rely on Tier 1 pre-check locally and verify in GitHub Actions CI."
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if not is_wsl_venv_configured(venv_path):
|
|
95
|
+
return False, (
|
|
96
|
+
f"[!] WSL environment detected, but Linux Python environment ({venv_path}) with mutmut was not found.\n"
|
|
97
|
+
f" To configure WSL for verified local testing:\n"
|
|
98
|
+
f" wsl bash -c \"python3 -m venv {venv_path} && {venv_path}/bin/pip install mutmut pytest\"\n"
|
|
99
|
+
" Running Tier 1 local pre-check instead. Full verified score will run in CI on push."
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return True, "WSL and mutmut environment configured."
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def run_wsl_mutmut(
|
|
106
|
+
repo_root: Path,
|
|
107
|
+
target_files: List[Path],
|
|
108
|
+
venv_path: str = DEFAULT_WSL_VENV,
|
|
109
|
+
timeout: float = 120.0,
|
|
110
|
+
) -> Dict[str, Any]:
|
|
111
|
+
"""
|
|
112
|
+
Execute authoritative mutmut in WSL against scoped files.
|
|
113
|
+
"""
|
|
114
|
+
wsl_root = get_wsl_path(repo_root)
|
|
115
|
+
if not wsl_root:
|
|
116
|
+
return {"success": False, "error": "Failed to resolve WSL repository path."}
|
|
117
|
+
|
|
118
|
+
# Translate target files relative to repo root
|
|
119
|
+
rel_files = []
|
|
120
|
+
for f in target_files:
|
|
121
|
+
try:
|
|
122
|
+
rel = f.relative_to(repo_root).as_posix()
|
|
123
|
+
rel_files.append(rel)
|
|
124
|
+
except ValueError:
|
|
125
|
+
pass
|
|
126
|
+
|
|
127
|
+
cmd_script = f"source {venv_path}/bin/activate && cd {wsl_root} && mutmut run"
|
|
128
|
+
try:
|
|
129
|
+
res = subprocess.run(
|
|
130
|
+
["wsl", "bash", "-c", cmd_script],
|
|
131
|
+
capture_output=True,
|
|
132
|
+
text=True,
|
|
133
|
+
encoding="utf-8",
|
|
134
|
+
errors="replace",
|
|
135
|
+
timeout=timeout,
|
|
136
|
+
check=False,
|
|
137
|
+
)
|
|
138
|
+
return {
|
|
139
|
+
"success": res.returncode == 0,
|
|
140
|
+
"stdout": res.stdout,
|
|
141
|
+
"stderr": res.stderr,
|
|
142
|
+
"returncode": res.returncode,
|
|
143
|
+
}
|
|
144
|
+
except subprocess.TimeoutExpired:
|
|
145
|
+
return {"success": False, "error": f"WSL mutmut timed out after {timeout}s."}
|
|
146
|
+
except Exception as e:
|
|
147
|
+
return {"success": False, "error": f"WSL mutmut execution error: {e}"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deployproof
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A deterministic pre-push verification tool that catches untested AI code, leaked credentials, sandbox escapes, and hallucinated packages before you ship.
|
|
5
|
+
Author: SVS Praveen
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/SVSPraveen/deployproof
|
|
8
|
+
Project-URL: Documentation, https://github.com/SVSPraveen/deployproof#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/SVSPraveen/deployproof.git
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/SVSPraveen/deployproof/issues
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# DeployProof
|
|
31
|
+
|
|
32
|
+
> A pre-push verification tool for AI-assisted codebases: mutation testing, credential scanning, sandbox-escape detection, and dependency hallucination checks.
|
|
33
|
+
|
|
34
|
+
<!-- Once the package is published to PyPI, replace the two static badges below with:
|
|
35
|
+
[](https://pypi.org/project/deployproof/)
|
|
36
|
+
[](https://pypi.org/project/deployproof/) -->
|
|
37
|
+
[](https://pypi.org/project/deployproof/)
|
|
38
|
+
[](LICENSE)
|
|
39
|
+
[](https://pypi.org/project/deployproof/)
|
|
40
|
+
[](https://github.com/SVSPraveen/deployproof/actions/workflows/ci.yml)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Why This Exists
|
|
45
|
+
|
|
46
|
+
AI-assisted development introduces failure modes that standard tools miss: test suites with high line coverage but near-zero mutation scores, hardcoded credentials generated in passing, symlinks that deceive approval prompts into escaping the repository sandbox, and package names hallucinated by LLMs that don't exist on PyPI. DeployProof catches these at the pre-push stage, before they reach CI or production.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install deployproof
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Requires Python 3.10+.
|
|
55
|
+
|
|
56
|
+
## Quickstart
|
|
57
|
+
|
|
58
|
+
Initialize in your repository:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
deployproof init
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Run all verification checks against changes in the current session:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
deployproof check
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Output includes a section for each check — symlink scan, secrets scan, dependency scan, and mutation score — with a pass/fail line at the bottom. Exit code is non-zero on any finding that should block a push.
|
|
71
|
+
|
|
72
|
+
## What It Checks
|
|
73
|
+
|
|
74
|
+
- **Mutation Score** — Mutates AST operators (`>=`, `==`, `and`, `or`, `*`, numeric constants, comparisons) in modified files and runs your test suite against each mutant. Reports surviving mutants and a percentage score. Does not use line coverage.
|
|
75
|
+
- **Secrets and Credentials** — Scans modified files for hardcoded API keys (OpenAI, Anthropic, AWS, GitHub, Stripe, private keys) and tracked `.env` files using pattern matching and entropy analysis.
|
|
76
|
+
- **Symlink and Sandbox Escape** — Resolves symbolic links and flags any whose target escapes the repository root (CWE-61 / CWE-451). Catches the class of path-traversal trick used in the GhostApproval disclosure (Wiz Research, July 2026).
|
|
77
|
+
- **Dependency and Slopsquatting** — For each new import or manifest entry introduced in the diff, queries the PyPI JSON API and checks registration age. Packages that don't exist (HTTP 404) are flagged HIGH RISK; packages registered within the last 30 days are flagged MEDIUM RISK. Network errors are reported as UNKNOWN — never silently treated as safe.
|
|
78
|
+
|
|
79
|
+
## What This Doesn't Do
|
|
80
|
+
|
|
81
|
+
- **Not a full-repo audit.** Checks are scoped to files changed in the current session (git diff). Files you haven't touched are not re-evaluated.
|
|
82
|
+
- **Python only.** Mutation testing and import extraction currently support Python files only. Other languages are not scanned.
|
|
83
|
+
- **No auto-fix.** DeployProof reports findings; it does not modify your code, rewrite imports, or suggest patches.
|
|
84
|
+
- **No IDE plugin yet.** There is no VS Code extension or JetBrains plugin. The CLI is the interface. IDE integration is on the roadmap.
|
|
85
|
+
|
|
86
|
+
## See It Catch Real Bugs
|
|
87
|
+
|
|
88
|
+
Clone this repository and run the standalone stress-test suite to see DeployProof evaluate 7 planted edge cases:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
python stress_fixtures/run_stress_tests.py
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Fixtures cover weak test suites, zero-test orphan modules, planted OpenAI/AWS credentials, and GhostApproval sandbox-escape traps.
|
|
95
|
+
|
|
96
|
+
## Status & Roadmap
|
|
97
|
+
|
|
98
|
+
- **Current (v0.1.0):** Diff-scoped AST mutation testing, secrets scanner, GhostApproval symlink sandbox-escape detector, PyPI dependency hallucination / slopsquatting scanner, and Tier 2 CI verification via GitHub Actions (mutmut).
|
|
99
|
+
- **Next:** Multi-language mutation support and expanded ecosystem rule packs.
|
|
100
|
+
|
|
101
|
+
## Contributing
|
|
102
|
+
|
|
103
|
+
Issues and pull requests are welcome. Open an issue first for significant changes so the approach can be discussed before implementation.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT. See [LICENSE](LICENSE).
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
*Created by [SVS Praveen](https://github.com/SVSPraveen) · [Portfolio](https://svspraveen.vercel.app/) · [LinkedIn](https://www.linkedin.com/in/svs-praveen-s/)*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
deployproof/__init__.py,sha256=w6Hbx681uzPVJwegiRIsDGsqL85pRewOJ_jmIGoaxG8,90
|
|
2
|
+
deployproof/cli.py,sha256=qwQNxmOv-DK7KXENhB4sHUbr6NnheTK14GiqB_XNtpc,10116
|
|
3
|
+
deployproof/dependencies.py,sha256=vNQop74X-HgOYsXd4frK4RtL67A_YMGtzUXr7lYth00,27818
|
|
4
|
+
deployproof/diff.py,sha256=4KMXiDcN8lqo6UGk7FdzO8nzYaSY9r7MdFXTUgapaOo,7387
|
|
5
|
+
deployproof/mutator.py,sha256=x9mqzvwbOqJXsADAx4UYa3KIRPHp5-InRy53R1897Ls,23377
|
|
6
|
+
deployproof/reporter.py,sha256=W6VsF7tW8Tm9sfT5y6RZx8PUxYF0IuILk7TaaMhrRt4,13900
|
|
7
|
+
deployproof/secrets.py,sha256=tHR2znRQ3GNKDlxoPQXuiKZeQ1tcEjmrEHl6aK3Udbs,7456
|
|
8
|
+
deployproof/symlinks.py,sha256=WKJzIKISSgQUu4IF9S-U9_uoivCqISjDZU1eXJqDLIQ,5038
|
|
9
|
+
deployproof/wsl.py,sha256=SoRU2paJzGJFkh14KkR0URQorsW1DYvTmtECFAEMNUI,4644
|
|
10
|
+
deployproof-0.1.0.dist-info/licenses/LICENSE,sha256=E9Yzg-QxjuMSW4TXPRVuvfEBwXzgp5LN1qx9TVHAIUs,1067
|
|
11
|
+
deployproof-0.1.0.dist-info/METADATA,sha256=gbzdiYj8uMWqQROuX2fatLoDUjEl9KfHPqyMIkkyBHI,5897
|
|
12
|
+
deployproof-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
13
|
+
deployproof-0.1.0.dist-info/entry_points.txt,sha256=W2D5ShVxETI5SChzq3Y4qW3QtqJ0ys5d7z5aSSEa9u0,53
|
|
14
|
+
deployproof-0.1.0.dist-info/top_level.txt,sha256=5byo1m615UIhZSHeFAF0UqlwPNPIWev5030OGLf_z3Q,12
|
|
15
|
+
deployproof-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SVSPraveen
|
|
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 @@
|
|
|
1
|
+
deployproof
|