prufgate 1.0.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 (62) hide show
  1. prufgate-1.0.0/LICENSE +202 -0
  2. prufgate-1.0.0/NOTICE +17 -0
  3. prufgate-1.0.0/PKG-INFO +154 -0
  4. prufgate-1.0.0/README.md +122 -0
  5. prufgate-1.0.0/prufgate/__init__.py +7 -0
  6. prufgate-1.0.0/prufgate/anti_fabrication/__init__.py +1 -0
  7. prufgate-1.0.0/prufgate/anti_fabrication/detector.py +1384 -0
  8. prufgate-1.0.0/prufgate/anti_fabrication/packs/__init__.py +1 -0
  9. prufgate-1.0.0/prufgate/anti_fabrication/packs/cti.py +272 -0
  10. prufgate-1.0.0/prufgate/anti_reward_hacking/__init__.py +17 -0
  11. prufgate-1.0.0/prufgate/anti_reward_hacking/test_integrity.py +2371 -0
  12. prufgate-1.0.0/prufgate/api/__init__.py +1 -0
  13. prufgate-1.0.0/prufgate/api/server.py +807 -0
  14. prufgate-1.0.0/prufgate/bola/__init__.py +27 -0
  15. prufgate-1.0.0/prufgate/bola/bola_engine.py +1529 -0
  16. prufgate-1.0.0/prufgate/cli.py +683 -0
  17. prufgate-1.0.0/prufgate/config.py +411 -0
  18. prufgate-1.0.0/prufgate/contract_guard/__init__.py +297 -0
  19. prufgate-1.0.0/prufgate/contract_guard/dependency_guard.py +707 -0
  20. prufgate-1.0.0/prufgate/contract_guard/env_guard.py +157 -0
  21. prufgate-1.0.0/prufgate/contract_guard/route_contract.py +180 -0
  22. prufgate-1.0.0/prufgate/diff_guard/__init__.py +17 -0
  23. prufgate-1.0.0/prufgate/diff_guard/tamper_detector.py +1372 -0
  24. prufgate-1.0.0/prufgate/hooks/__init__.py +17 -0
  25. prufgate-1.0.0/prufgate/hooks/agent_hooks.py +207 -0
  26. prufgate-1.0.0/prufgate/mcp/__init__.py +1 -0
  27. prufgate-1.0.0/prufgate/mcp/prufgate_mcp_server.py +384 -0
  28. prufgate-1.0.0/prufgate/netguard.py +61 -0
  29. prufgate-1.0.0/prufgate/review/__init__.py +35 -0
  30. prufgate-1.0.0/prufgate/review/ai_adapter.py +328 -0
  31. prufgate-1.0.0/prufgate/review/reviewer.py +643 -0
  32. prufgate-1.0.0/prufgate/synthesizer/parse_results.py +845 -0
  33. prufgate-1.0.0/prufgate.egg-info/PKG-INFO +154 -0
  34. prufgate-1.0.0/prufgate.egg-info/SOURCES.txt +60 -0
  35. prufgate-1.0.0/prufgate.egg-info/dependency_links.txt +1 -0
  36. prufgate-1.0.0/prufgate.egg-info/entry_points.txt +3 -0
  37. prufgate-1.0.0/prufgate.egg-info/requires.txt +1 -0
  38. prufgate-1.0.0/prufgate.egg-info/top_level.txt +1 -0
  39. prufgate-1.0.0/pyproject.toml +62 -0
  40. prufgate-1.0.0/setup.cfg +4 -0
  41. prufgate-1.0.0/tests/test_ai_cli_invocation.py +82 -0
  42. prufgate-1.0.0/tests/test_anti_reward_hacking.py +264 -0
  43. prufgate-1.0.0/tests/test_api.py +310 -0
  44. prufgate-1.0.0/tests/test_ast_runner.py +94 -0
  45. prufgate-1.0.0/tests/test_bola_engine.py +202 -0
  46. prufgate-1.0.0/tests/test_bola_redirects.py +109 -0
  47. prufgate-1.0.0/tests/test_cli.py +140 -0
  48. prufgate-1.0.0/tests/test_config_self_exclusion.py +260 -0
  49. prufgate-1.0.0/tests/test_config_yaml.py +229 -0
  50. prufgate-1.0.0/tests/test_contract_base_ref.py +67 -0
  51. prufgate-1.0.0/tests/test_contract_guard.py +176 -0
  52. prufgate-1.0.0/tests/test_detector.py +122 -0
  53. prufgate-1.0.0/tests/test_diff_guard.py +189 -0
  54. prufgate-1.0.0/tests/test_engine13_audit.py +384 -0
  55. prufgate-1.0.0/tests/test_engines456_bugs.py +601 -0
  56. prufgate-1.0.0/tests/test_fail_closed_runner.py +420 -0
  57. prufgate-1.0.0/tests/test_mcp.py +190 -0
  58. prufgate-1.0.0/tests/test_public_repo_hygiene.py +271 -0
  59. prufgate-1.0.0/tests/test_report_hygiene.py +108 -0
  60. prufgate-1.0.0/tests/test_review_engine.py +106 -0
  61. prufgate-1.0.0/tests/test_synthesizer.py +177 -0
  62. prufgate-1.0.0/tests/test_workflows.py +125 -0
