vipi-scanner 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.
Files changed (61) hide show
  1. vipi_scanner-0.1.0/.env.example +10 -0
  2. vipi_scanner-0.1.0/.gitignore +224 -0
  3. vipi_scanner-0.1.0/LICENSE +204 -0
  4. vipi_scanner-0.1.0/PKG-INFO +156 -0
  5. vipi_scanner-0.1.0/README.md +115 -0
  6. vipi_scanner-0.1.0/docs/architecture.md +89 -0
  7. vipi_scanner-0.1.0/docs/cli.md +187 -0
  8. vipi_scanner-0.1.0/pyproject.toml +88 -0
  9. vipi_scanner-0.1.0/src/vipi/__init__.py +6 -0
  10. vipi_scanner-0.1.0/src/vipi/__main__.py +6 -0
  11. vipi_scanner-0.1.0/src/vipi/cli.py +242 -0
  12. vipi_scanner-0.1.0/src/vipi/config.py +89 -0
  13. vipi_scanner-0.1.0/src/vipi/detection/__init__.py +1 -0
  14. vipi_scanner-0.1.0/src/vipi/detection/comparison.py +70 -0
  15. vipi_scanner-0.1.0/src/vipi/detection/context.py +31 -0
  16. vipi_scanner-0.1.0/src/vipi/detection/evidence.py +112 -0
  17. vipi_scanner-0.1.0/src/vipi/detection/pipeline.py +367 -0
  18. vipi_scanner-0.1.0/src/vipi/detection/policy.py +23 -0
  19. vipi_scanner-0.1.0/src/vipi/detection/providers/__init__.py +21 -0
  20. vipi_scanner-0.1.0/src/vipi/detection/providers/http.py +51 -0
  21. vipi_scanner-0.1.0/src/vipi/detection/providers/jev.py +58 -0
  22. vipi_scanner-0.1.0/src/vipi/detection/providers/openai.py +77 -0
  23. vipi_scanner-0.1.0/src/vipi/detection/providers/prompt_guard.py +269 -0
  24. vipi_scanner-0.1.0/src/vipi/detection/verdict.py +86 -0
  25. vipi_scanner-0.1.0/src/vipi/inputs/__init__.py +5 -0
  26. vipi_scanner-0.1.0/src/vipi/inputs/files.py +83 -0
  27. vipi_scanner-0.1.0/src/vipi/inputs/git.py +75 -0
  28. vipi_scanner-0.1.0/src/vipi/inputs/types.py +56 -0
  29. vipi_scanner-0.1.0/src/vipi/model_setup.py +35 -0
  30. vipi_scanner-0.1.0/src/vipi/ocr/__init__.py +1 -0
  31. vipi_scanner-0.1.0/src/vipi/ocr/engine_pool.py +47 -0
  32. vipi_scanner-0.1.0/src/vipi/ocr/engines.py +252 -0
  33. vipi_scanner-0.1.0/src/vipi/ocr/merge.py +334 -0
  34. vipi_scanner-0.1.0/src/vipi/ocr/model_files.json +52 -0
  35. vipi_scanner-0.1.0/src/vipi/ocr/models.py +118 -0
  36. vipi_scanner-0.1.0/src/vipi/ocr/pipeline.py +267 -0
  37. vipi_scanner-0.1.0/src/vipi/ocr/runtime.py +126 -0
  38. vipi_scanner-0.1.0/src/vipi/ocr/session.py +71 -0
  39. vipi_scanner-0.1.0/src/vipi/ocr/transforms.py +254 -0
  40. vipi_scanner-0.1.0/src/vipi/ocr/workers.py +12 -0
  41. vipi_scanner-0.1.0/src/vipi/reporting.py +56 -0
  42. vipi_scanner-0.1.0/src/vipi/results.py +93 -0
  43. vipi_scanner-0.1.0/src/vipi/scanner.py +149 -0
  44. vipi_scanner-0.1.0/src/vipi/storage/__init__.py +1 -0
  45. vipi_scanner-0.1.0/src/vipi/storage/detection.py +120 -0
  46. vipi_scanner-0.1.0/src/vipi/storage/events.py +20 -0
  47. vipi_scanner-0.1.0/src/vipi/storage/files.py +29 -0
  48. vipi_scanner-0.1.0/src/vipi/storage/ocr.py +146 -0
  49. vipi_scanner-0.1.0/tests/conftest.py +25 -0
  50. vipi_scanner-0.1.0/tests/fixtures/merge_readings.json +1 -0
  51. vipi_scanner-0.1.0/tests/integration/test_detector.py +565 -0
  52. vipi_scanner-0.1.0/tests/integration/test_pipeline.py +283 -0
  53. vipi_scanner-0.1.0/tests/integration/test_vipi_cli.py +418 -0
  54. vipi_scanner-0.1.0/tests/unit/test_architecture.py +121 -0
  55. vipi_scanner-0.1.0/tests/unit/test_detector_config.py +55 -0
  56. vipi_scanner-0.1.0/tests/unit/test_engines.py +67 -0
  57. vipi_scanner-0.1.0/tests/unit/test_merge.py +209 -0
  58. vipi_scanner-0.1.0/tests/unit/test_ocr_models.py +32 -0
  59. vipi_scanner-0.1.0/tests/unit/test_runtime.py +126 -0
  60. vipi_scanner-0.1.0/tests/unit/test_transforms.py +134 -0
  61. vipi_scanner-0.1.0/uv.lock +1471 -0
@@ -0,0 +1,10 @@
1
+ # Optional API keys for external detectors. Fill in only the providers you use.
2
+ TYPESAFE_API_KEY=your-typesafe-api-key
3
+ OPENAI_API_KEY=your-openai-api-key
4
+
5
+ # Jev also accepts JEV_API_KEY as an alias for TYPESAFE_API_KEY.
6
+ # Set only one of these two names.
7
+ # JEV_API_KEY=
8
+
9
+ # Optional: Hugging Face access for downloading restricted Prompt Guard weights.
10
+ HF_TOKEN=your-huggingface-token
@@ -0,0 +1,224 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .DS_Store
139
+ .env
140
+ .envrc
141
+ .venv
142
+ .venv-anamorpher/
143
+ .venv-ocr/
144
+ models/ocr/
145
+ models/detector/
146
+ runs/
147
+ # Local research data; research code and documentation remain trackable.
148
+ /research/datasets/data/external/
149
+ /research/datasets/data/derived/
150
+ /research/datasets/data/.cache/
151
+ /research/experiments/reports/
152
+ env/
153
+ venv/
154
+ ENV/
155
+ env.bak/
156
+ venv.bak/
157
+
158
+ # Spyder project settings
159
+ .spyderproject
160
+ .spyproject
161
+
162
+ # Rope project settings
163
+ .ropeproject
164
+
165
+ # mkdocs documentation
166
+ /site
167
+
168
+ # mypy
169
+ .mypy_cache/
170
+ .dmypy.json
171
+ dmypy.json
172
+
173
+ # Pyre type checker
174
+ .pyre/
175
+
176
+ # pytype static type analyzer
177
+ .pytype/
178
+
179
+ # Cython debug symbols
180
+ cython_debug/
181
+
182
+ # PyCharm
183
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
184
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
185
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
186
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
187
+ #.idea/
188
+
189
+ # Abstra
190
+ # Abstra is an AI-powered process automation framework.
191
+ # Ignore directories containing user credentials, local state, and settings.
192
+ # Learn more at https://abstra.io/docs
193
+ .abstra/
194
+
195
+ # Visual Studio Code
196
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
197
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
198
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
199
+ # you could uncomment the following to ignore the entire vscode folder
200
+ # .vscode/
201
+
202
+ # Ruff stuff:
203
+ .ruff_cache/
204
+
205
+ # PyPI configuration file
206
+ .pypirc
207
+
208
+ # Cursor
209
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
210
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
211
+ # refer to https://docs.cursor.com/context/ignore-files
212
+ .cursorignore
213
+ .cursorindexingignore
214
+
215
+ # Marimo
216
+ marimo/_static/
217
+ marimo/_lsp/
218
+ __marimo__/
219
+
220
+ # Temporary conversational plans; keep the directory convention visible.
221
+ .llm-plans/*
222
+
223
+ # Locally retained media that should not ship with the repository.
224
+ .local-assets/
@@ -0,0 +1,204 @@
1
+ Copyright 2026 Enian
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf
55
+ of the copyright owner. For the purposes of this definition,
56
+ "submitted" means any form of electronic, verbal, or written
57
+ communication sent to the Licensor or its representatives, including
58
+ but not limited to communication on electronic mailing lists, source
59
+ code control systems, and issue tracking systems that are managed by,
60
+ or on behalf of, the Licensor for the purpose of discussing and
61
+ improving the Work, but excluding communication that is conspicuously
62
+ marked or otherwise designated in writing by the copyright owner as
63
+ "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.5
2
+ Name: vipi-scanner
3
+ Version: 0.1.0
4
+ Summary: Scan images for visual indirect prompt injections
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: <3.13,>=3.12
8
+ Requires-Dist: python-dotenv<2,>=1.2.4
9
+ Requires-Dist: rich
10
+ Provides-Extra: detector-local
11
+ Requires-Dist: huggingface-hub>=1.32.0; extra == 'detector-local'
12
+ Requires-Dist: safetensors==0.8.0; extra == 'detector-local'
13
+ Requires-Dist: sentencepiece==0.2.1; extra == 'detector-local'
14
+ Requires-Dist: torch==2.6.0; extra == 'detector-local'
15
+ Requires-Dist: transformers==5.8.1; extra == 'detector-local'
16
+ Provides-Extra: ocr
17
+ Requires-Dist: numpy==1.26.4; extra == 'ocr'
18
+ Requires-Dist: onnxruntime==1.23.2; extra == 'ocr'
19
+ Requires-Dist: opencv-python==4.11.0.86; extra == 'ocr'
20
+ Requires-Dist: pillow==11.3.0; extra == 'ocr'
21
+ Requires-Dist: rapidocr==3.9.2; extra == 'ocr'
22
+ Requires-Dist: tensorflow==2.19.0; extra == 'ocr'
23
+ Requires-Dist: torch==2.6.0; extra == 'ocr'
24
+ Provides-Extra: ocr-cuda
25
+ Requires-Dist: numpy==1.26.4; extra == 'ocr-cuda'
26
+ Requires-Dist: nvidia-cuda-runtime-cu12<13,>=12.8; (sys_platform == 'linux' or sys_platform == 'win32') and extra == 'ocr-cuda'
27
+ Requires-Dist: onnxruntime-gpu[cuda,cudnn]==1.23.2; (sys_platform == 'linux' or sys_platform == 'win32') and extra == 'ocr-cuda'
28
+ Requires-Dist: opencv-python==4.11.0.86; extra == 'ocr-cuda'
29
+ Requires-Dist: pillow==11.3.0; extra == 'ocr-cuda'
30
+ Requires-Dist: rapidocr==3.9.2; extra == 'ocr-cuda'
31
+ Requires-Dist: tensorflow==2.19.0; extra == 'ocr-cuda'
32
+ Requires-Dist: torch==2.6.0; extra == 'ocr-cuda'
33
+ Provides-Extra: research
34
+ Requires-Dist: flask==3.1.2; extra == 'research'
35
+ Requires-Dist: huggingface-hub>=1.32.0; extra == 'research'
36
+ Requires-Dist: jsonschema>=4.26.0; extra == 'research'
37
+ Provides-Extra: test
38
+ Requires-Dist: pytest==8.4.2; extra == 'test'
39
+ Requires-Dist: ruff==0.14.0; extra == 'test'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # VIPI
43
+
44
+ <p align="center">
45
+ <img src="assets/motion/vipi-reveal.gif" alt="Animated VIPI logo reveal" width="720">
46
+ </p>
47
+
48
+ <p align="center">
49
+ Scan images for visual indirect prompt injections.
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="pyproject.toml"><img alt="Python 3.12" src="https://img.shields.io/badge/Python-3.12-3776AB?logo=python&logoColor=white"></a>
54
+ <a href="docs/cli.md#platform-validation-status"><img alt="macOS smoke-tested" src="https://img.shields.io/badge/macOS-smoke--tested-2ea44f"></a>
55
+ <a href="docs/cli.md#platform-validation-status"><img alt="Linux and Windows not tested" src="https://img.shields.io/badge/Linux%20%2F%20Windows-not%20tested-lightgrey"></a>
56
+ </p>
57
+
58
+ VIPI transforms each image through a multi-view OCR pipeline, then checks the
59
+ final recognized text with Jev, OpenAI Decisions or the local Prompt Guard model.
60
+ The public interface is a small command-line tool that can scan files,
61
+ directories and committed image changes.
62
+
63
+ ## Quick start
64
+
65
+ VIPI requires Python 3.12 and [uv](https://docs.astral.sh/uv/). Install the OCR
66
+ extra, prepare the pinned PP-OCRv6 models once, then provide a Jev API key and
67
+ scan an image. Set `TYPESAFE_API_KEY` in the environment, or copy
68
+ [`.env.example`](.env.example) to `.env` and fill in the key before scanning:
69
+
70
+ `uv venv` creates the project environment in `.venv`. `uv sync --extra ocr`
71
+ installs VIPI and its OCR dependencies into that environment. Commands run with
72
+ `uv run` use `.venv` automatically, so you do not need to activate it yourself.
73
+
74
+ ```bash
75
+ git clone https://github.com/EnXan/VIPI.git
76
+ cd VIPI
77
+ uv venv
78
+ uv sync --extra ocr
79
+ uv run vipi setup
80
+ uv run vipi scan image.png
81
+ ```
82
+
83
+ Jev also accepts `JEV_API_KEY`. Model setup downloads and verifies the pinned
84
+ OCR files; scanning does not download models.
85
+
86
+ ## Usage
87
+
88
+ ```bash
89
+ # Scan one or more images
90
+ uv run vipi scan label.png screenshot.jpg
91
+
92
+ # Scan a directory recursively and save a JSON report
93
+ uv run vipi scan ./images --output report.json
94
+
95
+ # Choose a speed/quality mode or a specific supported model
96
+ uv run vipi scan ./images --ocr-mode fast
97
+ uv run vipi scan ./images --ocr-mode balanced
98
+ uv run vipi scan ./images --ocr-model ppocr-v6-medium
99
+
100
+ # Scan committed images added or modified on a branch
101
+ uv run vipi scan . --diff origin/main --output report.json
102
+
103
+ # Choose a detector and adjust the finding threshold
104
+ uv run vipi scan image.png --detector openai --threshold 90
105
+ ```
106
+
107
+ The interface has two commands, `vipi setup` and `vipi scan`. OCR modes map
108
+ `fast` to PP-OCRv6 Tiny, `balanced` to Small and `quality` to Medium. `quality`
109
+ is the default to preserve the previous Medium behavior. `--ocr-model` selects a
110
+ supported model ID directly and overrides the mode. `vipi setup` prepares all
111
+ three models by default. The default detector is Jev with a threshold of 80 on a
112
+ 0–100 score scale. A score at the threshold counts as a finding; it is not a
113
+ calibrated probability of an attack.
114
+
115
+ For local Prompt Guard, install its optional dependencies and prepare its model:
116
+
117
+ ```bash
118
+ uv sync --extra ocr --extra detector-local
119
+ uv run vipi setup --detector prompt-guard
120
+ uv run vipi scan image.png --detector prompt-guard
121
+ ```
122
+
123
+ OpenAI uses `OPENAI_API_KEY`. Prompt Guard runs locally and requires authorized
124
+ access to its model weights. See the [CLI guide](docs/cli.md) for provider setup,
125
+ GitHub Actions examples, branch-diff behavior, cache paths and report details.
126
+
127
+ ## Results and automation
128
+
129
+ Exit codes support CI use:
130
+
131
+ | Code | Meaning |
132
+ | --- | --- |
133
+ | `0` | Scan completed without detections, or no images were selected |
134
+ | `1` | At least one image was detected |
135
+ | `2` | An error or incomplete scan occurred; errors take precedence |
136
+
137
+ VIPI provides the CLI for GitHub Actions workflows; this repository does not
138
+ currently include a packaged GitHub Action. See the [PR scan example](docs/cli.md#branch-and-pr-scans).
139
+
140
+ ## Documentation
141
+
142
+ - [CLI usage and platform validation](docs/cli.md)
143
+ - [Package architecture](docs/architecture.md)
144
+ - [Development setup and checks](docs/development.md)
145
+ - [Research workbench and datasets](research/README.md)
146
+ - [Decision records](adr-code/README.md)
147
+
148
+ A built wheel contains the `vipi` package. Research tools, datasets, model
149
+ weights and run artifacts remain outside the runtime package.
150
+
151
+ ## License
152
+
153
+ VIPI's original code, documentation and project assets are licensed under the
154
+ [Apache License, Version 2.0](LICENSE). Third-party models, dependencies,
155
+ datasets and other third-party material retain their own license terms; see
156
+ their respective notices and source projects.