verileak 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 (90) hide show
  1. verileak-0.1.0/.gitignore +20 -0
  2. verileak-0.1.0/CHANGELOG.md +119 -0
  3. verileak-0.1.0/LICENSE +202 -0
  4. verileak-0.1.0/LICENSES/Unicode-3.0.txt +39 -0
  5. verileak-0.1.0/NOTICE +9 -0
  6. verileak-0.1.0/PKG-INFO +236 -0
  7. verileak-0.1.0/README.md +207 -0
  8. verileak-0.1.0/benchmarks/README.md +96 -0
  9. verileak-0.1.0/benchmarks/sealed/README.md +100 -0
  10. verileak-0.1.0/pyproject.toml +148 -0
  11. verileak-0.1.0/src/verileak/__init__.py +61 -0
  12. verileak-0.1.0/src/verileak/__main__.py +5 -0
  13. verileak-0.1.0/src/verileak/_confusables.py +812 -0
  14. verileak-0.1.0/src/verileak/_macmem.py +53 -0
  15. verileak-0.1.0/src/verileak/_version.py +1 -0
  16. verileak-0.1.0/src/verileak/_winjob.py +107 -0
  17. verileak-0.1.0/src/verileak/_worker.py +93 -0
  18. verileak-0.1.0/src/verileak/adapters/__init__.py +42 -0
  19. verileak-0.1.0/src/verileak/adapters/csvfmt.py +68 -0
  20. verileak-0.1.0/src/verileak/adapters/docx.py +364 -0
  21. verileak-0.1.0/src/verileak/adapters/jsonfmt.py +114 -0
  22. verileak-0.1.0/src/verileak/adapters/pdf.py +414 -0
  23. verileak-0.1.0/src/verileak/adapters/pdf_objects.py +267 -0
  24. verileak-0.1.0/src/verileak/adapters/text.py +55 -0
  25. verileak-0.1.0/src/verileak/api.py +217 -0
  26. verileak-0.1.0/src/verileak/budget.py +74 -0
  27. verileak-0.1.0/src/verileak/cli.py +357 -0
  28. verileak-0.1.0/src/verileak/demo.py +67 -0
  29. verileak-0.1.0/src/verileak/detectors/__init__.py +14 -0
  30. verileak-0.1.0/src/verileak/detectors/base.py +39 -0
  31. verileak-0.1.0/src/verileak/detectors/builtin.py +283 -0
  32. verileak-0.1.0/src/verileak/engine.py +527 -0
  33. verileak-0.1.0/src/verileak/errors.py +56 -0
  34. verileak-0.1.0/src/verileak/expected.py +159 -0
  35. verileak-0.1.0/src/verileak/fingerprint.py +64 -0
  36. verileak-0.1.0/src/verileak/guard.py +91 -0
  37. verileak-0.1.0/src/verileak/loader.py +135 -0
  38. verileak-0.1.0/src/verileak/matching.py +143 -0
  39. verileak-0.1.0/src/verileak/model.py +294 -0
  40. verileak-0.1.0/src/verileak/normalize.py +290 -0
  41. verileak-0.1.0/src/verileak/policy.py +64 -0
  42. verileak-0.1.0/src/verileak/py.typed +0 -0
  43. verileak-0.1.0/src/verileak/pytest_plugin.py +129 -0
  44. verileak-0.1.0/src/verileak/repocheck.py +88 -0
  45. verileak-0.1.0/src/verileak/report.py +85 -0
  46. verileak-0.1.0/src/verileak/sarif.py +200 -0
  47. verileak-0.1.0/src/verileak/selftest.py +345 -0
  48. verileak-0.1.0/src/verileak/status.py +95 -0
  49. verileak-0.1.0/src/verileak/worker.py +376 -0
  50. verileak-0.1.0/tests/canaries.py +16 -0
  51. verileak-0.1.0/tests/canary_plugin.py +52 -0
  52. verileak-0.1.0/tests/docx_fixtures.py +304 -0
  53. verileak-0.1.0/tests/fuzz/harness.py +60 -0
  54. verileak-0.1.0/tests/fuzz/test_fuzz_docx.py +170 -0
  55. verileak-0.1.0/tests/fuzz/test_fuzz_pdf.py +123 -0
  56. verileak-0.1.0/tests/fuzz/test_fuzz_text_formats.py +94 -0
  57. verileak-0.1.0/tests/integration/test_adapters.py +279 -0
  58. verileak-0.1.0/tests/integration/test_cli.py +170 -0
  59. verileak-0.1.0/tests/integration/test_demo.py +83 -0
  60. verileak-0.1.0/tests/integration/test_docs.py +78 -0
  61. verileak-0.1.0/tests/integration/test_docx.py +305 -0
  62. verileak-0.1.0/tests/integration/test_failure_paths.py +118 -0
  63. verileak-0.1.0/tests/integration/test_pdf.py +270 -0
  64. verileak-0.1.0/tests/integration/test_pdf_unreferenced.py +207 -0
  65. verileak-0.1.0/tests/integration/test_precommit_hooks.py +63 -0
  66. verileak-0.1.0/tests/integration/test_pytest_plugin.py +112 -0
  67. verileak-0.1.0/tests/integration/test_sarif.py +180 -0
  68. verileak-0.1.0/tests/integration/test_selftest.py +76 -0
  69. verileak-0.1.0/tests/pdf_fixtures.py +345 -0
  70. verileak-0.1.0/tests/property/test_matching_props.py +36 -0
  71. verileak-0.1.0/tests/property/test_normalize_props.py +70 -0
  72. verileak-0.1.0/tests/property/test_status_props.py +44 -0
  73. verileak-0.1.0/tests/security/test_loader.py +126 -0
  74. verileak-0.1.0/tests/security/test_memory_watchdog.py +113 -0
  75. verileak-0.1.0/tests/security/test_parallel_workers.py +134 -0
  76. verileak-0.1.0/tests/security/test_redos.py +53 -0
  77. verileak-0.1.0/tests/security/test_repocheck.py +163 -0
  78. verileak-0.1.0/tests/security/test_worker.py +395 -0
  79. verileak-0.1.0/tests/unit/test_benchmark_separation.py +68 -0
  80. verileak-0.1.0/tests/unit/test_check_public_safety.py +89 -0
  81. verileak-0.1.0/tests/unit/test_confusables.py +120 -0
  82. verileak-0.1.0/tests/unit/test_detectors.py +160 -0
  83. verileak-0.1.0/tests/unit/test_engine.py +319 -0
  84. verileak-0.1.0/tests/unit/test_expected_fingerprint_budget.py +162 -0
  85. verileak-0.1.0/tests/unit/test_guard.py +55 -0
  86. verileak-0.1.0/tests/unit/test_matching.py +64 -0
  87. verileak-0.1.0/tests/unit/test_normalize.py +122 -0
  88. verileak-0.1.0/tests/unit/test_pdf_parsing.py +86 -0
  89. verileak-0.1.0/tests/unit/test_sealed_benchmark.py +145 -0
  90. verileak-0.1.0/tests/unit/test_status.py +143 -0