prufgate-1.0.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
prufgate-1.0.0/NOTICE ADDED
@@ -0,0 +1,17 @@
1
+ PrufGate
2
+ Copyright 2026 GuardianVigil
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (LICENSE).
5
+
6
+ The source distribution and the wheel bundle no third-party code. PrufGate
7
+ depends on PyYAML (MIT licence), which pip installs separately.
8
+
9
+ The container image (ghcr.io/guardianvigil-labs/prufgate) also contains, each
10
+ under its own licence:
11
+ - ast-grep, Copyright (c) 2022 Herrington Darkholme, MIT licence;
12
+ - gitleaks, Copyright (c) 2019 Zachary Rice, MIT licence;
13
+ - zizmor, Copyright (c) 2024 William Woodruff, MIT licence;
14
+ - PyYAML, MIT licence;
15
+ - the Python runtime and Debian packages of its base image
16
+ (python:3.14-slim-bookworm), under their respective licences; the image
17
+ SBOM, stored with the image in the registry, lists them.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: prufgate
3
+ Version: 1.0.0
4
+ Summary: Catches fabricated logic, hollow tests, guardrail tampering and BOLA in code written by people and AI agents
5
+ Author: PrufGate Maintainers
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/GuardianVigil-Labs/Prufgate
8
+ Project-URL: Documentation, https://github.com/GuardianVigil-Labs/Prufgate/tree/main/docs
9
+ Project-URL: Source, https://github.com/GuardianVigil-Labs/Prufgate
10
+ Project-URL: Issues, https://github.com/GuardianVigil-Labs/Prufgate/issues
11
+ Project-URL: Changelog, https://github.com/GuardianVigil-Labs/Prufgate/blob/main/CHANGELOG.md
12
+ Keywords: security,mcp,model-context-protocol,bola,idor,sast,code-review,anti-fabrication,anti-reward-hacking,test-integrity
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Security
24
+ Classifier: Topic :: Software Development :: Quality Assurance
25
+ Classifier: Topic :: Software Development :: Testing
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ License-File: NOTICE
30
+ Requires-Dist: PyYAML>=6.0
31
+ Dynamic: license-file
32
+
33
+ <!-- mcp-name: io.github.GuardianVigil-Labs/prufgate -->
34
+ <div align="center">
35
+ <img src="https://raw.githubusercontent.com/GuardianVigil-Labs/Prufgate/main/assets/prufgate-icon.svg" alt="PrufGate logo" width="128" />
36
+ <h1>PrufGate</h1>
37
+ <p><strong>Checks whether code, and the tests that claim it works, are real.</strong></p>
38
+ <p>
39
+ <a href="https://github.com/GuardianVigil-Labs/Prufgate/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-green.svg" alt="License: Apache 2.0" /></a>
40
+ <a href="https://pypi.org/project/prufgate/"><img src="https://img.shields.io/pypi/v/prufgate" alt="PyPI version" /></a>
41
+ <img src="https://img.shields.io/badge/Python-3.9%2B-blue" alt="Python 3.9+" />
42
+ <a href="https://scorecard.dev/viewer/?uri=github.com/GuardianVigil-Labs/Prufgate"><img src="https://api.scorecard.dev/projects/github.com/GuardianVigil-Labs/Prufgate/badge" alt="OpenSSF Scorecard" /></a>
43
+ </p>
44
+ </div>
45
+
46
+ Linters check that code compiles. PrufGate looks for code that compiles, passes review at a glance and still does not do the job. This is the kind of code an AI coding agent (or a hurried human) writes to make a task look finished:
47
+
48
+ - a `catch` block that returns a hard-coded success object;
49
+ - a click handler that does nothing;
50
+ - a test that asserts `true`, or mocks the very function it tests;
51
+ - a `.skip`, `@ts-ignore` or lowered coverage threshold slipped into a diff;
52
+ - an import of a package that is not declared anywhere;
53
+ - an API route that loads a record by ID without checking who owns it.
54
+
55
+ PrufGate is deterministic: plain Python, no network calls and no LLM unless you ask for one. It runs in seconds on a pull request, and writes SARIF for code scanning and Markdown for humans. It is meant to sit next to your linters and SAST tools, not replace them.
56
+
57
+ ## The six engines
58
+
59
+ | # | Engine | What it catches |
60
+ |---|---|---|
61
+ | 1 | Anti-fabrication (`prufgate/anti_fabrication`) | Canned success on error paths, simulated return values, `MOCK_*`/`SAMPLE_*` data in production code, stub UI handlers, fake "fresh" timestamps, unimplemented stubs, LLM prompts that ask for a verdict without passing any evidence, documentation addresses in production. |
62
+ | 2 | Test integrity (`prufgate/anti_reward_hacking`) | Tests with no assertions, assertions that cannot fail, tests that mock the unit under test, swallowed exceptions, assertions deleted or weakened in a diff, production code special-casing a test's literal input. |
63
+ | 3 | Diff guard (`prufgate/diff_guard`) | Skips and focus (`.skip`, `.only`, `xit`, `pytest.mark.skip`, `t.Skip()`, `#[ignore]`, `@Disabled`) added without an issue reference, bare suppressions (`@ts-ignore`, `# noqa`, `// nolint`, `#[allow]`), `as unknown as T` casts, weakened linter/CI/coverage settings, and new exemptions in PrufGate's own config. |
64
+ | 4 | Contract guard (`prufgate/contract_guard`) | Imports not declared in `package.json`, `pyproject.toml`/`requirements*.txt`, `go.mod` or `Cargo.toml`; environment variables read without a default and missing from `.env.example`; frontend calls to API routes that do not exist. |
65
+ | 5 | BOLA / IDOR (`prufgate/bola`) | Route handlers that look up a record by a client-supplied ID with no auth guard or no tenant/owner scoping, across Express, Next.js, NestJS, FastAPI, Flask, Django, Go (net/http, Gin, Echo, Chi), Spring, Rails and Laravel. Optional live two-token probing of a running service you own. |
66
+ | 6 | Diff reviewer (`prufgate/review`) | High-precision rules on changed lines (SQL built from strings, shell injection, disabled TLS verification, hard-coded credentials, unsanitised HTML, ignored Go errors, credential logging), GitHub suggestion blocks, and optional delegation to an AI CLI or API you choose. |
67
+
68
+ Details, rule IDs, supported languages and known limits for each engine: [docs/ENGINES.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/ENGINES.md).
69
+
70
+ PrufGate uses pattern and structure heuristics, not a full parser for every language. It will miss things and it will sometimes flag correct code. Every finding names its rule, and [inline `prufgate-ignore` comments, exemptions and baselines](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CONFIGURATION.md#suppressing-findings) let you record why.
71
+
72
+ ## Quick start
73
+
74
+ PrufGate needs Python 3.9 or newer and Git.
75
+
76
+ ```bash
77
+ pipx install prufgate # or: pip install prufgate (the `prufgate` and `prufgate-mcp` commands)
78
+ prufgate --self-check # every engine against its built-in fixtures
79
+ ```
80
+
81
+ Or run the signed container image, which adds the full gate with ast-grep, gitleaks and zizmor:
82
+
83
+ ```bash
84
+ docker run --rm -v "$PWD:/workspace" ghcr.io/guardianvigil-labs/prufgate:1.0.0 # the fast gate on this repository
85
+ docker run --rm -v "$PWD:/workspace" ghcr.io/guardianvigil-labs/prufgate:1.0.0 prufgate check .
86
+ ```
87
+
88
+ Or add the GitHub Action to a pull-request workflow, pinned to the commit SHA of the `v1.0.0` tag ([full example](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CI_INTEGRATION.md)):
89
+
90
+ ```yaml
91
+ - uses: actions/checkout@<commit-sha>
92
+ with: { fetch-depth: 0, persist-credentials: false }
93
+ - run: python3 -m pip install "PyYAML>=6.0"
94
+ - uses: GuardianVigil-Labs/Prufgate@<commit-sha-of-v1.0.0>
95
+ ```
96
+
97
+ Every release is signed and carries build provenance and an SBOM: [Verify a release](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/SECURITY.md#verify-a-release).
98
+
99
+ Then, in your project:
100
+
101
+ ```bash
102
+ prufgate check . # engines 1-5 on the whole repository
103
+ prufgate check --changed --base origin/main # only what this branch changed
104
+ prufgate init --hooks # starter config + coding-agent hooks
105
+ ```
106
+
107
+ Exit codes are the same everywhere: **0** clean, **1** blocking findings (P0/P1), **2** PrufGate could not run (bad config, bad base ref, unreadable file, engine crash). A crash never reads as a pass.
108
+
109
+ ## Ways to run it
110
+
111
+ | Want | Use |
112
+ |---|---|
113
+ | A quick check while coding | `prufgate check --changed` |
114
+ | One engine | `prufgate test-audit`, `prufgate bola`, `prufgate review` |
115
+ | The full gate with SARIF and Markdown reports | `./prufgate.sh fast` (changed files) or `./prufgate.sh full`, from a checkout. Reports go to `reports/prufgate.sarif` and `reports/prufgate-review.md`. |
116
+ | A pull-request gate on GitHub | The composite action in this repository: [docs/CI_INTEGRATION.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CI_INTEGRATION.md) |
117
+ | A coding agent sent back to fix its findings before it stops | `prufgate init --hooks` (Claude Code Stop hook, which asks once; Cursor rule; the pre-commit hook and the CI gate enforce) |
118
+ | Tools for an agent over MCP | `prufgate mcp`: nine read-only tools |
119
+ | A service that scans on webhook | `prufgate api`: bearer token, loopback by default |
120
+
121
+ The full command and option reference is in [docs/GETTING_STARTED.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/GETTING_STARTED.md), and every configuration key is in [docs/CONFIGURATION.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CONFIGURATION.md).
122
+
123
+ ## Configuration in one look
124
+
125
+ PrufGate works without configuration. To tune it, add `.prufgate/config.yaml`:
126
+
127
+ ```yaml
128
+ version: 1
129
+ packs: [core, web-ui, ai-safety] # cti is an opt-in domain pack
130
+ exclude: ["dist/**", "vendor/**"]
131
+ auth_guards: [requireUser, get_current_user]
132
+ tenant_keys: [organization_id, account_id]
133
+ exempt:
134
+ src/legacy/adapter.ts:
135
+ route-canned-fallback: "#104: legacy fallback until the payments API migration"
136
+ known_debt:
137
+ stub-click-handler: 0 # a ceiling that can only go down
138
+ ```
139
+
140
+ ## Documentation
141
+
142
+ - [Getting started](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/GETTING_STARTED.md): install, commands, reports, exit codes
143
+ - [Configuration reference](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CONFIGURATION.md): every key, suppressions, environment variables
144
+ - [The engines](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/ENGINES.md): rules, languages and limits
145
+ - [CI and agent integration](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CI_INTEGRATION.md): GitHub Action, other CI, agent hooks, MCP, REST API
146
+ - [Custom rules](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CUSTOM_RULES.md): your own ast-grep rules and hooks
147
+ - [Architecture](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/ARCHITECTURE.md)
148
+ - [Changelog](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/CHANGELOG.md)
149
+
150
+ ## Contributing and security
151
+
152
+ Contributions are welcome: see [CONTRIBUTING.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/CONTRIBUTING.md) and the maintainer guide [AGENTS.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/AGENTS.md). Please report vulnerabilities privately, as described in [SECURITY.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/SECURITY.md).
153
+
154
+ PrufGate is published by GuardianVigil under the [Apache License 2.0](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/LICENSE). The name and logo are trademarks: see [TRADEMARKS.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/TRADEMARKS.md).
@@ -0,0 +1,122 @@
1
+ <!-- mcp-name: io.github.GuardianVigil-Labs/prufgate -->
2
+ <div align="center">
3
+ <img src="https://raw.githubusercontent.com/GuardianVigil-Labs/Prufgate/main/assets/prufgate-icon.svg" alt="PrufGate logo" width="128" />
4
+ <h1>PrufGate</h1>
5
+ <p><strong>Checks whether code, and the tests that claim it works, are real.</strong></p>
6
+ <p>
7
+ <a href="https://github.com/GuardianVigil-Labs/Prufgate/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-green.svg" alt="License: Apache 2.0" /></a>
8
+ <a href="https://pypi.org/project/prufgate/"><img src="https://img.shields.io/pypi/v/prufgate" alt="PyPI version" /></a>
9
+ <img src="https://img.shields.io/badge/Python-3.9%2B-blue" alt="Python 3.9+" />
10
+ <a href="https://scorecard.dev/viewer/?uri=github.com/GuardianVigil-Labs/Prufgate"><img src="https://api.scorecard.dev/projects/github.com/GuardianVigil-Labs/Prufgate/badge" alt="OpenSSF Scorecard" /></a>
11
+ </p>
12
+ </div>
13
+
14
+ Linters check that code compiles. PrufGate looks for code that compiles, passes review at a glance and still does not do the job. This is the kind of code an AI coding agent (or a hurried human) writes to make a task look finished:
15
+
16
+ - a `catch` block that returns a hard-coded success object;
17
+ - a click handler that does nothing;
18
+ - a test that asserts `true`, or mocks the very function it tests;
19
+ - a `.skip`, `@ts-ignore` or lowered coverage threshold slipped into a diff;
20
+ - an import of a package that is not declared anywhere;
21
+ - an API route that loads a record by ID without checking who owns it.
22
+
23
+ PrufGate is deterministic: plain Python, no network calls and no LLM unless you ask for one. It runs in seconds on a pull request, and writes SARIF for code scanning and Markdown for humans. It is meant to sit next to your linters and SAST tools, not replace them.
24
+
25
+ ## The six engines
26
+
27
+ | # | Engine | What it catches |
28
+ |---|---|---|
29
+ | 1 | Anti-fabrication (`prufgate/anti_fabrication`) | Canned success on error paths, simulated return values, `MOCK_*`/`SAMPLE_*` data in production code, stub UI handlers, fake "fresh" timestamps, unimplemented stubs, LLM prompts that ask for a verdict without passing any evidence, documentation addresses in production. |
30
+ | 2 | Test integrity (`prufgate/anti_reward_hacking`) | Tests with no assertions, assertions that cannot fail, tests that mock the unit under test, swallowed exceptions, assertions deleted or weakened in a diff, production code special-casing a test's literal input. |
31
+ | 3 | Diff guard (`prufgate/diff_guard`) | Skips and focus (`.skip`, `.only`, `xit`, `pytest.mark.skip`, `t.Skip()`, `#[ignore]`, `@Disabled`) added without an issue reference, bare suppressions (`@ts-ignore`, `# noqa`, `// nolint`, `#[allow]`), `as unknown as T` casts, weakened linter/CI/coverage settings, and new exemptions in PrufGate's own config. |
32
+ | 4 | Contract guard (`prufgate/contract_guard`) | Imports not declared in `package.json`, `pyproject.toml`/`requirements*.txt`, `go.mod` or `Cargo.toml`; environment variables read without a default and missing from `.env.example`; frontend calls to API routes that do not exist. |
33
+ | 5 | BOLA / IDOR (`prufgate/bola`) | Route handlers that look up a record by a client-supplied ID with no auth guard or no tenant/owner scoping, across Express, Next.js, NestJS, FastAPI, Flask, Django, Go (net/http, Gin, Echo, Chi), Spring, Rails and Laravel. Optional live two-token probing of a running service you own. |
34
+ | 6 | Diff reviewer (`prufgate/review`) | High-precision rules on changed lines (SQL built from strings, shell injection, disabled TLS verification, hard-coded credentials, unsanitised HTML, ignored Go errors, credential logging), GitHub suggestion blocks, and optional delegation to an AI CLI or API you choose. |
35
+
36
+ Details, rule IDs, supported languages and known limits for each engine: [docs/ENGINES.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/ENGINES.md).
37
+
38
+ PrufGate uses pattern and structure heuristics, not a full parser for every language. It will miss things and it will sometimes flag correct code. Every finding names its rule, and [inline `prufgate-ignore` comments, exemptions and baselines](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CONFIGURATION.md#suppressing-findings) let you record why.
39
+
40
+ ## Quick start
41
+
42
+ PrufGate needs Python 3.9 or newer and Git.
43
+
44
+ ```bash
45
+ pipx install prufgate # or: pip install prufgate (the `prufgate` and `prufgate-mcp` commands)
46
+ prufgate --self-check # every engine against its built-in fixtures
47
+ ```
48
+
49
+ Or run the signed container image, which adds the full gate with ast-grep, gitleaks and zizmor:
50
+
51
+ ```bash
52
+ docker run --rm -v "$PWD:/workspace" ghcr.io/guardianvigil-labs/prufgate:1.0.0 # the fast gate on this repository
53
+ docker run --rm -v "$PWD:/workspace" ghcr.io/guardianvigil-labs/prufgate:1.0.0 prufgate check .
54
+ ```
55
+
56
+ Or add the GitHub Action to a pull-request workflow, pinned to the commit SHA of the `v1.0.0` tag ([full example](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CI_INTEGRATION.md)):
57
+
58
+ ```yaml
59
+ - uses: actions/checkout@<commit-sha>
60
+ with: { fetch-depth: 0, persist-credentials: false }
61
+ - run: python3 -m pip install "PyYAML>=6.0"
62
+ - uses: GuardianVigil-Labs/Prufgate@<commit-sha-of-v1.0.0>
63
+ ```
64
+
65
+ Every release is signed and carries build provenance and an SBOM: [Verify a release](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/SECURITY.md#verify-a-release).
66
+
67
+ Then, in your project:
68
+
69
+ ```bash
70
+ prufgate check . # engines 1-5 on the whole repository
71
+ prufgate check --changed --base origin/main # only what this branch changed
72
+ prufgate init --hooks # starter config + coding-agent hooks
73
+ ```
74
+
75
+ Exit codes are the same everywhere: **0** clean, **1** blocking findings (P0/P1), **2** PrufGate could not run (bad config, bad base ref, unreadable file, engine crash). A crash never reads as a pass.
76
+
77
+ ## Ways to run it
78
+
79
+ | Want | Use |
80
+ |---|---|
81
+ | A quick check while coding | `prufgate check --changed` |
82
+ | One engine | `prufgate test-audit`, `prufgate bola`, `prufgate review` |
83
+ | The full gate with SARIF and Markdown reports | `./prufgate.sh fast` (changed files) or `./prufgate.sh full`, from a checkout. Reports go to `reports/prufgate.sarif` and `reports/prufgate-review.md`. |
84
+ | A pull-request gate on GitHub | The composite action in this repository: [docs/CI_INTEGRATION.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CI_INTEGRATION.md) |
85
+ | A coding agent sent back to fix its findings before it stops | `prufgate init --hooks` (Claude Code Stop hook, which asks once; Cursor rule; the pre-commit hook and the CI gate enforce) |
86
+ | Tools for an agent over MCP | `prufgate mcp`: nine read-only tools |
87
+ | A service that scans on webhook | `prufgate api`: bearer token, loopback by default |
88
+
89
+ The full command and option reference is in [docs/GETTING_STARTED.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/GETTING_STARTED.md), and every configuration key is in [docs/CONFIGURATION.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CONFIGURATION.md).
90
+
91
+ ## Configuration in one look
92
+
93
+ PrufGate works without configuration. To tune it, add `.prufgate/config.yaml`:
94
+
95
+ ```yaml
96
+ version: 1
97
+ packs: [core, web-ui, ai-safety] # cti is an opt-in domain pack
98
+ exclude: ["dist/**", "vendor/**"]
99
+ auth_guards: [requireUser, get_current_user]
100
+ tenant_keys: [organization_id, account_id]
101
+ exempt:
102
+ src/legacy/adapter.ts:
103
+ route-canned-fallback: "#104: legacy fallback until the payments API migration"
104
+ known_debt:
105
+ stub-click-handler: 0 # a ceiling that can only go down
106
+ ```
107
+
108
+ ## Documentation
109
+
110
+ - [Getting started](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/GETTING_STARTED.md): install, commands, reports, exit codes
111
+ - [Configuration reference](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CONFIGURATION.md): every key, suppressions, environment variables
112
+ - [The engines](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/ENGINES.md): rules, languages and limits
113
+ - [CI and agent integration](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CI_INTEGRATION.md): GitHub Action, other CI, agent hooks, MCP, REST API
114
+ - [Custom rules](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/CUSTOM_RULES.md): your own ast-grep rules and hooks
115
+ - [Architecture](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/docs/ARCHITECTURE.md)
116
+ - [Changelog](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/CHANGELOG.md)
117
+
118
+ ## Contributing and security
119
+
120
+ Contributions are welcome: see [CONTRIBUTING.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/CONTRIBUTING.md) and the maintainer guide [AGENTS.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/AGENTS.md). Please report vulnerabilities privately, as described in [SECURITY.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/SECURITY.md).
121
+
122
+ PrufGate is published by GuardianVigil under the [Apache License 2.0](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/LICENSE). The name and logo are trademarks: see [TRADEMARKS.md](https://github.com/GuardianVigil-Labs/Prufgate/blob/main/TRADEMARKS.md).
@@ -0,0 +1,7 @@
1
+ """PrufGate: verification engines for fabricated code, hollow tests, guardrail tampering and BOLA."""
2
+
3
+ __version__ = "1.0.0"
4
+
5
+ # The project's home page, used as the SARIF `informationUri`.
6
+ # PRUFGATE_INFO_URI overrides it.
7
+ PROJECT_URL = "https://github.com/GuardianVigil-Labs/Prufgate"
@@ -0,0 +1 @@
1
+ """PrufGate Production Anti-Fabrication Engine."""