secguard-cli 1.1.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.
Files changed (31) hide show
  1. secguard_cli-1.1.0/LICENSE +21 -0
  2. secguard_cli-1.1.0/PKG-INFO +106 -0
  3. secguard_cli-1.1.0/README.md +72 -0
  4. secguard_cli-1.1.0/pyproject.toml +44 -0
  5. secguard_cli-1.1.0/setup.cfg +4 -0
  6. secguard_cli-1.1.0/src/secguard/__init__.py +0 -0
  7. secguard_cli-1.1.0/src/secguard/ai_engine.py +1556 -0
  8. secguard_cli-1.1.0/src/secguard/cli.py +875 -0
  9. secguard_cli-1.1.0/src/secguard/config.py +172 -0
  10. secguard_cli-1.1.0/src/secguard/dependency_scanner.py +513 -0
  11. secguard_cli-1.1.0/src/secguard/patcher.py +707 -0
  12. secguard_cli-1.1.0/src/secguard/reporter.py +276 -0
  13. secguard_cli-1.1.0/src/secguard/scanner.py +5009 -0
  14. secguard_cli-1.1.0/src/secguard/test.py +5 -0
  15. secguard_cli-1.1.0/src/secguard_cli.egg-info/PKG-INFO +106 -0
  16. secguard_cli-1.1.0/src/secguard_cli.egg-info/SOURCES.txt +29 -0
  17. secguard_cli-1.1.0/src/secguard_cli.egg-info/dependency_links.txt +1 -0
  18. secguard_cli-1.1.0/src/secguard_cli.egg-info/entry_points.txt +2 -0
  19. secguard_cli-1.1.0/src/secguard_cli.egg-info/requires.txt +9 -0
  20. secguard_cli-1.1.0/src/secguard_cli.egg-info/top_level.txt +1 -0
  21. secguard_cli-1.1.0/test/test.py +17 -0
  22. secguard_cli-1.1.0/test/test1.py +12 -0
  23. secguard_cli-1.1.0/test/test2.py +21 -0
  24. secguard_cli-1.1.0/test/test3.py +19 -0
  25. secguard_cli-1.1.0/test/test4.py +20 -0
  26. secguard_cli-1.1.0/test/test5.py +29 -0
  27. secguard_cli-1.1.0/test/test6.py +11 -0
  28. secguard_cli-1.1.0/test/test7.py +28 -0
  29. secguard_cli-1.1.0/test/test8.py +8 -0
  30. secguard_cli-1.1.0/tests/test_autofix_and_ci.py +614 -0
  31. secguard_cli-1.1.0/tests/test_requested_security_gaps.py +1136 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ömer Yiğit Hardal
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,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: secguard-cli
3
+ Version: 1.1.0
4
+ Summary: Hybrid AI-assisted SAST CLI tool for source code and dependencies
5
+ Author: Ömer Yiğit Hardal
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/omeryigithardal53/secguard
8
+ Project-URL: Repository, https://github.com/omeryigithardal53/secguard
9
+ Project-URL: Issues, https://github.com/omeryigithardal53/secguard/issues
10
+ Keywords: security,sast,static-analysis,vulnerability-scanner,devsecops,cli
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: typer>=0.12.0
25
+ Requires-Dist: rich>=13.7.0
26
+ Requires-Dist: openai>=1.30.0
27
+ Requires-Dist: httpx>=0.27.0
28
+ Requires-Dist: tree-sitter>=0.23.0
29
+ Requires-Dist: tree-sitter-javascript>=0.23.0
30
+ Requires-Dist: tree-sitter-typescript>=0.23.0
31
+ Requires-Dist: tree-sitter-php>=0.23.0
32
+ Requires-Dist: tree-sitter-c>=0.23.0
33
+ Dynamic: license-file
34
+
35
+ # SecGuard — AI-Assisted SAST CLI Tool
36
+
37
+ **SecGuard** is a command-line Static Application Security Testing (SAST) tool that scans source code and configuration files prior to production deployment to detect security vulnerabilities, filter out false positives, and generate validated remediation patches.
38
+
39
+ ## Key Features
40
+
41
+ - **Multi-Language Static Analysis:** Detects 15+ OWASP Top 10 vulnerability categories (SQLi, Command Injection, SSTI, Path Traversal, SSRF, XXE, Insecure Deserialization, Hardcoded Secrets, etc.) across Python, JavaScript/TypeScript, PHP, C, and Dockerfile targets.
42
+ - **Advanced Python AST & Data-Flow Analysis:** Resolves obfuscated calls via constant folding, dictionary/variable unpacking (`**kwargs`), and cross-file/intra-class taint tracking while distinguishing safe sanitization patterns.
43
+ - **Batch LLM Triage & Automatic Failover:** Groups findings per file into single batch requests and automatically fails over to fallback models or local **Ollama** instances when Groq API rate limits are reached.
44
+ - **Validated Auto-Patching & Rollback:** Applies verified security patches bottom-up in a single pass and automatically rolls back changes if syntax or test validation fails.
45
+ - **DevSecOps & CI/CD Integration:** Includes Git commit history secret scanning, `--fail-on` severity threshold gating, dependency vulnerability auditing, and GitHub Security-compatible **SARIF v2.1.0** reporting.
46
+
47
+ ## Installation
48
+
49
+ ### Option 1: One-Line Quick Install (Linux / macOS)
50
+ Installs the global `secguard` CLI directly without manually creating a virtual environment:
51
+
52
+ ```bash
53
+ curl -fsSL [https://raw.githubusercontent.com/omeryigithardal53/secguard/main/install.sh](https://raw.githubusercontent.com/omeryigithardal53/secguard/main/install.sh) | bash
54
+ ```
55
+
56
+ Once installed, open a new terminal or run `source ~/.zshrc` (`source ~/.bashrc` for Bash).
57
+
58
+ ### Option 2: Install via `pip` or `pipx` (PyPI)
59
+
60
+ ```bash
61
+ pip install secguard-cli
62
+ # or
63
+ pipx install secguard-cli
64
+ ```
65
+
66
+ ### Option 3: Developer Install (From Source)
67
+
68
+ ```bash
69
+ git clone [https://github.com/omeryigithardal53/secguard.git](https://github.com/omeryigithardal53/secguard.git)
70
+ cd secguard
71
+ python3 -m venv .venv
72
+ source .venv/bin/activate
73
+ pip install -e .
74
+ ```
75
+
76
+ ## Usage Examples
77
+
78
+ ```bash
79
+ # Configure API key (Groq) or local Ollama provider
80
+ secguard config
81
+
82
+ # Scan a file or project directory
83
+ secguard scan path/to/project
84
+
85
+ # Review and apply validated patches for detected vulnerabilities
86
+ secguard fix path/to/file.py --apply
87
+
88
+ # Fail CI/CD pipeline on HIGH+ findings and export a SARIF report
89
+ secguard scan . --fail-on high --format sarif -o secguard-results.sarif
90
+
91
+ # Scan Git commit history for leaked secrets
92
+ secguard scan . --git-history
93
+ ```
94
+
95
+ ## Verification & Tests
96
+
97
+ Verified with **116 automated tests** covering static analysis rules, indirect data-flow scenarios, false-positive guards, patch rollback mechanisms, and CI/CD outputs:
98
+
99
+ ```bash
100
+ pytest -v
101
+ ```
102
+
103
+ ## Author & License
104
+
105
+ - **Author:** Ömer Yiğit Hardal ([@omeryigithardal53](https://github.com/omeryigithardal53))
106
+ - **License:** MIT License — See the `LICENSE` file for copyright details.
@@ -0,0 +1,72 @@
1
+ # SecGuard — AI-Assisted SAST CLI Tool
2
+
3
+ **SecGuard** is a command-line Static Application Security Testing (SAST) tool that scans source code and configuration files prior to production deployment to detect security vulnerabilities, filter out false positives, and generate validated remediation patches.
4
+
5
+ ## Key Features
6
+
7
+ - **Multi-Language Static Analysis:** Detects 15+ OWASP Top 10 vulnerability categories (SQLi, Command Injection, SSTI, Path Traversal, SSRF, XXE, Insecure Deserialization, Hardcoded Secrets, etc.) across Python, JavaScript/TypeScript, PHP, C, and Dockerfile targets.
8
+ - **Advanced Python AST & Data-Flow Analysis:** Resolves obfuscated calls via constant folding, dictionary/variable unpacking (`**kwargs`), and cross-file/intra-class taint tracking while distinguishing safe sanitization patterns.
9
+ - **Batch LLM Triage & Automatic Failover:** Groups findings per file into single batch requests and automatically fails over to fallback models or local **Ollama** instances when Groq API rate limits are reached.
10
+ - **Validated Auto-Patching & Rollback:** Applies verified security patches bottom-up in a single pass and automatically rolls back changes if syntax or test validation fails.
11
+ - **DevSecOps & CI/CD Integration:** Includes Git commit history secret scanning, `--fail-on` severity threshold gating, dependency vulnerability auditing, and GitHub Security-compatible **SARIF v2.1.0** reporting.
12
+
13
+ ## Installation
14
+
15
+ ### Option 1: One-Line Quick Install (Linux / macOS)
16
+ Installs the global `secguard` CLI directly without manually creating a virtual environment:
17
+
18
+ ```bash
19
+ curl -fsSL [https://raw.githubusercontent.com/omeryigithardal53/secguard/main/install.sh](https://raw.githubusercontent.com/omeryigithardal53/secguard/main/install.sh) | bash
20
+ ```
21
+
22
+ Once installed, open a new terminal or run `source ~/.zshrc` (`source ~/.bashrc` for Bash).
23
+
24
+ ### Option 2: Install via `pip` or `pipx` (PyPI)
25
+
26
+ ```bash
27
+ pip install secguard-cli
28
+ # or
29
+ pipx install secguard-cli
30
+ ```
31
+
32
+ ### Option 3: Developer Install (From Source)
33
+
34
+ ```bash
35
+ git clone [https://github.com/omeryigithardal53/secguard.git](https://github.com/omeryigithardal53/secguard.git)
36
+ cd secguard
37
+ python3 -m venv .venv
38
+ source .venv/bin/activate
39
+ pip install -e .
40
+ ```
41
+
42
+ ## Usage Examples
43
+
44
+ ```bash
45
+ # Configure API key (Groq) or local Ollama provider
46
+ secguard config
47
+
48
+ # Scan a file or project directory
49
+ secguard scan path/to/project
50
+
51
+ # Review and apply validated patches for detected vulnerabilities
52
+ secguard fix path/to/file.py --apply
53
+
54
+ # Fail CI/CD pipeline on HIGH+ findings and export a SARIF report
55
+ secguard scan . --fail-on high --format sarif -o secguard-results.sarif
56
+
57
+ # Scan Git commit history for leaked secrets
58
+ secguard scan . --git-history
59
+ ```
60
+
61
+ ## Verification & Tests
62
+
63
+ Verified with **116 automated tests** covering static analysis rules, indirect data-flow scenarios, false-positive guards, patch rollback mechanisms, and CI/CD outputs:
64
+
65
+ ```bash
66
+ pytest -v
67
+ ```
68
+
69
+ ## Author & License
70
+
71
+ - **Author:** Ömer Yiğit Hardal ([@omeryigithardal53](https://github.com/omeryigithardal53))
72
+ - **License:** MIT License — See the `LICENSE` file for copyright details.
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "secguard-cli"
7
+ version = "1.1.0"
8
+ description = "Hybrid AI-assisted SAST CLI tool for source code and dependencies"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "Ömer Yiğit Hardal" }]
13
+ keywords = ["security", "sast", "static-analysis", "vulnerability-scanner", "devsecops", "cli"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Information Technology",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: Security",
25
+ ]
26
+ dependencies = [
27
+ "typer>=0.12.0",
28
+ "rich>=13.7.0",
29
+ "openai>=1.30.0",
30
+ "httpx>=0.27.0",
31
+ "tree-sitter>=0.23.0",
32
+ "tree-sitter-javascript>=0.23.0",
33
+ "tree-sitter-typescript>=0.23.0",
34
+ "tree-sitter-php>=0.23.0",
35
+ "tree-sitter-c>=0.23.0",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/omeryigithardal53/secguard"
40
+ Repository = "https://github.com/omeryigithardal53/secguard"
41
+ Issues = "https://github.com/omeryigithardal53/secguard/issues"
42
+
43
+ [project.scripts]
44
+ secguard = "secguard.cli:app"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes