lurescope 0.7.1__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.
- lurescope-0.7.1/LICENSE +202 -0
- lurescope-0.7.1/PKG-INFO +366 -0
- lurescope-0.7.1/README.md +320 -0
- lurescope-0.7.1/lurescope/__init__.py +8 -0
- lurescope-0.7.1/lurescope/app.py +212 -0
- lurescope-0.7.1/lurescope/cli.py +416 -0
- lurescope-0.7.1/lurescope/defense.py +108 -0
- lurescope-0.7.1/lurescope/inbox.py +255 -0
- lurescope-0.7.1/lurescope/integrations.py +158 -0
- lurescope-0.7.1/lurescope/models/tfidf-logreg-fraud.joblib +0 -0
- lurescope-0.7.1/lurescope/models.py +186 -0
- lurescope-0.7.1/lurescope/policy.py +241 -0
- lurescope-0.7.1/lurescope/proof.py +585 -0
- lurescope-0.7.1/lurescope/security.py +441 -0
- lurescope-0.7.1/lurescope/service.py +306 -0
- lurescope-0.7.1/lurescope/static/browser-engine.js +502 -0
- lurescope-0.7.1/lurescope/static/index.html +384 -0
- lurescope-0.7.1/lurescope/static/robots.txt +4 -0
- lurescope-0.7.1/lurescope/static/site.webmanifest +9 -0
- lurescope-0.7.1/lurescope/static/sitemap.xml +8 -0
- lurescope-0.7.1/lurescope/triage.py +291 -0
- lurescope-0.7.1/lurescope.egg-info/PKG-INFO +366 -0
- lurescope-0.7.1/lurescope.egg-info/SOURCES.txt +42 -0
- lurescope-0.7.1/lurescope.egg-info/dependency_links.txt +1 -0
- lurescope-0.7.1/lurescope.egg-info/entry_points.txt +2 -0
- lurescope-0.7.1/lurescope.egg-info/requires.txt +16 -0
- lurescope-0.7.1/lurescope.egg-info/top_level.txt +1 -0
- lurescope-0.7.1/pyproject.toml +94 -0
- lurescope-0.7.1/setup.cfg +4 -0
- lurescope-0.7.1/spec/decision-policy-v2.schema.json +72 -0
- lurescope-0.7.1/spec/inbox-event-v1.schema.json +99 -0
- lurescope-0.7.1/spec/inbox-summary-v1.schema.json +38 -0
- lurescope-0.7.1/spec/lureproof-dsse.schema.json +24 -0
- lurescope-0.7.1/spec/lureproof.schema.json +174 -0
- lurescope-0.7.1/tests/test_api.py +296 -0
- lurescope-0.7.1/tests/test_defense.py +47 -0
- lurescope-0.7.1/tests/test_inbox.py +198 -0
- lurescope-0.7.1/tests/test_integrations.py +112 -0
- lurescope-0.7.1/tests/test_llm_scorecard.py +104 -0
- lurescope-0.7.1/tests/test_policy.py +159 -0
- lurescope-0.7.1/tests/test_proof.py +194 -0
- lurescope-0.7.1/tests/test_scorecard.py +55 -0
- lurescope-0.7.1/tests/test_security.py +93 -0
- lurescope-0.7.1/tests/test_triage.py +91 -0
lurescope-0.7.1/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.
|
lurescope-0.7.1/PKG-INFO
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lurescope
|
|
3
|
+
Version: 0.7.1
|
|
4
|
+
Summary: Deployable fraud-lure scoring API with a live adversarial-evasion demo — the serving companion to LureBench.
|
|
5
|
+
Author: Imran Ahamed
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/immu4989/lurescope
|
|
8
|
+
Project-URL: PyPI, https://pypi.org/project/lurescope/
|
|
9
|
+
Project-URL: Demo, https://huggingface.co/spaces/immu4989/lurescope
|
|
10
|
+
Project-URL: GitHub Pages lab, https://immu4989.github.io/lurescope/
|
|
11
|
+
Project-URL: Benchmark, https://github.com/immu4989/lurebench
|
|
12
|
+
Project-URL: Changelog, https://github.com/immu4989/lurescope/blob/main/CHANGELOG.md
|
|
13
|
+
Project-URL: Issues, https://github.com/immu4989/lurescope/issues
|
|
14
|
+
Keywords: fraud,phishing,detection,adversarial,api,security
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Intended Audience :: Information Technology
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Security
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: fastapi>=0.110
|
|
32
|
+
Requires-Dist: uvicorn[standard]>=0.27
|
|
33
|
+
Requires-Dist: pydantic>=2
|
|
34
|
+
Requires-Dist: cryptography>=42
|
|
35
|
+
Requires-Dist: scikit-learn<1.7,>=1.6
|
|
36
|
+
Requires-Dist: lurebench[train]==0.9.1
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest; extra == "dev"
|
|
40
|
+
Requires-Dist: httpx; extra == "dev"
|
|
41
|
+
Requires-Dist: jsonschema>=4.23; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff<0.17,>=0.15; extra == "dev"
|
|
43
|
+
Provides-Extra: viz
|
|
44
|
+
Requires-Dist: matplotlib>=3.6; extra == "viz"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
<div align="center">
|
|
48
|
+
|
|
49
|
+
<a href="https://immu4989.github.io/lurescope/"><img src="docs/assets/lurescope-live.gif" width="100%" alt="Animated LureScope radar: score a fraud lure, watch an attack evade the detector, and verify the defense recovery."></a>
|
|
50
|
+
|
|
51
|
+
### Break your fraud detector before an attacker does
|
|
52
|
+
|
|
53
|
+
Paste a message. Measure the score. Apply an evasion. Verify whether the defense recovers.
|
|
54
|
+
|
|
55
|
+
[](https://immu4989.github.io/lurescope/)
|
|
56
|
+
[](https://huggingface.co/spaces/immu4989/lurescope)
|
|
57
|
+
[](https://github.com/immu4989/lurescope/actions/workflows/ci.yml)
|
|
58
|
+
[](https://pypi.org/project/lurescope/)
|
|
59
|
+
[](https://github.com/immu4989/lurescope/pkgs/container/lurescope)
|
|
60
|
+

|
|
61
|
+

|
|
62
|
+

|
|
63
|
+

|
|
64
|
+
[](CODE_OF_CONDUCT.md)
|
|
65
|
+
[](https://doi.org/10.5281/zenodo.21631787)
|
|
66
|
+
|
|
67
|
+
**[Open private browser lab →](https://immu4989.github.io/lurescope/)** ·
|
|
68
|
+
**[Run full local API →](#quickstart)** ·
|
|
69
|
+
**[View web UI source →](lurescope/static/index.html)**
|
|
70
|
+
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
Most fraud-scoring demos stop at "is this phishing? — 94%." That number is the easy part, and it hides the two questions that actually decide whether a detector survives production: **does it still fire when an attacker perturbs the message, and can a defense you'd actually deploy get the catch back?** LureScope answers all three. Paste a message, get a fraud score, apply an attack a real fraudster would run (`homoglyph`, `leet`, paraphrase), then flip on input normalization and see whether the detector recovers — or whether the attack was never typographic to begin with.
|
|
76
|
+
|
|
77
|
+
> **Deployment thresholds now carry inspectable evidence.** LureScope accepts
|
|
78
|
+
> LureBench schema-v2 policies with finite-sample FPR control, independently
|
|
79
|
+
> recomputes their exact statistics, and exposes assurance and limitations at
|
|
80
|
+
> `GET /policy`. See [risk-controlled policy deployment](docs/RISK_CONTROLLED_POLICY.md).
|
|
81
|
+
|
|
82
|
+
## Inbox to evidence in one command
|
|
83
|
+
|
|
84
|
+
Point LureScope at a folder of user-reported emails. It creates a private case
|
|
85
|
+
directory with one LureProof per message, a privacy-minimized JSONL manifest, and
|
|
86
|
+
an aggregate routing summary:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
lurescope inbox ./reported-emails --recursive --out ./lurescope-cases
|
|
90
|
+
|
|
91
|
+
# Offline transforms—these commands never contact Splunk, Microsoft, or a webhook
|
|
92
|
+
lurescope export ./lurescope-cases/manifest.jsonl \
|
|
93
|
+
--format splunk-hec --out ./lurescope-cases/splunk-hec.jsonl
|
|
94
|
+
lurescope export ./lurescope-cases/manifest.jsonl \
|
|
95
|
+
--format sentinel --out ./lurescope-cases/sentinel.json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The shareable outputs contain random case IDs, scores, routing actions, evidence
|
|
99
|
+
codes, resilience counts, and proof digests. They do **not** contain source paths,
|
|
100
|
+
subjects, bodies, addresses, message IDs, URL values, or attachment names. Files
|
|
101
|
+
are created private and existing output directories are never overwritten. Add
|
|
102
|
+
`--signing-key issuer.pem` to authenticate every case as a DSSE envelope. See the
|
|
103
|
+
[complete Inbox-to-LureProof workflow and SIEM mappings](docs/INBOX_TO_LUREPROOF.md).
|
|
104
|
+
|
|
105
|
+
## LureProof: a portable resilience passport
|
|
106
|
+
|
|
107
|
+
Screenshots are difficult to authenticate, vendor reports are difficult to compare, and
|
|
108
|
+
forwarding a suspicious email exposes its content. LureProof packages the useful
|
|
109
|
+
middle: **what a named control decided at a named threshold, whether four
|
|
110
|
+
adversarial edits evaded it, and whether normalization recovered the catch**—with
|
|
111
|
+
no raw body, subject, addresses, URLs, attachment names, or transformed lure text.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Unsigned evidence: strict and portable, but explicitly unauthenticated
|
|
115
|
+
lurescope proof examples/suspicious-invoice.eml -o suspicious.lureproof.json
|
|
116
|
+
lurescope verify suspicious.lureproof.json
|
|
117
|
+
|
|
118
|
+
# Authenticated evidence: in-toto Statement + standard DSSE envelope
|
|
119
|
+
lurescope keygen --private-out issuer.pem --public-out issuer.pub.pem
|
|
120
|
+
lurescope proof examples/suspicious-invoice.eml --signing-key issuer.pem \
|
|
121
|
+
--issuer "Example SOC" --nonce "verifier-challenge-123" \
|
|
122
|
+
-o suspicious.lureproof.dsse.json
|
|
123
|
+
lurescope verify suspicious.lureproof.dsse.json \
|
|
124
|
+
--public-key issuer.pub.pem --require-signature
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Prefer the browser? Run `lurescope`, open `http://127.0.0.1:8000`, choose a
|
|
128
|
+
saved `.eml`, review the triage result, and select **Download salted
|
|
129
|
+
LureProof**. The [API-backed web lab](lurescope/static/index.html) creates an
|
|
130
|
+
unsigned, strict proof through `POST /proof/email`; signing remains an explicit
|
|
131
|
+
offline CLI step.
|
|
132
|
+
|
|
133
|
+
The default uses a fresh salted subject commitment, preventing direct hash-based
|
|
134
|
+
matching between proofs; raw SHA-256 correlation is opt-in. Other fields can still
|
|
135
|
+
act as a fingerprint, so this is not an anonymity claim. Signed proofs bind
|
|
136
|
+
the exact payload and media type to an externally trusted P-256 key. They can
|
|
137
|
+
travel with a SOC ticket, control-validation report, procurement exercise, or
|
|
138
|
+
cross-organization drill without carrying live lure content. Read the
|
|
139
|
+
[format, privacy boundary, standards landscape, and public-interest use cases](docs/LUREPROOF.md).
|
|
140
|
+
|
|
141
|
+
## Triage the artifact people actually receive
|
|
142
|
+
|
|
143
|
+
LureScope now accepts raw `.eml` files—not just copied text. It safely extracts
|
|
144
|
+
visible message content and reports model evidence alongside deterministic email
|
|
145
|
+
context: Reply-To mismatch, explicit SPF/DKIM/DMARC failures, punycode and
|
|
146
|
+
IP-address links, and risky attachment filename extensions.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Human-readable result; everything runs locally by default
|
|
150
|
+
lurescope triage examples/suspicious-invoice.eml
|
|
151
|
+
|
|
152
|
+
# Help-desk queue → one structured JSON event per message
|
|
153
|
+
lurescope triage ./reported-emails --recursive --json > triage-results.jsonl
|
|
154
|
+
|
|
155
|
+
# Full case bundle → minimized manifest + one LureProof per message
|
|
156
|
+
lurescope inbox ./reported-emails --recursive --out ./lurescope-cases
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The API-backed browser lab served by `lurescope` has a **Choose .eml file**
|
|
160
|
+
workflow, and integrations can call `POST /triage/email`. LureScope never visits
|
|
161
|
+
extracted links or opens attachment contents. See
|
|
162
|
+
[real-world workflows and safety boundaries](docs/REAL_WORLD_USE_CASES.md).
|
|
163
|
+
|
|
164
|
+
| 01 · Score | 02 · Attack | 03 · Defend |
|
|
165
|
+
|:--|:--|:--|
|
|
166
|
+
| Establish the clean fraud signal and operating threshold. | Apply a deterministic or semantic evasion and measure the drop. | Normalize, re-score, and verify whether the catch is actually recovered. |
|
|
167
|
+
|
|
168
|
+
## Why this exists
|
|
169
|
+
|
|
170
|
+
A detector's clean-data accuracy is not its deployment accuracy, and the gap has structure worth seeing. LureScope makes it interactive across three moves:
|
|
171
|
+
|
|
172
|
+
**1. The score.** `tfidf-logreg` (the bundled trained baseline) catches a phishing lure at 90%; `heuristic-v0` (keyword rules) catches it at 69%.
|
|
173
|
+
|
|
174
|
+
**2. The evasion.** A single homoglyph substitution (`vеrifу` with a Cyrillic `е`) drops the keyword detector from 69% to 17% — the message walks straight through. The trained model degrades more gracefully.
|
|
175
|
+
|
|
176
|
+
**3. The defense.** Turn on `normalize` and the attacked text is folded back to ASCII before scoring; the keyword detector jumps back to 69% and the catch is recovered. But run the same defense against an `llm-paraphrase` and nothing changes — that attack rewrote the *meaning*, not the spelling, and normalization can't reach it.
|
|
177
|
+
|
|
178
|
+
That last contrast is the point. Character obfuscation is a solved problem for any detector that normalizes its input; the residual robustness gap is semantic. LureScope lets a security team see exactly which of their detectors have which kind of hole, on their own message, in ten seconds.
|
|
179
|
+
|
|
180
|
+
## Robustness scorecard
|
|
181
|
+
|
|
182
|
+
A single message is an anecdote; a rate over a corpus is a claim. Running both always-on detectors against every character attack on the 819 fraud lures in LureBench's `core/test` set gives the evasion rate — of the lures a detector caught clean, the fraction that slip below threshold after the attack — before and after the `normalize` defense:
|
|
183
|
+
|
|
184
|
+
<p align="center">
|
|
185
|
+
<img src="docs/assets/scorecard.png" width="760" alt="Heatmap of fraud-lure evasion rate by detector and attack. Raw attacks evade the keyword detector at 99-100% and the trained model at up to 38%; after normalization the homoglyph and zero-width columns drop to 0%, leet leaves a 16% residue, and whitespace is unchanged.">
|
|
186
|
+
</p>
|
|
187
|
+
|
|
188
|
+
Read the pattern, not the cells. Normalization drives the `homoglyph` and `zero-width` columns to **0%** for both detectors because it reverses them losslessly; `leet` leaves a small residue (the `1`=`i`/`l` ambiguity); `whitespace` is untouched because re-joining split words would corrupt real text. The typographic gap closes, the semantic one does not. Full table in [SCORECARD.md](SCORECARD.md), background in the [writeup](blog/2026-07-23-robustness-gap-fraud-detection.md); regenerate on any corpus with:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
python scripts/robustness_scorecard.py --data <corpus.jsonl> --out-md SCORECARD.md --out-png docs/assets/scorecard.png
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Cross-model: do LLM detectors survive?
|
|
195
|
+
|
|
196
|
+
The scorecard above uses two token detectors. The natural next question is whether an LLM-as-classifier — which reads meaning rather than tokens — survives the same attacks, and whether the semantic paraphrase is the attack that finally bites. Running the `llm-judge` detector across five models (via one OpenRouter key) over 120 fraud lures answers it:
|
|
197
|
+
|
|
198
|
+
<p align="center">
|
|
199
|
+
<img src="docs/assets/llm_scorecard.png" width="820" alt="Cross-model evasion-rate heatmap: token detectors collapse under character attacks; LLM judges are near-immune to character attacks but have lower clean recall and are most evadable under paraphrase.">
|
|
200
|
+
</p>
|
|
201
|
+
|
|
202
|
+
Three findings. First, the strong LLM judges are **essentially immune to character attacks** (0–5% evasion for the two strongest, where the keyword detector hits 100%): they read the meaning straight through the homoglyphs. Second, their clean recall here is below tfidf's 97% — but that turned out to be mostly a **threshold artifact**, not a capability gap (see the corrections below). Third, `paraphrase` is the attack that most erodes every judge: it is the worst column for four of the five, and the weakest judge (`qwen-2.5-7b`) is the most evadable at 29%.
|
|
203
|
+
|
|
204
|
+
> **Corrections.** Two published claims in this section have been revised; both are recorded in full in [LLM_SCORECARD.md](LLM_SCORECARD.md). In summary: **(2026-07-30)** the table's stated 120-lure sample was really 73 distinct records, because colliding record ids in the upstream corpus caused this script to overwrite records; judge recall was understated by 4–10 points and `deepseek-v4-flash` paraphrase evasion moved from 27% to 16%. **(2026-07-26).** This section originally read the judges' low clean recall as "immunity paid for in recall." Re-measured over the full 2,056-record `core/test` set with threshold-free metrics, the judges post an **AUC of 0.89–0.94** — they rank fraud above benign well, they are just badly calibrated at the 0.50 cut. Dropping `deepseek-v4-flash` to a 0.10 threshold lifts recall from 0.750 to 0.856 at a 2.5% false-positive rate. The character-attack immunity and the paraphrase weakness both stand; the recall trade-off does not. Details in [LLM_SCORECARD.md](LLM_SCORECARD.md), full leaderboard in [LureBench](https://github.com/immu4989/lurebench/blob/main/docs/leaderboard.md).
|
|
205
|
+
|
|
206
|
+
### Serve a risk-controlled decision policy
|
|
207
|
+
|
|
208
|
+
LureBench can now require finite-sample evidence—not merely an observed
|
|
209
|
+
validation FPR—before exporting a threshold:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
lurebench calibrate -d validation.jsonl -m tfidf-logreg \
|
|
213
|
+
--model-path models/tfidf-logreg-fraud.joblib \
|
|
214
|
+
--objective risk_controlled_fpr --target-fpr 0.01 \
|
|
215
|
+
--confidence 0.95 -o policies/tfidf-1pct-fpr-95.json
|
|
216
|
+
lurescope policy policies/tfidf-1pct-fpr-95.json
|
|
217
|
+
export LURESCOPE_POLICY_PATH=/absolute/path/to/policies/tfidf-1pct-fpr-95.json
|
|
218
|
+
uvicorn lurescope.app:app
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
When `/score` omits `threshold`, LureScope applies a configured policy whose
|
|
222
|
+
detector matches the request. The response includes `policy_id` and
|
|
223
|
+
`threshold_source=validated_policy`. An explicit request threshold remains a
|
|
224
|
+
supported override and is identified as `threshold_source=request`; with no
|
|
225
|
+
matching policy, the backward-compatible 0.5 default remains.
|
|
226
|
+
`GET /policy` reports whether the configured artifact is finite-sample
|
|
227
|
+
risk-controlled, empirical-only, or absent, along with its assumptions. Details
|
|
228
|
+
in the [deployment guide](docs/RISK_CONTROLLED_POLICY.md).
|
|
229
|
+
|
|
230
|
+
Full table and caveats in [LLM_SCORECARD.md](LLM_SCORECARD.md); reproduce with your own key and model list:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
export OPENROUTER_API_KEY=...
|
|
234
|
+
python scripts/llm_scorecard.py --data <corpus.jsonl> --limit 120 \
|
|
235
|
+
--out-md LLM_SCORECARD.md --out-png docs/assets/llm_scorecard.png
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## The detectors that matter
|
|
239
|
+
|
|
240
|
+
The headline comparison above is toy-vs-toy on purpose (it runs with zero keys, including fully in-browser). The more useful question is whether the detectors a team *actually deploys* survive the same attacks — so LureScope exposes LureBench's real detectors too:
|
|
241
|
+
|
|
242
|
+
| Detector | What it is | Runs |
|
|
243
|
+
|---|---|---|
|
|
244
|
+
| `tfidf-logreg` | Trained TF-IDF + logistic-regression baseline (bundled) | always, default |
|
|
245
|
+
| `heuristic-v0` | Dependency-free keyword rules | always |
|
|
246
|
+
| `llm-judge` | LLM-as-classifier — reads meaning, not tokens | set `LURESCOPE_LLM_ENGINE` + a provider key |
|
|
247
|
+
| `openai-moderation` | Content-safety moderation API, used as a fraud proxy | `OPENAI_API_KEY` |
|
|
248
|
+
| `llama-guard-3` | Meta Llama Guard 3 content-safety model | `torch`/`transformers` + gated weights |
|
|
249
|
+
| `binoculars` | Perplexity-based AI-generated-text detector | `torch`/`transformers` + weights |
|
|
250
|
+
|
|
251
|
+
The gated detectors are advertised in `/capabilities` with their requirement spelled out; request one without its key or weights and you get a clean `400` telling you what's missing, never a `500`.
|
|
252
|
+
|
|
253
|
+
Why this matters: in LureBench, **Llama Guard scores a 0% true-positive rate on AI-generated romance-baiting lures** even while catching tax and e-commerce scams — a content-safety model a company might trust to gate fraud is blind to a whole typology. LureScope is where you probe that failure on a single message instead of reading it off a leaderboard. (See [LureBench](https://github.com/immu4989/lurebench) for the corpus-level numbers.)
|
|
254
|
+
|
|
255
|
+
## Quickstart
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
python3 -m venv .venv
|
|
259
|
+
source .venv/bin/activate
|
|
260
|
+
python -m pip install lurescope
|
|
261
|
+
lurescope
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
For a contributor checkout, clone the repository and install the development
|
|
265
|
+
extras with `python -m pip install -e ".[dev]"`.
|
|
266
|
+
|
|
267
|
+
Keep that terminal running, then open the
|
|
268
|
+
**[full local web lab](http://127.0.0.1:8000)**. The local HTML page is
|
|
269
|
+
API-backed, so opening `lurescope/static/index.html` directly with a `file://`
|
|
270
|
+
URL will display the interface but its scoring, triage, and proof actions will
|
|
271
|
+
not work. Alternatively, use the
|
|
272
|
+
**[public browser-only demo](https://huggingface.co/spaces/immu4989/lurescope)**
|
|
273
|
+
without installing anything.
|
|
274
|
+
|
|
275
|
+
You can also call the local API directly:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Score a message
|
|
279
|
+
curl -s localhost:8000/score -H 'content-type: application/json' \
|
|
280
|
+
-d '{"text":"Verify your account within 24 hours or it will be suspended."}'
|
|
281
|
+
# -> {"fraud_probability":0.90,"label":"fraud","signals":["your","account","within","hours"], ...}
|
|
282
|
+
|
|
283
|
+
# Attack it, then defend it in one call: does the detector recover after normalization?
|
|
284
|
+
curl -s localhost:8000/attack -H 'content-type: application/json' \
|
|
285
|
+
-d '{"text":"Verify your account within 24 hours or it will be suspended.",
|
|
286
|
+
"attack":"homoglyph","detector":"heuristic-v0","defense":"normalize"}'
|
|
287
|
+
# -> {"clean_probability":0.69,"attacked_probability":0.17,"evaded":true,
|
|
288
|
+
# "defended_probability":0.69,"defense_recovered":true,"defended_evaded":false, ...}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Run it in a hardened local container instead:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
docker pull ghcr.io/immu4989/lurescope:0.7.1
|
|
295
|
+
docker run --name lurescope-local --restart unless-stopped \
|
|
296
|
+
--read-only --tmpfs /tmp:rw,noexec,nosuid,size=64m \
|
|
297
|
+
--cap-drop ALL --security-opt no-new-privileges:true \
|
|
298
|
+
-p 127.0.0.1:8000:8000 \
|
|
299
|
+
-e LURESCOPE_LLM_ENGINE=openrouter -e OPENROUTER_API_KEY \
|
|
300
|
+
ghcr.io/immu4989/lurescope:0.7.1
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
The public image supports `linux/amd64` and `linux/arm64` and carries SBOM and
|
|
304
|
+
provenance attestations. Its runtime is non-root, contains no Git or compiler
|
|
305
|
+
toolchain, carries a Docker health check, and pins the exact LureBench source
|
|
306
|
+
used by its policy verifier. To build it yourself, replace the pull with
|
|
307
|
+
`docker build -t lurescope .` and use `lurescope` as the final run argument.
|
|
308
|
+
Keep key-backed deployments on localhost unless an authenticating, rate-limiting
|
|
309
|
+
gateway is in front; otherwise public callers can spend your provider credits.
|
|
310
|
+
|
|
311
|
+
For an internet-facing deployment, enable LureScope's fail-closed public mode.
|
|
312
|
+
It requires a bearer key, rate-limits each credential, defaults to local
|
|
313
|
+
detectors, blocks arbitrary provider/model selection, and keeps provider use at
|
|
314
|
+
a zero-call budget until explicitly enabled. Follow the
|
|
315
|
+
[public deployment guardrails](docs/PUBLIC_DEPLOYMENT.md) and inspect the active
|
|
316
|
+
posture at `GET /security`.
|
|
317
|
+
|
|
318
|
+
## API
|
|
319
|
+
|
|
320
|
+
| Method | Path | Purpose |
|
|
321
|
+
|---|---|---|
|
|
322
|
+
| `GET` | `/health` | Liveness check |
|
|
323
|
+
| `GET` | `/capabilities` | Detectors (with requirements), attacks, and defenses |
|
|
324
|
+
| `GET` | `/policy` | Configured threshold, provenance, assurance evidence, and limitations |
|
|
325
|
+
| `GET` | `/security` | Non-secret authentication, rate-limit, allowlist, and provider-budget posture |
|
|
326
|
+
| `POST` | `/score` | Fraud-lure probability + the words the detector keys on |
|
|
327
|
+
| `POST` | `/attack` | Apply an attack, re-score, and (optionally) apply a defense and re-score again |
|
|
328
|
+
| `POST` | `/triage/email` | Safely parse and triage a raw RFC 5322 email |
|
|
329
|
+
| `POST` | `/proof/email` | Create a strict, privacy-minimized unsigned statement |
|
|
330
|
+
| `POST` | `/proof/verify` | Validate a statement or authenticate a signed DSSE envelope |
|
|
331
|
+
| `GET` | `/` | Interactive demo (single self-contained page) |
|
|
332
|
+
|
|
333
|
+
Interactive OpenAPI docs are served at `/docs`.
|
|
334
|
+
|
|
335
|
+
**Attacks:** four instant, dependency-free character attacks (`homoglyph`, `leet`, `zero-width`, `whitespace`) and two LLM-driven attacks (`llm-paraphrase`, `llm-keyword-evasion`). The LLM attacks use any OpenAI-compatible provider by name with your own key — set `LURESCOPE_LLM_ENGINE` (e.g. `deepseek`) and that provider's API key in the environment. They never call api.openai.com or api.anthropic.com.
|
|
336
|
+
|
|
337
|
+
**Defenses:** `none` (default) and `normalize`. Normalization strips invisible format characters, folds confusable Cyrillic/Greek letters back to Latin, and undoes in-word leet — reversing the `homoglyph` and `zero-width` attacks losslessly and `leet` for the most part. It deliberately does **not** try to re-join word-splitting (`whitespace`) or undo a paraphrase, because those can't be reversed without corrupting legitimate text. The `defense_recovered` flag tells you when normalization turned an evasion back into a catch; `defended_evaded` tells you when the attack slipped through even the defense.
|
|
338
|
+
|
|
339
|
+
## Live demo (runs in your browser)
|
|
340
|
+
|
|
341
|
+
The [Hugging Face Space](https://huggingface.co/spaces/immu4989/lurescope) is a zero-backend build of the same demo: it exports the trained model to JSON ([`space/model.json`](space/model.json)) and runs both always-on detectors and all four character attacks **entirely client-side** — no server, nothing leaves the page. The in-browser scoring replicates scikit-learn's TfidfVectorizer transform and is verified to match the Python service to four decimals. Regenerate the exported model with `python scripts/export_static_model.py`. (The key-gated detectors and the LLM-based attacks need a backend, so they live only in the API above.)
|
|
342
|
+
|
|
343
|
+
## How it relates to LureBench
|
|
344
|
+
|
|
345
|
+
LureScope reuses [LureBench](https://github.com/immu4989/lurebench)'s detectors and attacks directly (it installs `lurebench` as a dependency), so the served model and the benchmarked model are the same code — they cannot drift. LureBench is where you *measure* detectors across a corpus; LureScope is where you *serve* one, probe it on a single message, and stress it against attacks and defenses interactively.
|
|
346
|
+
|
|
347
|
+
## Responsible use
|
|
348
|
+
|
|
349
|
+
This is a defensive research tool. It scores text you supply and demonstrates evasion against your own detectors; it does not generate deliverable lures, personalize to real targets, or embed working links or payment rails. See [LureBench's DATA.md](https://github.com/immu4989/lurebench/blob/main/DATA.md) for the data and generation ethics that underpin the bundled model.
|
|
350
|
+
|
|
351
|
+
## Contributing
|
|
352
|
+
|
|
353
|
+
Contributions are welcome, especially new defenses and corrections to published
|
|
354
|
+
numbers. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup and the
|
|
355
|
+
parity bar for the browser build, [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for
|
|
356
|
+
community expectations, and [SECURITY.md](SECURITY.md) for what counts as a
|
|
357
|
+
vulnerability here (the attacks working is not one). Release history is in
|
|
358
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
359
|
+
|
|
360
|
+
## Citing
|
|
361
|
+
|
|
362
|
+
If you use LureScope in your work, see [CITATION.cff](CITATION.cff). Archived releases carry a DOI: cite the concept DOI [10.5281/zenodo.21631787](https://doi.org/10.5281/zenodo.21631787), which always resolves to the latest version.
|
|
363
|
+
|
|
364
|
+
## License
|
|
365
|
+
|
|
366
|
+
Apache-2.0.
|