secure-repo 1.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.
- secure_repo-1.3.0/LICENSE +88 -0
- secure_repo-1.3.0/PKG-INFO +145 -0
- secure_repo-1.3.0/README.md +110 -0
- secure_repo-1.3.0/pyproject.toml +104 -0
- secure_repo-1.3.0/secure_repo/__init__.py +7 -0
- secure_repo-1.3.0/secure_repo/__main__.py +6 -0
- secure_repo-1.3.0/secure_repo/benchmark/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/benchmark/corpus/JavaCases.java +11 -0
- secure_repo-1.3.0/secure_repo/benchmark/corpus/infrastructure.tf +12 -0
- secure_repo-1.3.0/secure_repo/benchmark/corpus/js_false_positives.js +32 -0
- secure_repo-1.3.0/secure_repo/benchmark/corpus/js_flow.js +23 -0
- secure_repo-1.3.0/secure_repo/benchmark/corpus/python_false_positives.py +39 -0
- secure_repo-1.3.0/secure_repo/benchmark/corpus/python_taint.py +62 -0
- secure_repo-1.3.0/secure_repo/benchmark/examples.py +161 -0
- secure_repo-1.3.0/secure_repo/benchmark/extdata/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/benchmark/extdata/dvpwa.toml +108 -0
- secure_repo-1.3.0/secure_repo/benchmark/extdata/flask-vuln.toml +158 -0
- secure_repo-1.3.0/secure_repo/benchmark/extdata/nodegoat.toml +216 -0
- secure_repo-1.3.0/secure_repo/benchmark/extdata/requests.toml +95 -0
- secure_repo-1.3.0/secure_repo/benchmark/external.py +232 -0
- secure_repo-1.3.0/secure_repo/cli/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/cli/banner.py +221 -0
- secure_repo-1.3.0/secure_repo/cli/dashboard.py +253 -0
- secure_repo-1.3.0/secure_repo/cli/learning.py +307 -0
- secure_repo-1.3.0/secure_repo/cli/main.py +451 -0
- secure_repo-1.3.0/secure_repo/cli/menu.py +514 -0
- secure_repo-1.3.0/secure_repo/cli/theme.py +92 -0
- secure_repo-1.3.0/secure_repo/cli/updates.py +115 -0
- secure_repo-1.3.0/secure_repo/cli/views.py +529 -0
- secure_repo-1.3.0/secure_repo/core/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/core/benchmark.py +108 -0
- secure_repo-1.3.0/secure_repo/core/checks.py +261 -0
- secure_repo-1.3.0/secure_repo/core/compliance.py +303 -0
- secure_repo-1.3.0/secure_repo/core/confidence.py +78 -0
- secure_repo-1.3.0/secure_repo/core/config.py +237 -0
- secure_repo-1.3.0/secure_repo/core/deps.py +783 -0
- secure_repo-1.3.0/secure_repo/core/events.py +56 -0
- secure_repo-1.3.0/secure_repo/core/gitops.py +427 -0
- secure_repo-1.3.0/secure_repo/core/intel.py +303 -0
- secure_repo-1.3.0/secure_repo/core/jsflow.py +275 -0
- secure_repo-1.3.0/secure_repo/core/languages.py +67 -0
- secure_repo-1.3.0/secure_repo/core/lexer.py +152 -0
- secure_repo-1.3.0/secure_repo/core/models.py +185 -0
- secure_repo-1.3.0/secure_repo/core/netio.py +269 -0
- secure_repo-1.3.0/secure_repo/core/pyast.py +681 -0
- secure_repo-1.3.0/secure_repo/core/redos.py +121 -0
- secure_repo-1.3.0/secure_repo/core/regions.py +64 -0
- secure_repo-1.3.0/secure_repo/core/resolver.py +274 -0
- secure_repo-1.3.0/secure_repo/core/review.py +71 -0
- secure_repo-1.3.0/secure_repo/core/rules.py +258 -0
- secure_repo-1.3.0/secure_repo/core/scan_analysis.py +476 -0
- secure_repo-1.3.0/secure_repo/core/scan_base.py +77 -0
- secure_repo-1.3.0/secure_repo/core/scan_common.py +80 -0
- secure_repo-1.3.0/secure_repo/core/scan_dependencies.py +253 -0
- secure_repo-1.3.0/secure_repo/core/scan_quality.py +225 -0
- secure_repo-1.3.0/secure_repo/core/scanner.py +265 -0
- secure_repo-1.3.0/secure_repo/core/scoring.py +56 -0
- secure_repo-1.3.0/secure_repo/core/summary.py +157 -0
- secure_repo-1.3.0/secure_repo/core/thirdparty.py +49 -0
- secure_repo-1.3.0/secure_repo/core/triage.py +340 -0
- secure_repo-1.3.0/secure_repo/core/updater.py +409 -0
- secure_repo-1.3.0/secure_repo/core/versions.py +257 -0
- secure_repo-1.3.0/secure_repo/core/walker.py +300 -0
- secure_repo-1.3.0/secure_repo/core/webchecks.py +134 -0
- secure_repo-1.3.0/secure_repo/core/workspace.py +105 -0
- secure_repo-1.3.0/secure_repo/data/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/data/packages.json +45 -0
- secure_repo-1.3.0/secure_repo/gui/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/gui/server.py +493 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-drawer.js +251 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-extras.js +208 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-main.js +43 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-results.js +240 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-scan.js +186 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-setup.js +221 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-state.js +44 -0
- secure_repo-1.3.0/secure_repo/gui/static/app-views.js +264 -0
- secure_repo-1.3.0/secure_repo/gui/static/app.css +588 -0
- secure_repo-1.3.0/secure_repo/gui/static/boxmap.js +215 -0
- secure_repo-1.3.0/secure_repo/gui/static/core.js +194 -0
- secure_repo-1.3.0/secure_repo/gui/static/index.html +302 -0
- secure_repo-1.3.0/secure_repo/gui/static/neural.js +586 -0
- secure_repo-1.3.0/secure_repo/report/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/report/formats.py +497 -0
- secure_repo-1.3.0/secure_repo/report/html.py +62 -0
- secure_repo-1.3.0/secure_repo/report/writer.py +232 -0
- secure_repo-1.3.0/secure_repo/ruledata/__init__.py +1 -0
- secure_repo-1.3.0/secure_repo/ruledata/c.toml +206 -0
- secure_repo-1.3.0/secure_repo/ruledata/ci.toml +197 -0
- secure_repo-1.3.0/secure_repo/ruledata/cs.toml +164 -0
- secure_repo-1.3.0/secure_repo/ruledata/dep.toml +297 -0
- secure_repo-1.3.0/secure_repo/ruledata/docker.toml +143 -0
- secure_repo-1.3.0/secure_repo/ruledata/gen.toml +386 -0
- secure_repo-1.3.0/secure_repo/ruledata/go.toml +216 -0
- secure_repo-1.3.0/secure_repo/ruledata/hyg.toml +182 -0
- secure_repo-1.3.0/secure_repo/ruledata/iac.toml +195 -0
- secure_repo-1.3.0/secure_repo/ruledata/java.toml +257 -0
- secure_repo-1.3.0/secure_repo/ruledata/js.toml +743 -0
- secure_repo-1.3.0/secure_repo/ruledata/k8s.toml +184 -0
- secure_repo-1.3.0/secure_repo/ruledata/mob.toml +142 -0
- secure_repo-1.3.0/secure_repo/ruledata/php.toml +244 -0
- secure_repo-1.3.0/secure_repo/ruledata/pii.toml +56 -0
- secure_repo-1.3.0/secure_repo/ruledata/py.toml +768 -0
- secure_repo-1.3.0/secure_repo/ruledata/rb.toml +180 -0
- secure_repo-1.3.0/secure_repo/ruledata/rs.toml +61 -0
- secure_repo-1.3.0/secure_repo/ruledata/sec.toml +592 -0
- secure_repo-1.3.0/secure_repo/ruledata/sh.toml +161 -0
- secure_repo-1.3.0/secure_repo/ruledata/web.toml +64 -0
- secure_repo-1.3.0/secure_repo.egg-info/PKG-INFO +145 -0
- secure_repo-1.3.0/secure_repo.egg-info/SOURCES.txt +137 -0
- secure_repo-1.3.0/secure_repo.egg-info/dependency_links.txt +1 -0
- secure_repo-1.3.0/secure_repo.egg-info/entry_points.txt +2 -0
- secure_repo-1.3.0/secure_repo.egg-info/requires.txt +11 -0
- secure_repo-1.3.0/secure_repo.egg-info/top_level.txt +1 -0
- secure_repo-1.3.0/setup.cfg +4 -0
- secure_repo-1.3.0/tests/test_ci_modes.py +319 -0
- secure_repo-1.3.0/tests/test_cli.py +194 -0
- secure_repo-1.3.0/tests/test_components.py +135 -0
- secure_repo-1.3.0/tests/test_deps_formats.py +183 -0
- secure_repo-1.3.0/tests/test_engines.py +130 -0
- secure_repo-1.3.0/tests/test_external_benchmark.py +95 -0
- secure_repo-1.3.0/tests/test_gui_flow.py +146 -0
- secure_repo-1.3.0/tests/test_gui_server.py +64 -0
- secure_repo-1.3.0/tests/test_gui_static.py +123 -0
- secure_repo-1.3.0/tests/test_hardening.py +228 -0
- secure_repo-1.3.0/tests/test_integrity.py +236 -0
- secure_repo-1.3.0/tests/test_intel.py +177 -0
- secure_repo-1.3.0/tests/test_learning.py +132 -0
- secure_repo-1.3.0/tests/test_netio.py +293 -0
- secure_repo-1.3.0/tests/test_parallel.py +102 -0
- secure_repo-1.3.0/tests/test_precision.py +318 -0
- secure_repo-1.3.0/tests/test_release_and_docs.py +186 -0
- secure_repo-1.3.0/tests/test_repo_hygiene.py +68 -0
- secure_repo-1.3.0/tests/test_report_safety.py +70 -0
- secure_repo-1.3.0/tests/test_rules_data.py +117 -0
- secure_repo-1.3.0/tests/test_scan_performance.py +51 -0
- secure_repo-1.3.0/tests/test_scanner.py +114 -0
- secure_repo-1.3.0/tests/test_scoring.py +70 -0
- secure_repo-1.3.0/tests/test_updates_and_auth.py +140 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
SECURE REPO ETHICAL SOURCE-AVAILABLE LICENSE
|
|
2
|
+
Version 1.0
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Wissen01720. All rights reserved.
|
|
5
|
+
|
|
6
|
+
Secure Repo (the "Software") is the exclusive intellectual property of Wissen01720 (the "Author").
|
|
7
|
+
This is NOT an open-source license. The Software is made available to the public under the terms
|
|
8
|
+
below. By downloading, installing, copying, running or otherwise using the Software you ("You")
|
|
9
|
+
accept these terms. If You do not accept them, You may not use the Software.
|
|
10
|
+
|
|
11
|
+
1. OWNERSHIP
|
|
12
|
+
|
|
13
|
+
1.1 The Author is and remains the sole owner and the only author of the Software, including its
|
|
14
|
+
source code, detection rules, documentation, visual design and every derivative of them.
|
|
15
|
+
1.2 No ownership, authorship or other right is transferred to You except the limited license
|
|
16
|
+
expressly granted in Section 2. All rights not expressly granted are reserved by the Author.
|
|
17
|
+
|
|
18
|
+
2. LICENSE GRANT
|
|
19
|
+
|
|
20
|
+
Subject to full and continuous compliance with this license, the Author grants You a worldwide,
|
|
21
|
+
royalty-free, non-exclusive, non-transferable, non-sublicensable and revocable license to:
|
|
22
|
+
|
|
23
|
+
a) download, install and run the Software on devices You control;
|
|
24
|
+
b) read and study the source code, and modify it for Your own private or internal use;
|
|
25
|
+
c) use the reports produced by the Software for any lawful purpose, including internal
|
|
26
|
+
security reviews, remediation work and compliance evidence, also within a company;
|
|
27
|
+
d) share an unmodified copy of the Software, provided that this LICENSE file, the copyright
|
|
28
|
+
notice and the attribution to the Author are kept intact and no fee is charged for it.
|
|
29
|
+
|
|
30
|
+
3. LAWFUL AND AUTHORIZED USE ONLY
|
|
31
|
+
|
|
32
|
+
You may use the Software only against repositories, source code and systems that You own or
|
|
33
|
+
that You are explicitly authorized, in writing, to assess. You are solely responsible for
|
|
34
|
+
complying with every law, regulation, contract and policy that applies to Your use, including
|
|
35
|
+
computer misuse, privacy, data protection and intellectual property laws.
|
|
36
|
+
|
|
37
|
+
4. PROHIBITED USES
|
|
38
|
+
|
|
39
|
+
You must NOT, directly or indirectly, and must not allow anyone else to:
|
|
40
|
+
|
|
41
|
+
a) use the Software to access, clone, scan or analyze any repository, code or system without
|
|
42
|
+
the permission of its owner;
|
|
43
|
+
b) steal, extract, collect, store, publish, sell or otherwise misuse secrets, credentials,
|
|
44
|
+
keys, tokens, personal data, trade secrets or any other information discovered with the
|
|
45
|
+
Software, beyond what is strictly necessary to report and fix it for its rightful owner;
|
|
46
|
+
c) use the Software or its results to exploit vulnerabilities, gain unauthorized access,
|
|
47
|
+
develop or distribute malware, commit fraud, extortion, espionage or any other unlawful act;
|
|
48
|
+
d) use the Software to monitor, profile, harass or harm any individual;
|
|
49
|
+
e) remove, hide or alter the copyright notice, this license, the authorship attribution or the
|
|
50
|
+
ethical-use safeguards built into the Software (such as secret redaction and the
|
|
51
|
+
authorization confirmation);
|
|
52
|
+
f) claim authorship of the Software, present it as Your own work, or register any right over it;
|
|
53
|
+
g) sell, rent, lease, sublicense, or offer the Software or a modified version of it as a paid
|
|
54
|
+
product or as a hosted/online service, without the Author's prior written permission;
|
|
55
|
+
h) publicly distribute modified versions of the Software without the Author's prior written
|
|
56
|
+
permission.
|
|
57
|
+
|
|
58
|
+
5. CONTRIBUTIONS
|
|
59
|
+
|
|
60
|
+
The Author has no obligation to accept, review or merge contributions of any kind. Any
|
|
61
|
+
material You voluntarily submit to the Author may be used, changed or discarded by the Author
|
|
62
|
+
without any obligation, attribution or compensation.
|
|
63
|
+
|
|
64
|
+
6. TERMINATION
|
|
65
|
+
|
|
66
|
+
This license terminates automatically and immediately, without notice, if You breach any of its
|
|
67
|
+
terms. Upon termination You must stop using the Software and destroy every copy in Your
|
|
68
|
+
possession. Sections 1, 4, 7 and 8 survive termination.
|
|
69
|
+
|
|
70
|
+
7. NO WARRANTY
|
|
71
|
+
|
|
72
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
73
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, ACCURACY AND
|
|
74
|
+
NON-INFRINGEMENT. Automated security analysis can produce false positives and false negatives;
|
|
75
|
+
the absence of findings does not mean that the audited software is secure. Compliance results
|
|
76
|
+
are technical evidence only and are not a certification, attestation or legal advice.
|
|
77
|
+
|
|
78
|
+
8. LIMITATION OF LIABILITY
|
|
79
|
+
|
|
80
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
81
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE,
|
|
82
|
+
ITS RESULTS OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. You are solely responsible for how
|
|
83
|
+
You use the Software and for any consequence of that use.
|
|
84
|
+
|
|
85
|
+
9. PERMISSIONS
|
|
86
|
+
|
|
87
|
+
Requests for permissions not granted by this license (commercial use as a product or service,
|
|
88
|
+
redistribution of modified versions, etc.) must be addressed to the Author, Wissen01720.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: secure-repo
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: Repository security auditor with a hacker-style CLI and a neural-map GUI: static analysis, secrets, library vulnerabilities, supply chain and optional compliance evidence.
|
|
5
|
+
Author: Wissen01720
|
|
6
|
+
License-Expression: LicenseRef-SecureRepo-Ethical-Source-Available
|
|
7
|
+
Keywords: security,sast,secrets,sbom,vulnerability,compliance,audit,git
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
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: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: rich>=13.0
|
|
27
|
+
Requires-Dist: defusedxml>=0.7
|
|
28
|
+
Requires-Dist: tomli>=1.1; python_version < "3.11"
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
<div align="center">
|
|
37
|
+
|
|
38
|
+
# SECURE//REPO
|
|
39
|
+
|
|
40
|
+
**Repository security auditor with a command-line console and a neural-map GUI.**
|
|
41
|
+
|
|
42
|
+
Static code analysis · secret detection · library & supply-chain intelligence · repository structure mapping ·
|
|
43
|
+
optional compliance evidence (OWASP, PCI DSS, ISO 27001, SOC 2, GDPR, HIPAA, NIST SSDF)
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
<img src="docs/images/cli-banner.svg" alt="Secure Repo CLI banner and boot sequence" width="900">
|
|
52
|
+
|
|
53
|
+
[Español](README.es.md) · [Documentation](#documentation) · [Changelog](CHANGELOG.md)
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## What it does
|
|
60
|
+
|
|
61
|
+
Point it at a Git repository (the one you are in, a local path or a Git URL, including private ones) and it audits it
|
|
62
|
+
**read-only**: it never runs the audited code and never installs its dependencies.
|
|
63
|
+
|
|
64
|
+
| Capability | Details |
|
|
65
|
+
|---|---|
|
|
66
|
+
| **Static analysis** | 175 rules for Python, JavaScript/TypeScript, Java/Kotlin, C#, PHP, Go, Ruby, C/C++, Rust, shell, Dockerfiles, Kubernetes, Terraform and CI pipelines. Python gets syntax-tree analysis with taint tracking, JavaScript/TypeScript a data-flow pass. |
|
|
67
|
+
| **Secrets** | Cloud keys, tokens, private keys, connection strings, high-entropy credentials, sensitive files. Always redacted in the output. |
|
|
68
|
+
| **Libraries** | 25+ manifest and lock formats; every library checked against OSV.dev and deps.dev; versions resolved even without a lockfile. Private package names can be kept off the network. |
|
|
69
|
+
| **Reports** | A timestamped folder with HTML, JSON, SARIF, Markdown, CSV, a CycloneDX SBOM and an integrity manifest, written outside the audited repository by default. |
|
|
70
|
+
| **Console and GUI** | A live terminal dashboard (`--theme plain` for a sober one) and a local web app with a neural map and a structure treemap that explain each weakness and its fix. |
|
|
71
|
+
| **CI-friendly** | `--fail-on`, `--baseline` (fail only on new findings), `--since origin/main` (only changed files), SARIF for code scanning. |
|
|
72
|
+
| **Learns from you** | Mark false positives and accepted risks once; they are re-applied on every scan. |
|
|
73
|
+
| **Optional compliance evidence** | Maps findings to 7 frameworks as supporting evidence, never as a certification. |
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/Wissen01720/Secure_Repo.git
|
|
79
|
+
cd Secure_Repo
|
|
80
|
+
./run.sh scan /path/to/repo # Windows: .\run.bat scan C:\path\to\repo
|
|
81
|
+
./run.sh gui # the graphical interface
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The launcher creates a private virtual environment on the first run. Inside a Git repository, `./run.sh` alone opens
|
|
85
|
+
the interactive console. Python 3.10 or newer and Git are required. More options (pipx, from source, updating):
|
|
86
|
+
[Installation](docs/installation.md).
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
secure-repo scan . --yes --plain --no-menu --baseline baseline.json --fail-on high # a CI gate for new problems only
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## How accurate is it?
|
|
93
|
+
|
|
94
|
+
Measured on code the authors did not write: four public projects pinned to a commit (NodeGoat, DVPWA,
|
|
95
|
+
Vulnerable-Flask-App and the clean library `requests`), every finding reviewed by hand.
|
|
96
|
+
|
|
97
|
+
| | Result |
|
|
98
|
+
|---|---|
|
|
99
|
+
| Precision, findings of medium/high confidence | **73 %** |
|
|
100
|
+
| Precision, every finding (tests and low confidence included) | 60 % |
|
|
101
|
+
| Documented weaknesses found | **26 of 28 (93 %)** |
|
|
102
|
+
|
|
103
|
+
Small sample, so read it as a floor of evidence and not as a guarantee: the details, the misses and how to reproduce
|
|
104
|
+
it are in [How the analysis works](docs/analysis.md#how-accurate-is-it-measured-on-third-party-code). The limits of
|
|
105
|
+
a static analyzer (what it cannot see) are in [Privacy, trust model and limitations](docs/security-model.md).
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
108
|
+
|
|
109
|
+
| Document | What is in it |
|
|
110
|
+
|---|---|
|
|
111
|
+
| [Installation](docs/installation.md) | Requirements, launchers, pipx, from source, in-place updates |
|
|
112
|
+
| [Command-line guide](docs/cli-guide.md) | Step by step walkthrough, CI/CD usage, private and organization repositories |
|
|
113
|
+
| [How the analysis works](docs/analysis.md) | Engines, accuracy, languages, scoring, false-positive reduction, compliance |
|
|
114
|
+
| [Command and report reference](docs/reference.md) | Every flag and every file of a report folder |
|
|
115
|
+
| [Graphical interface](docs/gui.md) | The neural map, structure boxes, triage and downloads |
|
|
116
|
+
| [Privacy, trust model and limitations](docs/security-model.md) | What leaves your machine, how the audited repository is treated, suppressions, limits |
|
|
117
|
+
| [Troubleshooting](docs/troubleshooting.md) | Common problems and fixes |
|
|
118
|
+
| [Development](docs/development.md) | Project layout, tests, adding a rule |
|
|
119
|
+
| [Releasing](docs/releasing.md) | Versions, tags, GitHub releases and publishing to PyPI |
|
|
120
|
+
|
|
121
|
+
<p align="center"><img src="docs/images/gui-neural-map.png" alt="The neural map of a scan" width="860"></p>
|
|
122
|
+
|
|
123
|
+
## Rules of engagement
|
|
124
|
+
|
|
125
|
+
> **Only audit repositories you own or have explicit, written permission to assess.**
|
|
126
|
+
|
|
127
|
+
Secure Repo is built for defenders and enforces that posture:
|
|
128
|
+
|
|
129
|
+
- It **never executes** the audited code, never installs its dependencies and never exploits a finding.
|
|
130
|
+
- It asks you to **confirm your authorization** before every engagement (`--yes` confirms it in automation).
|
|
131
|
+
- Detected secrets are **redacted** in the terminal, the GUI and every report.
|
|
132
|
+
- Git runs hardened: hooks disabled, `ext::` transport blocked, shallow clones, LFS downloads skipped.
|
|
133
|
+
|
|
134
|
+
Using the tool to steal information or for any malicious purpose is forbidden by the [license](LICENSE).
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
Copyright © 2026 **Wissen01720**. All rights reserved.
|
|
139
|
+
|
|
140
|
+
Secure Repo is distributed under the **Secure Repo Ethical Source-Available License**: you may use it, study it
|
|
141
|
+
and use its reports (also inside your company) for lawful, authorized security work. You may **not** use it to
|
|
142
|
+
access code without permission, steal or misuse the information it finds, attack systems, remove the
|
|
143
|
+
attribution, claim authorship, sell it or publish modified versions without permission. Read the full
|
|
144
|
+
[LICENSE](LICENSE). It is *source-available*, not open source: if your organization requires an OSI-approved license,
|
|
145
|
+
contact the author.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# SECURE//REPO
|
|
4
|
+
|
|
5
|
+
**Repository security auditor with a command-line console and a neural-map GUI.**
|
|
6
|
+
|
|
7
|
+
Static code analysis · secret detection · library & supply-chain intelligence · repository structure mapping ·
|
|
8
|
+
optional compliance evidence (OWASP, PCI DSS, ISO 27001, SOC 2, GDPR, HIPAA, NIST SSDF)
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
<img src="docs/images/cli-banner.svg" alt="Secure Repo CLI banner and boot sequence" width="900">
|
|
17
|
+
|
|
18
|
+
[Español](README.es.md) · [Documentation](#documentation) · [Changelog](CHANGELOG.md)
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## What it does
|
|
25
|
+
|
|
26
|
+
Point it at a Git repository (the one you are in, a local path or a Git URL, including private ones) and it audits it
|
|
27
|
+
**read-only**: it never runs the audited code and never installs its dependencies.
|
|
28
|
+
|
|
29
|
+
| Capability | Details |
|
|
30
|
+
|---|---|
|
|
31
|
+
| **Static analysis** | 175 rules for Python, JavaScript/TypeScript, Java/Kotlin, C#, PHP, Go, Ruby, C/C++, Rust, shell, Dockerfiles, Kubernetes, Terraform and CI pipelines. Python gets syntax-tree analysis with taint tracking, JavaScript/TypeScript a data-flow pass. |
|
|
32
|
+
| **Secrets** | Cloud keys, tokens, private keys, connection strings, high-entropy credentials, sensitive files. Always redacted in the output. |
|
|
33
|
+
| **Libraries** | 25+ manifest and lock formats; every library checked against OSV.dev and deps.dev; versions resolved even without a lockfile. Private package names can be kept off the network. |
|
|
34
|
+
| **Reports** | A timestamped folder with HTML, JSON, SARIF, Markdown, CSV, a CycloneDX SBOM and an integrity manifest, written outside the audited repository by default. |
|
|
35
|
+
| **Console and GUI** | A live terminal dashboard (`--theme plain` for a sober one) and a local web app with a neural map and a structure treemap that explain each weakness and its fix. |
|
|
36
|
+
| **CI-friendly** | `--fail-on`, `--baseline` (fail only on new findings), `--since origin/main` (only changed files), SARIF for code scanning. |
|
|
37
|
+
| **Learns from you** | Mark false positives and accepted risks once; they are re-applied on every scan. |
|
|
38
|
+
| **Optional compliance evidence** | Maps findings to 7 frameworks as supporting evidence, never as a certification. |
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/Wissen01720/Secure_Repo.git
|
|
44
|
+
cd Secure_Repo
|
|
45
|
+
./run.sh scan /path/to/repo # Windows: .\run.bat scan C:\path\to\repo
|
|
46
|
+
./run.sh gui # the graphical interface
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The launcher creates a private virtual environment on the first run. Inside a Git repository, `./run.sh` alone opens
|
|
50
|
+
the interactive console. Python 3.10 or newer and Git are required. More options (pipx, from source, updating):
|
|
51
|
+
[Installation](docs/installation.md).
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
secure-repo scan . --yes --plain --no-menu --baseline baseline.json --fail-on high # a CI gate for new problems only
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## How accurate is it?
|
|
58
|
+
|
|
59
|
+
Measured on code the authors did not write: four public projects pinned to a commit (NodeGoat, DVPWA,
|
|
60
|
+
Vulnerable-Flask-App and the clean library `requests`), every finding reviewed by hand.
|
|
61
|
+
|
|
62
|
+
| | Result |
|
|
63
|
+
|---|---|
|
|
64
|
+
| Precision, findings of medium/high confidence | **73 %** |
|
|
65
|
+
| Precision, every finding (tests and low confidence included) | 60 % |
|
|
66
|
+
| Documented weaknesses found | **26 of 28 (93 %)** |
|
|
67
|
+
|
|
68
|
+
Small sample, so read it as a floor of evidence and not as a guarantee: the details, the misses and how to reproduce
|
|
69
|
+
it are in [How the analysis works](docs/analysis.md#how-accurate-is-it-measured-on-third-party-code). The limits of
|
|
70
|
+
a static analyzer (what it cannot see) are in [Privacy, trust model and limitations](docs/security-model.md).
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
| Document | What is in it |
|
|
75
|
+
|---|---|
|
|
76
|
+
| [Installation](docs/installation.md) | Requirements, launchers, pipx, from source, in-place updates |
|
|
77
|
+
| [Command-line guide](docs/cli-guide.md) | Step by step walkthrough, CI/CD usage, private and organization repositories |
|
|
78
|
+
| [How the analysis works](docs/analysis.md) | Engines, accuracy, languages, scoring, false-positive reduction, compliance |
|
|
79
|
+
| [Command and report reference](docs/reference.md) | Every flag and every file of a report folder |
|
|
80
|
+
| [Graphical interface](docs/gui.md) | The neural map, structure boxes, triage and downloads |
|
|
81
|
+
| [Privacy, trust model and limitations](docs/security-model.md) | What leaves your machine, how the audited repository is treated, suppressions, limits |
|
|
82
|
+
| [Troubleshooting](docs/troubleshooting.md) | Common problems and fixes |
|
|
83
|
+
| [Development](docs/development.md) | Project layout, tests, adding a rule |
|
|
84
|
+
| [Releasing](docs/releasing.md) | Versions, tags, GitHub releases and publishing to PyPI |
|
|
85
|
+
|
|
86
|
+
<p align="center"><img src="docs/images/gui-neural-map.png" alt="The neural map of a scan" width="860"></p>
|
|
87
|
+
|
|
88
|
+
## Rules of engagement
|
|
89
|
+
|
|
90
|
+
> **Only audit repositories you own or have explicit, written permission to assess.**
|
|
91
|
+
|
|
92
|
+
Secure Repo is built for defenders and enforces that posture:
|
|
93
|
+
|
|
94
|
+
- It **never executes** the audited code, never installs its dependencies and never exploits a finding.
|
|
95
|
+
- It asks you to **confirm your authorization** before every engagement (`--yes` confirms it in automation).
|
|
96
|
+
- Detected secrets are **redacted** in the terminal, the GUI and every report.
|
|
97
|
+
- Git runs hardened: hooks disabled, `ext::` transport blocked, shallow clones, LFS downloads skipped.
|
|
98
|
+
|
|
99
|
+
Using the tool to steal information or for any malicious purpose is forbidden by the [license](LICENSE).
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
Copyright © 2026 **Wissen01720**. All rights reserved.
|
|
104
|
+
|
|
105
|
+
Secure Repo is distributed under the **Secure Repo Ethical Source-Available License**: you may use it, study it
|
|
106
|
+
and use its reports (also inside your company) for lawful, authorized security work. You may **not** use it to
|
|
107
|
+
access code without permission, steal or misuse the information it finds, attack systems, remove the
|
|
108
|
+
attribution, claim authorship, sell it or publish modified versions without permission. Read the full
|
|
109
|
+
[LICENSE](LICENSE). It is *source-available*, not open source: if your organization requires an OSI-approved license,
|
|
110
|
+
contact the author.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "secure-repo"
|
|
7
|
+
version = "1.3.0"
|
|
8
|
+
description = "Repository security auditor with a hacker-style CLI and a neural-map GUI: static analysis, secrets, library vulnerabilities, supply chain and optional compliance evidence."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "LicenseRef-SecureRepo-Ethical-Source-Available"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "Wissen01720" }]
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"rich>=13.0",
|
|
16
|
+
"defusedxml>=0.7",
|
|
17
|
+
"tomli>=1.1; python_version < '3.11'",
|
|
18
|
+
]
|
|
19
|
+
keywords = ["security", "sast", "secrets", "sbom", "vulnerability", "compliance", "audit", "git"]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 4 - Beta",
|
|
22
|
+
"Environment :: Console",
|
|
23
|
+
"Environment :: Web Environment",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"Intended Audience :: Information Technology",
|
|
26
|
+
"Operating System :: Microsoft :: Windows",
|
|
27
|
+
"Operating System :: MacOS",
|
|
28
|
+
"Operating System :: POSIX :: Linux",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Topic :: Security",
|
|
35
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = ["pytest>=7", "pytest-cov>=4", "ruff>=0.5", "mypy>=1.10"]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
secure-repo = "secure_repo.cli.main:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
include = ["secure_repo*"]
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.package-data]
|
|
48
|
+
"secure_repo.gui" = ["static/*"]
|
|
49
|
+
"secure_repo.benchmark" = ["corpus/*"]
|
|
50
|
+
"secure_repo.ruledata" = ["*.toml"]
|
|
51
|
+
"secure_repo.data" = ["*.json"]
|
|
52
|
+
"secure_repo.benchmark.extdata" = ["*.toml"]
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
|
|
57
|
+
# ---------------------------------------------------------------------------------------------- lint
|
|
58
|
+
[tool.ruff]
|
|
59
|
+
line-length = 120
|
|
60
|
+
target-version = "py310"
|
|
61
|
+
extend-exclude = ["secure_repo/benchmark/corpus"] # deliberately vulnerable / false-positive samples
|
|
62
|
+
|
|
63
|
+
[tool.ruff.lint]
|
|
64
|
+
select = ["E", "F", "W", "B", "UP", "S"]
|
|
65
|
+
ignore = [
|
|
66
|
+
"E501", # long lines: the rule tables are one-liners on purpose
|
|
67
|
+
"S603", "S607", # git / pip are started with argument lists, never through a shell
|
|
68
|
+
"S310", # urlopen is only used with fixed https endpoints
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint.per-file-ignores]
|
|
72
|
+
"tests/*" = ["S"] # asserts, fixtures with fake secrets, temp paths
|
|
73
|
+
"secure_repo/core/rules.py" = ["S"] # detection signatures, not executable code
|
|
74
|
+
"secure_repo/core/checks.py" = ["S"]
|
|
75
|
+
|
|
76
|
+
# ---------------------------------------------------------------------------------------------- types
|
|
77
|
+
[tool.mypy]
|
|
78
|
+
python_version = "3.10"
|
|
79
|
+
ignore_missing_imports = true
|
|
80
|
+
warn_unused_ignores = false
|
|
81
|
+
exclude = ["secure_repo/benchmark/corpus/"]
|
|
82
|
+
|
|
83
|
+
# Type debt: these modules still have errors. Remove a module from this list when it is fixed; new modules
|
|
84
|
+
# are type-checked from the first commit.
|
|
85
|
+
[[tool.mypy.overrides]]
|
|
86
|
+
module = [
|
|
87
|
+
"secure_repo.core.triage", "secure_repo.core.updater", "secure_repo.core.pyast",
|
|
88
|
+
"secure_repo.core.versions", "secure_repo.core.checks", "secure_repo.core.compliance", "secure_repo.core.deps",
|
|
89
|
+
"secure_repo.core.gitops", "secure_repo.core.intel", "secure_repo.core.summary", "secure_repo.core.walker",
|
|
90
|
+
"secure_repo.cli.views", "secure_repo.cli.learning", "secure_repo.cli.dashboard", "secure_repo.gui.server",
|
|
91
|
+
]
|
|
92
|
+
ignore_errors = true
|
|
93
|
+
|
|
94
|
+
# ---------------------------------------------------------------------------------------------- coverage
|
|
95
|
+
[tool.coverage.run]
|
|
96
|
+
source = ["secure_repo"]
|
|
97
|
+
omit = ["secure_repo/benchmark/corpus/*"]
|
|
98
|
+
|
|
99
|
+
[tool.coverage.report]
|
|
100
|
+
# Measured at about 75 %. The gate is a little lower so platform differences do not make CI flaky;
|
|
101
|
+
# raise it as coverage grows (the CLI menus and the update flow are the least tested parts).
|
|
102
|
+
fail_under = 70
|
|
103
|
+
show_missing = false
|
|
104
|
+
skip_covered = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Labeled corpus used by ``secure-repo benchmark`` to measure precision and recall."""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import javax.crypto.Cipher;
|
|
2
|
+
|
|
3
|
+
class JavaCases {
|
|
4
|
+
void run(String user) throws Exception {
|
|
5
|
+
Runtime.getRuntime().exec("ping " + user); // expect: SR-JAVA-001
|
|
6
|
+
Cipher weak = Cipher.getInstance("DES"); // expect: SR-JAVA-004
|
|
7
|
+
// Runtime.getRuntime().exec(command) inside a comment must not match
|
|
8
|
+
String doc = "Never call Runtime.getRuntime().exec(input)";
|
|
9
|
+
/* Cipher.getInstance("DES") in a block comment must not match */
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
resource "aws_s3_bucket_acl" "logs" {
|
|
2
|
+
acl = "public-read" # expect: SR-IAC-002
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
resource "aws_db_instance" "database" {
|
|
6
|
+
publicly_accessible = true # expect: SR-IAC-004
|
|
7
|
+
storage_encrypted = false # expect: SR-IAC-003
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
resource "aws_security_group_rule" "ssh" {
|
|
11
|
+
cidr_blocks = ["0.0.0.0/0"] # expect: SR-IAC-001
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// expect-none: SR-JS-001, SR-JS-002, SR-JS-007, SR-JS-008, SR-JS-009, SR-JS-011
|
|
2
|
+
const { exec } = require('child_process');
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Never call eval(userInput) here.
|
|
6
|
+
* el.innerHTML = userInput is forbidden.
|
|
7
|
+
*/
|
|
8
|
+
function ui() {
|
|
9
|
+
document.getElementById('status').innerHTML = '';
|
|
10
|
+
document.getElementById('spinner').innerHTML = '<span class="spin"></span>';
|
|
11
|
+
const pattern = /[a-z]+/g;
|
|
12
|
+
const match = pattern.exec(window.title);
|
|
13
|
+
console.log("never use eval(code) with untrusted input");
|
|
14
|
+
exec('git rev-parse HEAD');
|
|
15
|
+
return match;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function query(db) {
|
|
19
|
+
return db.query('SELECT * FROM users WHERE active = ?', [true]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Taint must not leak between functions that reuse short variable names.
|
|
23
|
+
function onMessage(msg) {
|
|
24
|
+
const e = JSON.parse(msg.data);
|
|
25
|
+
return e;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function schedule(e) {
|
|
29
|
+
setTimeout(() => refresh(e), 500);
|
|
30
|
+
setInterval(function () { poll(e); }, 1000);
|
|
31
|
+
return eval;
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
|
+
const express = require('express');
|
|
3
|
+
const app = express();
|
|
4
|
+
|
|
5
|
+
app.get('/ping', (req, res) => {
|
|
6
|
+
const host = req.query.host;
|
|
7
|
+
exec('ping -c 1 ' + host); // expect: SR-JS-008
|
|
8
|
+
const id = req.params.id;
|
|
9
|
+
db.query('SELECT * FROM users WHERE id = ' + id); // expect: SR-JS-011
|
|
10
|
+
res.redirect(req.query.next); // expect: SR-JS-018
|
|
11
|
+
res.send('<p>' + req.query.name + '</p>'); // expect: SR-JS-023
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
app.get('/file', (req, res) => {
|
|
15
|
+
const name = req.query.file;
|
|
16
|
+
res.sendFile(name); // expect: SR-JS-016
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function render() {
|
|
20
|
+
const fragment = location.hash.slice(1);
|
|
21
|
+
document.getElementById('out').innerHTML = fragment; // expect: SR-JS-002
|
|
22
|
+
eval(fragment); // expect: SR-JS-001
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# expect-none: SR-PY-001, SR-PY-002, SR-PY-003, SR-PY-004, SR-PY-005, SR-PY-009, SR-PY-011, SR-SEC-019
|
|
2
|
+
import os
|
|
3
|
+
import random
|
|
4
|
+
import subprocess
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
from sqlalchemy import text
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def documentation():
|
|
11
|
+
"""Never call eval(user_input) or pickle.loads(untrusted) in this module.
|
|
12
|
+
|
|
13
|
+
os.system(command) with user input is forbidden as well.
|
|
14
|
+
"""
|
|
15
|
+
message = "do not use os.system(command) or subprocess.call(cmd, shell=True)"
|
|
16
|
+
return message
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def safe_calls(user_id: int):
|
|
20
|
+
subprocess.run(["git", "status"], check=True)
|
|
21
|
+
os.system("clear")
|
|
22
|
+
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
|
|
23
|
+
session.execute(text("SELECT 1"))
|
|
24
|
+
config = yaml.safe_load(open("config.yml"))
|
|
25
|
+
data = yaml.load(open("other.yml"), Loader=yaml.SafeLoader)
|
|
26
|
+
retry_delay = random.uniform(0.5, 1.5)
|
|
27
|
+
sample = random.sample(range(10), 3)
|
|
28
|
+
value = eval("1 + 2")
|
|
29
|
+
return config, data, retry_delay, sample, value
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def placeholders():
|
|
33
|
+
password = "changeme"
|
|
34
|
+
api_key = os.environ["API_KEY"]
|
|
35
|
+
token_url = "https://auth.example.com/token"
|
|
36
|
+
secret_name = "prod/db/password"
|
|
37
|
+
return password, api_key, token_url, secret_name
|
|
38
|
+
|
|
39
|
+
# eval(request.args["x"]) <- commented-out code is not code
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pickle
|
|
3
|
+
import subprocess
|
|
4
|
+
|
|
5
|
+
import yaml
|
|
6
|
+
from flask import Flask, redirect, render_template_string, request
|
|
7
|
+
|
|
8
|
+
app = Flask(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@app.route("/ping")
|
|
12
|
+
def ping():
|
|
13
|
+
host = request.args.get("host", "")
|
|
14
|
+
command = "ping -c 1 " + host
|
|
15
|
+
subprocess.call(command, shell=True) # expect: SR-PY-004
|
|
16
|
+
os.system("echo " + host) # expect: SR-PY-005
|
|
17
|
+
return "ok"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@app.route("/user/<name>")
|
|
21
|
+
def user(name):
|
|
22
|
+
query = f"SELECT * FROM users WHERE name = '{name}'"
|
|
23
|
+
cursor.execute(query) # expect: SR-PY-011
|
|
24
|
+
return f"<h1>Hello {name}</h1>" # expect: SR-PY-024
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@app.route("/calc", methods=["POST"])
|
|
28
|
+
def calc():
|
|
29
|
+
expression = request.form["expr"]
|
|
30
|
+
return str(eval(expression)) # expect: SR-PY-001
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@app.route("/go")
|
|
34
|
+
def go():
|
|
35
|
+
return redirect(request.args["next"]) # expect: SR-PY-023
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@app.route("/render")
|
|
39
|
+
def render():
|
|
40
|
+
template = request.args.get("t", "")
|
|
41
|
+
return render_template_string(template) # expect: SR-PY-022
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@app.route("/file")
|
|
45
|
+
def read_file():
|
|
46
|
+
path = request.args["path"]
|
|
47
|
+
with open(path) as handle: # expect: SR-PY-018
|
|
48
|
+
return handle.read()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def load_blob(blob):
|
|
52
|
+
return pickle.loads(blob) # expect: SR-PY-002
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def load_config(path):
|
|
56
|
+
return yaml.load(open(path)) # expect: SR-PY-003
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def make_reset_token():
|
|
60
|
+
import random
|
|
61
|
+
reset_token = random.randint(100000, 999999) # expect: SR-PY-009
|
|
62
|
+
return reset_token
|