vaporcheck 0.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.
- vaporcheck-0.1.0/LICENSE +201 -0
- vaporcheck-0.1.0/NOTICE +17 -0
- vaporcheck-0.1.0/PKG-INFO +147 -0
- vaporcheck-0.1.0/README.md +126 -0
- vaporcheck-0.1.0/pyproject.toml +35 -0
- vaporcheck-0.1.0/setup.cfg +4 -0
- vaporcheck-0.1.0/vaporcheck/__init__.py +3 -0
- vaporcheck-0.1.0/vaporcheck/cache.py +103 -0
- vaporcheck-0.1.0/vaporcheck/hook.py +225 -0
- vaporcheck-0.1.0/vaporcheck/run_spike.py +72 -0
- vaporcheck-0.1.0/vaporcheck/server.py +130 -0
- vaporcheck-0.1.0/vaporcheck/test_cache.py +45 -0
- vaporcheck-0.1.0/vaporcheck/test_mcp.py +102 -0
- vaporcheck-0.1.0/vaporcheck/test_parse.py +42 -0
- vaporcheck-0.1.0/vaporcheck/verifier.py +127 -0
- vaporcheck-0.1.0/vaporcheck.egg-info/PKG-INFO +147 -0
- vaporcheck-0.1.0/vaporcheck.egg-info/SOURCES.txt +18 -0
- vaporcheck-0.1.0/vaporcheck.egg-info/dependency_links.txt +1 -0
- vaporcheck-0.1.0/vaporcheck.egg-info/entry_points.txt +2 -0
- vaporcheck-0.1.0/vaporcheck.egg-info/top_level.txt +1 -0
vaporcheck-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Codemax IT Solutions Pvt. Ltd.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
vaporcheck-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
vaporcheck
|
|
2
|
+
Copyright 2026 Codemax IT Solutions Pvt. Ltd.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Codemax IT Solutions Pvt. Ltd.
|
|
5
|
+
(https://cdmx.in).
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vaporcheck
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fail-closed existence verification for model-emitted identifiers — catches hallucinated (vaporware) packages, paths, and symbols before an agent acts on them.
|
|
5
|
+
Author-email: "Codemax IT Solutions Pvt. Ltd." <licensing@cdmx.in>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/cdmx-in/vaporcheck
|
|
8
|
+
Project-URL: Repository, https://github.com/cdmx-in/vaporcheck
|
|
9
|
+
Project-URL: Documentation, https://github.com/cdmx-in/vaporcheck/tree/main/docs
|
|
10
|
+
Keywords: mcp,llm,agent,hallucination,slopsquatting,supply-chain,security
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Security
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
License-File: NOTICE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# vaporcheck
|
|
23
|
+
|
|
24
|
+
**Fail-closed existence verification for model-emitted identifiers.** Catch hallucinated and slop-squatted package names, dead file paths, and nonexistent API/tool names *before* an agent acts on them — because vaporware you `pip install` is somebody else's payload.
|
|
25
|
+
|
|
26
|
+
[](LICENSE)
|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Why
|
|
33
|
+
|
|
34
|
+
LLM coding agents confidently emit identifiers that don't exist: a USENIX Security 2025 study found **19.7% of LLM-recommended packages were hallucinated** — an open door for *slopsquatting* (an attacker registers the hallucinated name). The same failure shows up as dead file paths, deprecated/removed APIs, and calls to tools that were never registered.
|
|
35
|
+
|
|
36
|
+
The root cause — model **overconfidence** — is not fixable by a wrapper. So vaporcheck doesn't try. It replaces the unanswerable question *"is the model confident?"* with a deterministic one:
|
|
37
|
+
|
|
38
|
+
> **"Does the referent actually exist in its authoritative source?"**
|
|
39
|
+
|
|
40
|
+
That's a binary lookup (a registry, the filesystem, a symbol table) — testable, cheap, and hard to argue with.
|
|
41
|
+
|
|
42
|
+
## How it works
|
|
43
|
+
|
|
44
|
+
A small **resolver core** answers `exists / not-found / deprecated / cannot-verify` for one identifier, shipped through two delivery vehicles:
|
|
45
|
+
|
|
46
|
+
| Vehicle | What it is | Guarantee |
|
|
47
|
+
|---------|-----------|-----------|
|
|
48
|
+
| **MCP server** (`verify_identifier` tool) | Any MCP client can ask "does this exist?" | Agent-callable, advisory |
|
|
49
|
+
| **PreToolUse hook** | A Claude Code hook that denies the tool call | **Fail-closed** — the agent can't proceed |
|
|
50
|
+
|
|
51
|
+
Both reuse the same resolvers. Standalone, the MCP is advisory (the model may ignore it); paired with the hook (or any gateway that can block), it becomes a hard gate.
|
|
52
|
+
|
|
53
|
+
### The honest boundary
|
|
54
|
+
|
|
55
|
+
A hook sees **tool calls, not generated text**. So today this gates the two classes that surface at the tool boundary:
|
|
56
|
+
|
|
57
|
+
- **package installs** (`pip install`, `npm install`, …) — verified against PyPI / npm
|
|
58
|
+
- **file paths** (`Edit` of a missing file) — verified against the filesystem
|
|
59
|
+
|
|
60
|
+
Tool-names and API-symbols buried in generated code are *verify-on-write / verify-on-run* (gate the `Edit` or test that introduces them), not mid-sentence interception. This is a deliberate, documented limit — see [docs/SPIKE-FINDINGS.md](docs/SPIKE-FINDINGS.md).
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
Requires **Python 3.10+**. **Zero runtime dependencies** (stdlib only — fitting for an anti-supply-chain-risk tool).
|
|
65
|
+
|
|
66
|
+
### Option A — pip (adds the `vaporcheck-mcp` console command)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install vaporcheck
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Option B — clone (if you want the hook/MCP config to point at source files)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/cdmx-in/vaporcheck.git
|
|
76
|
+
cd vaporcheck
|
|
77
|
+
python vaporcheck/test_parse.py # offline smoke test — should print 10/10 PASS
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Configure
|
|
81
|
+
|
|
82
|
+
### As an MCP server (any MCP client)
|
|
83
|
+
|
|
84
|
+
```jsonc
|
|
85
|
+
// .mcp.json (project scope) — adjust the path to where you cloned
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"vaporcheck": { "command": "python", "args": ["/path/to/vaporcheck/vaporcheck/server.py"] }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
(On Windows, `"command": "py", "args": ["-3", ...]` also works. If you installed via pip, use `"command": "vaporcheck-mcp"` with no args.)
|
|
94
|
+
|
|
95
|
+
Then call the `verify_identifier` tool:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{ "kind": "pypi", "value": "reqeusts" }
|
|
99
|
+
// -> { "status": "not-found", ... } (a slopsquat — blocked)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### As a fail-closed Claude Code hook
|
|
103
|
+
|
|
104
|
+
```jsonc
|
|
105
|
+
// .claude/settings.json (or settings.local.json)
|
|
106
|
+
{
|
|
107
|
+
"hooks": {
|
|
108
|
+
"PreToolUse": [
|
|
109
|
+
{ "matcher": "Bash",
|
|
110
|
+
"hooks": [{ "type": "command", "command": "python /path/to/vaporcheck/vaporcheck/hook.py", "timeout": 15 }] }
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Restart Claude Code to load the hook. Now `pip install <hallucinated-package>` is **denied before it runs**, with a reason the model can self-correct from. On network failure the hook degrades to *ask* instead of falsely blocking.
|
|
117
|
+
|
|
118
|
+
## Status
|
|
119
|
+
|
|
120
|
+
**MVP — working, tested, dogfooded.** Resolvers: PyPI, npm, filesystem paths. Shared SQLite cache (warm lookups ~1 ms) with status-aware TTLs and a token-bucket throttle.
|
|
121
|
+
|
|
122
|
+
### Roadmap
|
|
123
|
+
|
|
124
|
+
- [ ] More package ecosystems: crates.io, Go, RubyGems, Maven
|
|
125
|
+
- [ ] **Tool-name** resolver (against the live tool registry) — greenfield, no incumbent
|
|
126
|
+
- [ ] **API-symbol** resolver (via LSP / compiler) — greenfield
|
|
127
|
+
- [ ] Citations resolver (last; the crowded class — breadth, not headline)
|
|
128
|
+
- [x] Namespace the modules under a package; publish to PyPI
|
|
129
|
+
|
|
130
|
+
## Tests
|
|
131
|
+
|
|
132
|
+
38 checks across 4 suites — all hitting real registries / filesystem, no mocks:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python vaporcheck/run_spike.py # hook behavior (10)
|
|
136
|
+
python vaporcheck/test_parse.py # shell-aware install parser (10)
|
|
137
|
+
python vaporcheck/test_mcp.py # MCP client handshake (9)
|
|
138
|
+
python vaporcheck/test_cache.py # cache latency / TTL / errors (9)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Provenance
|
|
142
|
+
|
|
143
|
+
This repo is the product of a structured research → validation → build effort. The full record — pain-point research, web-verified go/no-go, and the live-dogfooding spike that found and fixed two real parser bugs — is in [docs/](docs/).
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
[Apache-2.0](LICENSE) © 2026 [Codemax IT Solutions Pvt. Ltd.](https://cdmx.in)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# vaporcheck
|
|
2
|
+
|
|
3
|
+
**Fail-closed existence verification for model-emitted identifiers.** Catch hallucinated and slop-squatted package names, dead file paths, and nonexistent API/tool names *before* an agent acts on them — because vaporware you `pip install` is somebody else's payload.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
LLM coding agents confidently emit identifiers that don't exist: a USENIX Security 2025 study found **19.7% of LLM-recommended packages were hallucinated** — an open door for *slopsquatting* (an attacker registers the hallucinated name). The same failure shows up as dead file paths, deprecated/removed APIs, and calls to tools that were never registered.
|
|
14
|
+
|
|
15
|
+
The root cause — model **overconfidence** — is not fixable by a wrapper. So vaporcheck doesn't try. It replaces the unanswerable question *"is the model confident?"* with a deterministic one:
|
|
16
|
+
|
|
17
|
+
> **"Does the referent actually exist in its authoritative source?"**
|
|
18
|
+
|
|
19
|
+
That's a binary lookup (a registry, the filesystem, a symbol table) — testable, cheap, and hard to argue with.
|
|
20
|
+
|
|
21
|
+
## How it works
|
|
22
|
+
|
|
23
|
+
A small **resolver core** answers `exists / not-found / deprecated / cannot-verify` for one identifier, shipped through two delivery vehicles:
|
|
24
|
+
|
|
25
|
+
| Vehicle | What it is | Guarantee |
|
|
26
|
+
|---------|-----------|-----------|
|
|
27
|
+
| **MCP server** (`verify_identifier` tool) | Any MCP client can ask "does this exist?" | Agent-callable, advisory |
|
|
28
|
+
| **PreToolUse hook** | A Claude Code hook that denies the tool call | **Fail-closed** — the agent can't proceed |
|
|
29
|
+
|
|
30
|
+
Both reuse the same resolvers. Standalone, the MCP is advisory (the model may ignore it); paired with the hook (or any gateway that can block), it becomes a hard gate.
|
|
31
|
+
|
|
32
|
+
### The honest boundary
|
|
33
|
+
|
|
34
|
+
A hook sees **tool calls, not generated text**. So today this gates the two classes that surface at the tool boundary:
|
|
35
|
+
|
|
36
|
+
- **package installs** (`pip install`, `npm install`, …) — verified against PyPI / npm
|
|
37
|
+
- **file paths** (`Edit` of a missing file) — verified against the filesystem
|
|
38
|
+
|
|
39
|
+
Tool-names and API-symbols buried in generated code are *verify-on-write / verify-on-run* (gate the `Edit` or test that introduces them), not mid-sentence interception. This is a deliberate, documented limit — see [docs/SPIKE-FINDINGS.md](docs/SPIKE-FINDINGS.md).
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
Requires **Python 3.10+**. **Zero runtime dependencies** (stdlib only — fitting for an anti-supply-chain-risk tool).
|
|
44
|
+
|
|
45
|
+
### Option A — pip (adds the `vaporcheck-mcp` console command)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install vaporcheck
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Option B — clone (if you want the hook/MCP config to point at source files)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/cdmx-in/vaporcheck.git
|
|
55
|
+
cd vaporcheck
|
|
56
|
+
python vaporcheck/test_parse.py # offline smoke test — should print 10/10 PASS
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configure
|
|
60
|
+
|
|
61
|
+
### As an MCP server (any MCP client)
|
|
62
|
+
|
|
63
|
+
```jsonc
|
|
64
|
+
// .mcp.json (project scope) — adjust the path to where you cloned
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"vaporcheck": { "command": "python", "args": ["/path/to/vaporcheck/vaporcheck/server.py"] }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
(On Windows, `"command": "py", "args": ["-3", ...]` also works. If you installed via pip, use `"command": "vaporcheck-mcp"` with no args.)
|
|
73
|
+
|
|
74
|
+
Then call the `verify_identifier` tool:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{ "kind": "pypi", "value": "reqeusts" }
|
|
78
|
+
// -> { "status": "not-found", ... } (a slopsquat — blocked)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### As a fail-closed Claude Code hook
|
|
82
|
+
|
|
83
|
+
```jsonc
|
|
84
|
+
// .claude/settings.json (or settings.local.json)
|
|
85
|
+
{
|
|
86
|
+
"hooks": {
|
|
87
|
+
"PreToolUse": [
|
|
88
|
+
{ "matcher": "Bash",
|
|
89
|
+
"hooks": [{ "type": "command", "command": "python /path/to/vaporcheck/vaporcheck/hook.py", "timeout": 15 }] }
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Restart Claude Code to load the hook. Now `pip install <hallucinated-package>` is **denied before it runs**, with a reason the model can self-correct from. On network failure the hook degrades to *ask* instead of falsely blocking.
|
|
96
|
+
|
|
97
|
+
## Status
|
|
98
|
+
|
|
99
|
+
**MVP — working, tested, dogfooded.** Resolvers: PyPI, npm, filesystem paths. Shared SQLite cache (warm lookups ~1 ms) with status-aware TTLs and a token-bucket throttle.
|
|
100
|
+
|
|
101
|
+
### Roadmap
|
|
102
|
+
|
|
103
|
+
- [ ] More package ecosystems: crates.io, Go, RubyGems, Maven
|
|
104
|
+
- [ ] **Tool-name** resolver (against the live tool registry) — greenfield, no incumbent
|
|
105
|
+
- [ ] **API-symbol** resolver (via LSP / compiler) — greenfield
|
|
106
|
+
- [ ] Citations resolver (last; the crowded class — breadth, not headline)
|
|
107
|
+
- [x] Namespace the modules under a package; publish to PyPI
|
|
108
|
+
|
|
109
|
+
## Tests
|
|
110
|
+
|
|
111
|
+
38 checks across 4 suites — all hitting real registries / filesystem, no mocks:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
python vaporcheck/run_spike.py # hook behavior (10)
|
|
115
|
+
python vaporcheck/test_parse.py # shell-aware install parser (10)
|
|
116
|
+
python vaporcheck/test_mcp.py # MCP client handshake (9)
|
|
117
|
+
python vaporcheck/test_cache.py # cache latency / TTL / errors (9)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Provenance
|
|
121
|
+
|
|
122
|
+
This repo is the product of a structured research → validation → build effort. The full record — pain-point research, web-verified go/no-go, and the live-dogfooding spike that found and fixed two real parser bugs — is in [docs/](docs/).
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
[Apache-2.0](LICENSE) © 2026 [Codemax IT Solutions Pvt. Ltd.](https://cdmx.in)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vaporcheck"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Fail-closed existence verification for model-emitted identifiers — catches hallucinated (vaporware) packages, paths, and symbols before an agent acts on them."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
authors = [{ name = "Codemax IT Solutions Pvt. Ltd.", email = "licensing@cdmx.in" }]
|
|
13
|
+
keywords = ["mcp", "llm", "agent", "hallucination", "slopsquatting", "supply-chain", "security"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Topic :: Security",
|
|
18
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [] # stdlib only — zero runtime dependencies by design
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/cdmx-in/vaporcheck"
|
|
25
|
+
Repository = "https://github.com/cdmx-in/vaporcheck"
|
|
26
|
+
Documentation = "https://github.com/cdmx-in/vaporcheck/tree/main/docs"
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
vaporcheck-mcp = "vaporcheck.server:main"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools]
|
|
32
|
+
packages = ["vaporcheck"]
|
|
33
|
+
|
|
34
|
+
# ponytail: the test files ship inside the wheel (~20 KB, stdlib-only, harmless);
|
|
35
|
+
# split them out to a tests/ dir if wheel hygiene ever matters.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""Shared SQLite cache + token-bucket rate limiter for the verifier.
|
|
2
|
+
|
|
3
|
+
stdlib only. The cache file is shared by BOTH the short-lived PreToolUse hook
|
|
4
|
+
processes and the long-running MCP server, so a result fetched by one is reused
|
|
5
|
+
by the other — an in-memory cache could not do this.
|
|
6
|
+
|
|
7
|
+
Status-aware TTLs double as false-positive protection:
|
|
8
|
+
exists -> long (existence rarely changes)
|
|
9
|
+
deprecated -> medium
|
|
10
|
+
not-found -> SHORT (a legitimately-new package may appear soon)
|
|
11
|
+
cannot-verify -> never cached (transient)
|
|
12
|
+
"""
|
|
13
|
+
import os
|
|
14
|
+
import sqlite3
|
|
15
|
+
import time
|
|
16
|
+
|
|
17
|
+
CACHE_PATH = os.environ.get(
|
|
18
|
+
"VERIFY_CACHE", os.path.join(os.path.dirname(os.path.abspath(__file__)), ".verify-cache.sqlite"))
|
|
19
|
+
|
|
20
|
+
TTL = {
|
|
21
|
+
"exists": 7 * 24 * 3600,
|
|
22
|
+
"deprecated": 24 * 3600,
|
|
23
|
+
"not-found": 600, # 10 min — short on purpose
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# token bucket for live registry fetches
|
|
27
|
+
RATE = 10.0 # tokens/sec refill
|
|
28
|
+
CAPACITY = 20.0 # burst
|
|
29
|
+
MAX_WAIT = 2.0 # never block a fetch longer than this
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _conn():
|
|
33
|
+
c = sqlite3.connect(CACHE_PATH, timeout=5)
|
|
34
|
+
c.execute("PRAGMA busy_timeout=3000")
|
|
35
|
+
c.execute("CREATE TABLE IF NOT EXISTS cache ("
|
|
36
|
+
"key TEXT PRIMARY KEY, kind TEXT, identifier TEXT, status TEXT, "
|
|
37
|
+
"canonical TEXT, note TEXT, expires REAL)")
|
|
38
|
+
c.execute("CREATE TABLE IF NOT EXISTS bucket ("
|
|
39
|
+
"id INTEGER PRIMARY KEY CHECK (id=1), tokens REAL, updated REAL)")
|
|
40
|
+
return c
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _key(kind, value):
|
|
44
|
+
return f"{kind}\x00{value}"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get(kind, value):
|
|
48
|
+
"""Return a dict {identifier,status,canonical,note} if a fresh hit, else None."""
|
|
49
|
+
now = time.time()
|
|
50
|
+
with _conn() as c:
|
|
51
|
+
row = c.execute(
|
|
52
|
+
"SELECT identifier,status,canonical,note,expires FROM cache WHERE key=?",
|
|
53
|
+
(_key(kind, value),)).fetchone()
|
|
54
|
+
if not row:
|
|
55
|
+
return None
|
|
56
|
+
ident, status, canonical, note, expires = row
|
|
57
|
+
if expires < now:
|
|
58
|
+
c.execute("DELETE FROM cache WHERE key=?", (_key(kind, value),))
|
|
59
|
+
return None
|
|
60
|
+
return {"identifier": ident, "status": status,
|
|
61
|
+
"canonical": canonical or None, "note": note or ""}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def put(kind, identifier, status, canonical, note):
|
|
65
|
+
ttl = TTL.get(status)
|
|
66
|
+
if ttl is None:
|
|
67
|
+
return # don't cache cannot-verify
|
|
68
|
+
with _conn() as c:
|
|
69
|
+
c.execute("INSERT OR REPLACE INTO cache VALUES (?,?,?,?,?,?,?)",
|
|
70
|
+
(_key(kind, identifier), kind, identifier, status,
|
|
71
|
+
canonical or "", note or "", time.time() + ttl))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def throttle():
|
|
75
|
+
"""Consume one token before a live fetch; sleep briefly if the bucket is dry."""
|
|
76
|
+
now = time.time()
|
|
77
|
+
wait = 0.0
|
|
78
|
+
with _conn() as c:
|
|
79
|
+
row = c.execute("SELECT tokens,updated FROM bucket WHERE id=1").fetchone()
|
|
80
|
+
tokens, updated = (row if row else (CAPACITY, now))
|
|
81
|
+
tokens = min(CAPACITY, tokens + (now - updated) * RATE)
|
|
82
|
+
if tokens < 1.0:
|
|
83
|
+
wait = min(MAX_WAIT, (1.0 - tokens) / RATE)
|
|
84
|
+
tokens += wait * RATE
|
|
85
|
+
tokens -= 1.0
|
|
86
|
+
c.execute("INSERT OR REPLACE INTO bucket (id,tokens,updated) VALUES (1,?,?)",
|
|
87
|
+
(tokens, now + wait))
|
|
88
|
+
if wait:
|
|
89
|
+
time.sleep(wait)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# --- helpers for tests / inspection ---
|
|
93
|
+
def peek(kind, value):
|
|
94
|
+
with _conn() as c:
|
|
95
|
+
row = c.execute("SELECT status,expires FROM cache WHERE key=?",
|
|
96
|
+
(_key(kind, value),)).fetchone()
|
|
97
|
+
return {"status": row[0], "expires": row[1]} if row else None
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def clear():
|
|
101
|
+
with _conn() as c:
|
|
102
|
+
c.execute("DELETE FROM cache")
|
|
103
|
+
c.execute("DELETE FROM bucket")
|