@@ -0,0 +1,20 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ build/
5
+ dist/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ .hypothesis/
11
+ .coverage
12
+ .coverage.*
13
+ coverage.xml
14
+ htmlcov/
15
+ benchmarks/results/tmp/
16
+ benchmarks/.venvs/
17
+ *.env
18
+ .env*
19
+ benchmarks/holdout/.corpus/
20
+ docs/_build/
@@ -0,0 +1,119 @@
1
+ # Changelog
2
+
3
+ All notable changes are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-12-06
10
+
11
+ First public release: 0.1.0rc1 plus the changes below. Published to PyPI
12
+ with trusted publishing, a build provenance attestation and a CycloneDX
13
+ SBOM.
14
+
15
+ ### Added
16
+ - Release workflow (PyPI trusted publishing, provenance, SBOM) and GitHub
17
+ Pages deployment for the documentation.
18
+ - The PyPI project page shows the README with working links and images
19
+ (relative links are rewritten to GitHub URLs when the package is built).
20
+ - Supported-versions table in SECURITY.md, README badges and a social
21
+ preview card.
22
+
23
+ ### Fixed
24
+ - A closed output pipe (`verileak version | head -1`) no longer prints a
25
+ traceback; the command exits with status 1.
26
+
27
+ ## [0.1.0rc1] - 2026-12-06
28
+
29
+ First release candidate. Built and verified locally; not published.
30
+
31
+ ### Changed
32
+ - macOS: the worker memory limit is now polled. The parent reads the
33
+ worker's physical footprint every 50 ms and kills it above the limit
34
+ (`limit.memory_polled`, result `ERROR`); results carry
35
+ `worker.memory_limit_polled` instead of `worker.memory_limit_unenforced`.
36
+ - Worker start-up: adapters are imported on first use, so a worker loads
37
+ only the parser its file needs (about 32% less time on a mixed set of
38
+ small files).
39
+
40
+ ### Added
41
+ - `verileak demo DIR`: six synthetic documents showing five ways redaction
42
+ fails (incremental PDF save, unreferenced PDF object, tracked deletion,
43
+ comment, JSON unicode escapes) and one correct rewrite.
44
+ - Fuzz tests for the text, Markdown, JSON and CSV adapters, including
45
+ detection of values written with JSON unicode escapes and inside quoted
46
+ CSV fields.
47
+ - GitHub Action (`action.yml`, composite): checks paths against expected
48
+ values from a secret (written to a private file, never on a command line)
49
+ or runs the built-in detectors; writes SARIF, JSON or text; outputs the
50
+ exit code. Tested in CI on Linux, Windows and macOS.
51
+ - pre-commit hooks `verileak-verify` and `verileak-scan` for PDF and DOCX.
52
+ - `verify --require-ignored`: exit 64 before scanning when an
53
+ expected-values file could be committed (used by the pre-commit hook).
54
+ - Sealed corpus kit (`benchmarks/sealed`): someone other than the author
55
+ scores VeriLeak on their own labelled files with `run.py`; `--check`
56
+ validates the manifest and hashes; result files carry no values and are
57
+ checked for them before the run ends.
58
+ - CI builds a CycloneDX 1.5 SBOM of the runtime dependencies
59
+ (`dist/verileak.cdx.json`) next to the wheel.
60
+ - `verify` warns on stderr when an expected-values file is tracked by git or
61
+ sits in a work tree without being ignored (threat T-27). The warning names
62
+ the file by its label (`file1`), never its path or values.
63
+ - `--jobs N` / `scan(jobs=N)`: up to N isolated workers at the same time,
64
+ each file still in its own fresh process; target order is unchanged.
65
+ - Structure-aware fuzz tests for the PDF and DOCX adapters (`tests/fuzz`):
66
+ every mutated file must produce a report, never print the planted value
67
+ and never report success after a failed or partial parse; lossless
68
+ repacking must keep a detected leak. A weekly CI job runs them randomised.
69
+ - Opt-in pytest plugin `verileak.pytest_plugin` with a `verileak` fixture:
70
+ `assert_absent()` fails on leaks and on anything not fully inspected;
71
+ failure messages contain no values.
72
+ - `--format sarif` and `Report.to_sarif()`: SARIF 2.1.0 output. Coverage
73
+ gaps and errors are tool notifications; allowlisted findings are
74
+ suppressions; the output guard also checks percent-decoded text.
75
+ - View V4: look-alike characters from other scripts (Unicode confusables,
76
+ UTS #39, data file 16.0.0) are matched. Such findings have the new
77
+ evidence class `KNOWN_CONFUSABLE` and severity medium.
78
+ - Verification engine.
79
+ - Statuses in precedence order: `LEAK_DETECTED`, `ERROR`, `INCOMPLETE`,
80
+ `UNSUPPORTED`, `NO_FINDINGS_WITHIN_SCOPE`. There is no "clean" state.
81
+ - A per-channel coverage record; unfinished channels cannot become
82
+ success.
83
+ - Unicode normalisation views with offset maps, and an Aho-Corasick matcher
84
+ in pure Python, with optional `pyahocorasick`.
85
+ - Expected values from files, standard input or `VERILEAK_EXPECTED_FILE`,
86
+ with short-value rejection and keyed HMAC fingerprints.
87
+ - Output guard, path and location sanitising, and hashed path style.
88
+ - File discovery with symlink and special-file safety, and bounded reading.
89
+ - Adapters for text, Markdown, JSON, JSON Lines and CSV/TSV.
90
+ - PDF adapter (technical spike):
91
+ - every revision, read through two extraction paths; the second path
92
+ also reads Form XObjects, with a cycle check and a depth limit;
93
+ - metadata, XMP, form fields, annotations, outlines and attachments;
94
+ - objects that no revision references, including members of object
95
+ streams, with per-object coverage gaps for undecodable data and a
96
+ `max_pdf_objects` bound on the reference walk.
97
+ - Worker-process isolation (default on the command line): hard timeout,
98
+ memory limit (Job Object on Windows, `RLIMIT_AS` on Linux; reported as
99
+ unenforced on macOS), JSON results validated field by field, no values on
100
+ the command line.
101
+ - `verileak selftest`: sixteen checks on synthetic files (leaks in text,
102
+ JSON, CSV, PDF page text, metadata, superseded revisions, unreferenced
103
+ objects, DOCX deleted text and comments; clean controls; fail-closed
104
+ cases) and an environment summary
105
+ without values, paths or user names. Run in CI on every platform and
106
+ against the installed wheel.
107
+ - DOCX adapter: every zip entry, two views of tracked changes, runs joined
108
+ per paragraph, comments, notes, headers and footers, authors, properties,
109
+ relationships, alt text, field codes, custom XML, embedded documents as
110
+ child targets. XML through defusedxml with DTDs forbidden; archive entry
111
+ count, entry size and nesting depth bounded; nothing extracted to disk.
112
+ - Password-protected Office files are reported as encrypted.
113
+ - Eight built-in detectors with evidence classes (validated, format,
114
+ context).
115
+ - Command line: `verileak scan`, `verileak verify`, `verileak version`.
116
+ - A 32-case synthetic baseline comparison in `benchmarks/`.
117
+
118
+ ### Known limitations
119
+ - See [docs/limitations.md](docs/limitations.md).
verileak-0.1.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.
@@ -0,0 +1,39 @@
1
+ UNICODE LICENSE V3
2
+
3
+ COPYRIGHT AND PERMISSION NOTICE
4
+
5
+ Copyright © 1991-2026 Unicode, Inc.
6
+
7
+ NOTICE TO USER: Carefully read the following legal agreement. BY
8
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
9
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
10
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
11
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a
14
+ copy of data files and any associated documentation (the "Data Files") or
15
+ software and any associated documentation (the "Software") to deal in the
16
+ Data Files or Software without restriction, including without limitation
17
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
18
+ copies of the Data Files or Software, and to permit persons to whom the
19
+ Data Files or Software are furnished to do so, provided that either (a)
20
+ this copyright and permission notice appear with all copies of the Data
21
+ Files or Software, or (b) this copyright and permission notice appear in
22
+ associated Documentation.
23
+
24
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
25
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
27
+ THIRD PARTY RIGHTS.
28
+
29
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
30
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
31
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
32
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
33
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
34
+ FILES OR SOFTWARE.
35
+
36
+ Except as contained in this notice, the name of a copyright holder shall
37
+ not be used in advertising or otherwise to promote the sale, use or other
38
+ dealings in these Data Files or Software without prior written
39
+ authorization of the copyright holder.
verileak-0.1.0/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ VeriLeak
2
+ Copyright 2026 Hamza Ali
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This product includes data derived from the Unicode Character Database
7
+ security file confusables.txt (version 16.0.0), in src/verileak/_confusables.py.
8
+ Copyright (c) 1991-2026 Unicode, Inc. Used under the Unicode License v3
9
+ (SPDX: Unicode-3.0); the full licence text is in LICENSES/Unicode-3.0.txt.
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.5
2
+ Name: verileak
3
+ Version: 0.1.0
4
+ Summary: Find what redaction missed: fail-closed verification that sensitive values are really gone from files.
5
+ Author: Hamza Ali
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: LICENSES/Unicode-3.0.txt
9
+ License-File: NOTICE
10
+ Keywords: data-leak,pdf,pii,privacy,redaction,security,verification
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Security
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: click>=8.1
24
+ Requires-Dist: defusedxml>=0.7.1
25
+ Requires-Dist: pypdf>=7.2
26
+ Provides-Extra: fast
27
+ Requires-Dist: pyahocorasick>=2.1; extra == 'fast'
28
+ Description-Content-Type: text/markdown
29
+
30
+ <picture>
31
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/HamzaAliCoder/verileak/main/docs/assets/verileak-mark-dark.svg">
32
+ <img src="https://raw.githubusercontent.com/HamzaAliCoder/verileak/main/docs/assets/verileak-mark.svg" alt="" width="72" height="72">
33
+ </picture>
34
+
35
+ # VeriLeak
36
+
37
+ [![CI](https://github.com/HamzaAliCoder/verileak/actions/workflows/ci.yml/badge.svg)](https://github.com/HamzaAliCoder/verileak/actions/workflows/ci.yml)
38
+ [![Python 3.11–3.14](https://img.shields.io/badge/python-3.11%E2%80%933.14-3776ab)](https://github.com/HamzaAliCoder/verileak/blob/main/pyproject.toml)
39
+ [![Licence: Apache-2.0](https://img.shields.io/badge/licence-Apache--2.0-0b7285)](https://github.com/HamzaAliCoder/verileak/blob/main/LICENSE)
40
+
41
+ **Find what redaction missed.**
42
+
43
+ VeriLeak checks whether sensitive values you meant to remove are really gone
44
+ from a file. It also looks in places viewers do not show: earlier PDF
45
+ revisions, metadata, annotations, attachments, form fields, JSON keys and
46
+ CSV headers.
47
+
48
+ It never prints the values it finds. It also never declares a file "clean".
49
+ The best possible result is *no findings within the inspected scope*,
50
+ together with a record of what was and was not inspected.
51
+
52
+ > **Status: alpha (0.1.0).** Interfaces may change before 1.0.
53
+
54
+ ## Try it in one minute
55
+
56
+ ```sh
57
+ pipx install verileak # or: uv tool install verileak, or: pip install verileak
58
+ verileak demo /tmp/verileak-demo # six synthetic documents, one fictional name
59
+ verileak verify /tmp/verileak-demo/documents \
60
+ --expected-file /tmp/verileak-demo/expected.txt
61
+ ```
62
+
63
+ <img src="https://raw.githubusercontent.com/HamzaAliCoder/verileak/main/docs/assets/demo.svg" alt="Output of verileak demo and verileak verify: five synthetic documents reported as LEAK_DETECTED with their channels, one as NO_FINDINGS_WITHIN_SCOPE" width="100%">
64
+
65
+ The demo folder holds five documents where redaction went wrong (an
66
+ incrementally saved PDF, a PDF object no page uses, a tracked deletion in
67
+ Word, a forgotten comment, JSON unicode escapes) and one that was rewritten
68
+ properly. VeriLeak reports the five leaks with the channel of each, and the
69
+ sixth as `NO_FINDINGS_WITHIN_SCOPE`.
70
+
71
+ ## Where it runs
72
+
73
+ | Where | How |
74
+ |---|---|
75
+ | Terminal | `verileak verify PATHS --expected-file FILE`, `verileak scan PATHS` |
76
+ | Python | `verileak.scan(...)` returns a report object |
77
+ | Tests | pytest plugin: `verileak.assert_absent(path, values=[...])` |
78
+ | Before commits | pre-commit hooks `verileak-verify`, `verileak-scan` |
79
+ | CI | GitHub Action `HamzaAliCoder/verileak`, SARIF for code scanning |
80
+
81
+ ## Why
82
+
83
+ Redaction often fails in ways that are invisible on screen:
84
+ - a black box drawn over text that is still selectable;
85
+ - an incremental save that keeps the previous version of the file;
86
+ - a name left in the document properties;
87
+ - a value that only differs by a zero-width or no-break space.
88
+
89
+ Searching the visible text misses all of these. VeriLeak verifies the file
90
+ itself.
91
+
92
+ ## Quick start
93
+
94
+ ```sh
95
+ # values to look for, one per line (never on the command line)
96
+ printf 'Zara Testperson\n' > expected.txt
97
+ verileak verify redacted.pdf --expected-file expected.txt
98
+ ```
99
+
100
+ Keep real expected-values files outside your repository, or ignored by git.
101
+ `verify` warns if one could be committed.
102
+
103
+ Real output for a synthetic PDF whose name was "redacted" by an incremental
104
+ save:
105
+
106
+ ```text
107
+ redacted.pdf [pdf] LEAK_DETECTED
108
+ high KNOWN_EXACT known-value pdf.rev.page.content_strings rev0/page1 expected:file1:1 (rev=0; only in superseded revisions; seen_by=P2)
109
+ high KNOWN_EXACT known-value pdf.rev.page.text rev0/page1 expected:file1:1 (rev=0; only in superseded revisions; seen_by=P1)
110
+ note pdf.superseded_revision
111
+ coverage: 12 channel instance(s) inspected, 0 other
112
+
113
+ Targets: 1 (1 LEAK_DETECTED)
114
+ Status: LEAK_DETECTED (exit 1)
115
+ Sensitive values were found. Values are never printed; see references.
116
+ ```
117
+
118
+ To look for common identifiers without a list of values, use the built-in
119
+ detectors:
120
+
121
+ ```sh
122
+ verileak scan exports/
123
+ ```
124
+
125
+ The output shows a reference (`expected:file1:1`) instead of the value.
126
+ Matching file and folder names are shown as `<segment#n>`.
127
+
128
+ Each file is inspected in a separate worker process with a hard timeout and
129
+ a memory limit ([details](https://github.com/HamzaAliCoder/verileak/blob/main/docs/isolation.md)). Use `--jobs 4` to run
130
+ several workers at once on large folders. To check that VeriLeak works
131
+ on your machine, run the built-in self-test. It uses synthetic files only,
132
+ and its output contains no values or paths, so you can attach it to a bug
133
+ report:
134
+
135
+ ```sh
136
+ verileak selftest
137
+ ```
138
+
139
+ For code-scanning tools, `--format sarif -o report.sarif` writes SARIF
140
+ 2.1.0. Coverage gaps appear as tool notifications, so a partly inspected file
141
+ is never shown as clean.
142
+
143
+ In CI, use the GitHub Action, and before commits, the pre-commit hooks
144
+ ([details](https://github.com/HamzaAliCoder/verileak/blob/main/docs/integrations.md)):
145
+
146
+ ```yaml
147
+ - uses: HamzaAliCoder/verileak@<tag>
148
+ with:
149
+ paths: exports/
150
+ expected-values: ${{ secrets.VERILEAK_EXPECTED }}
151
+ ```
152
+
153
+ In a test suite, enable the plugin (`pytest_plugins = ["verileak.pytest_plugin"]`)
154
+ and assert that generated files do not contain your fixture data:
155
+
156
+ ```python
157
+ def test_export(tmp_path, verileak):
158
+ verileak.assert_absent(make_export(tmp_path), values=["Zara Testperson"])
159
+ ```
160
+
161
+ ## Results and exit codes
162
+
163
+ | Status | Exit code | Meaning |
164
+ |---|---|---|
165
+ | `LEAK_DETECTED` | 1 | at least one value or detector match was found |
166
+ | `ERROR` | 3 | a target could not be processed |
167
+ | `INCOMPLETE` | 2 | something could not be inspected (limit, timeout, encryption, partial decoding) |
168
+ | `UNSUPPORTED` | 2 | a format or part is not supported (for example images without OCR) |
169
+ | `NO_FINDINGS_WITHIN_SCOPE` | 0 | nothing found in the inspected scope, which is not a guarantee |
170
+ | usage error | 64 | invalid arguments or configuration |
171
+
172
+ The worst status wins. One unreadable file in a folder makes the whole
173
+ result non-success. You can accept specific gaps on purpose, for example
174
+ `--accept-incomplete 'pdf.rev.page.image'`. Accepted gaps are listed in the
175
+ report. Errors can never be accepted.
176
+
177
+ ## What is checked
178
+
179
+ | Format | Channels |
180
+ |---|---|
181
+ | Text, Markdown | body (UTF-8, UTF-16; other encodings marked partial), HTML comments noted |
182
+ | JSON, JSON Lines | keys, strings (escapes decoded), number literals, every duplicate key |
183
+ | CSV, TSV | header, cells, and values split across neighbouring cells |
184
+ | DOCX | body, headers, footers, notes, comments, text boxes (runs joined; accepted and original views of tracked changes), hidden text, authors, field codes, alt text, bookmarks, document properties, custom XML, relationship targets, every other XML part, entry names, embedded documents |
185
+ | PDF (spike) | page text by two independent paths (the second also reads Form XObjects), every incremental revision, objects that no revision references, document info, XMP, form fields, annotations, outlines, attachments |
186
+ | All | the file name |
187
+
188
+ Matching runs on several normalised forms of the text. They handle Unicode
189
+ compatibility forms, case, zero-width characters, whitespace variants,
190
+ digits from other scripts and look-alike letters from other scripts
191
+ (Cyrillic "а" for Latin "a"). Findings say which form matched.
192
+
193
+ See [docs/limitations.md](https://github.com/HamzaAliCoder/verileak/blob/main/docs/limitations.md) for what is **not** checked and
194
+ [docs/formats.md](https://github.com/HamzaAliCoder/verileak/blob/main/docs/formats.md) for every channel ID.
195
+
196
+ ## Python API
197
+
198
+ ```python
199
+ from verileak import scan
200
+
201
+ report = scan("exports/", expected=["Zara Testperson"])
202
+ print(report.status, report.exit_code())
203
+ report.write_json("verileak-report.json") # never overwrites an existing file
204
+ ```
205
+
206
+ ## Comparison
207
+
208
+ Two **internal** synthetic benchmarks compare VeriLeak with naive text
209
+ search, raw byte search, pdftotext, x-ray and pdf-redaction-leak-checker,
210
+ each scored only within its own scope:
211
+
212
+ - a 32-case baseline ([benchmarks/README.md](https://github.com/HamzaAliCoder/verileak/blob/main/benchmarks/README.md));
213
+ - a 355-case holdout made by a separate generator
214
+ ([results and how to read them](https://github.com/HamzaAliCoder/verileak/blob/main/benchmarks/holdout/RESULTS.md)).
215
+
216
+ Both were written by VeriLeak's author and use no real documents, so they are
217
+ not evidence of real-world reliability. Read the notes before drawing
218
+ conclusions.
219
+
220
+ ## Documentation
221
+
222
+ - [Formats and channels](https://github.com/HamzaAliCoder/verileak/blob/main/docs/formats.md), [limitations](https://github.com/HamzaAliCoder/verileak/blob/main/docs/limitations.md),
223
+ [worker isolation](https://github.com/HamzaAliCoder/verileak/blob/main/docs/isolation.md)
224
+ - [Architecture](https://github.com/HamzaAliCoder/verileak/blob/main/docs/architecture.md), [threat model](https://github.com/HamzaAliCoder/verileak/blob/main/docs/threat-model.md)
225
+ - [Getting started](https://github.com/HamzaAliCoder/verileak/blob/main/docs/getting-started.md), [integrations](https://github.com/HamzaAliCoder/verileak/blob/main/docs/integrations.md) (pytest, SARIF, pre-commit, GitHub Action)
226
+ - [Benchmarks and how to reproduce them](https://github.com/HamzaAliCoder/verileak/blob/main/docs/benchmarks.md)
227
+ - [Roadmap](https://github.com/HamzaAliCoder/verileak/blob/main/ROADMAP.md), [changelog](https://github.com/HamzaAliCoder/verileak/blob/main/CHANGELOG.md), [citation](https://github.com/HamzaAliCoder/verileak/blob/main/CITATION.cff)
228
+
229
+ ## Security
230
+
231
+ See [SECURITY.md](https://github.com/HamzaAliCoder/verileak/blob/main/SECURITY.md). VeriLeak reads files and never modifies,
232
+ executes or uploads them.
233
+
234
+ ## Licence
235
+
236
+ Apache-2.0. See [LICENSE](https://github.com/HamzaAliCoder/verileak/blob/main/LICENSE) and [NOTICE](https://github.com/HamzaAliCoder/verileak/blob/main/NOTICE).