-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathpyproject.toml
More file actions
340 lines (315 loc) · 10.4 KB
/
Copy pathpyproject.toml
File metadata and controls
340 lines (315 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ethicore-engine-guardian"
dynamic = ["version"]
description = "AI Threat Protection SDK — Multi-layer security for AI applications"
readme = "README.md"
license = {file = "LICENSE"}
authors = [
{name = "Oracles Technologies LLC", email = "support@oraclestechnologies.com"},
]
maintainers = [
{name = "Oracles Technologies LLC", email = "support@oraclestechnologies.com"},
]
keywords = [
"ai-security",
"llm-security",
"agent-security",
"agent-safety",
"prompt-injection",
"jailbreak-prevention",
"adversarial-machine-learning",
"threat-intelligence",
"ai-safety",
"ai-agents",
"agentic-loop",
"proactive-security",
"multilingual",
"multimodal",
"continuous-learning",
"closed-loop-learning",
"detection",
"openai",
"anthropic",
"claude",
"gpt",
"langchain",
"guardrails",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Topic :: Security",
"Topic :: Security :: Cryptography",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: Other/Proprietary License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Natural Language :: English",
]
requires-python = ">=3.8"
# ---------------------------------------------------------------------------
# Optional dependency groups
#
# Core install (pip install ethicore-engine-guardian) includes ONLY the
# required deps from requirements.txt — no heavy ML frameworks.
#
# Provider integrations:
# pip install "ethicore-engine-guardian[openai]"
# pip install "ethicore-engine-guardian[anthropic]"
# pip install "ethicore-engine-guardian[google]"
#
# Full ML inference (transformer models via HuggingFace):
# pip install "ethicore-engine-guardian[ml]"
# NOTE: torch is ~2 GB. The SDK degrades gracefully to heuristics without it.
#
# Everything at once:
# pip install "ethicore-engine-guardian[all]"
#
# Development:
# pip install "ethicore-engine-guardian[dev]"
# ---------------------------------------------------------------------------
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.0.0",
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=6.0.0",
"mypy>=1.0.0",
"pre-commit>=3.0.0",
]
openai = ["openai>=1.0.0"]
anthropic = ["anthropic>=0.8.0"]
google = ["google-generativeai>=0.3.0"]
xai = ["openai>=1.0.0"]
deepseek = ["openai>=1.0.0"]
mistral = ["openai>=1.0.0"]
perplexity = ["openai>=1.0.0"]
# multilingual: enables language detection for Layer 8 (Multilingual Semantic Analyzer).
# Without langdetect, Layer 8 is disabled and the system runs as English-only (existing behaviour).
# Community tier: keyword heuristics for 7 languages + AdversarialLearner learned fingerprints.
# Licensed tier : add paraphrase-multilingual-minilm-l12-v2.onnx to assets_dir for 50+ languages.
multilingual = ["langdetect>=1.0.9"]
# vision: enables Layers 9-11 (OCR, steganography detection, QR/barcode decode).
# Without these packages the visual layers are skipped and the system runs
# text-only analysis (existing behaviour — no regression).
# pytesseract also requires the Tesseract binary in PATH:
# macOS : brew install tesseract
# Ubuntu: apt install tesseract-ocr
# Windows: https://github.com/UB-Mannheim/tesseract/wiki
# pyzbar requires the zbar shared library:
# macOS : brew install zbar
# Ubuntu: apt install libzbar0
vision = [
"Pillow>=9.0.0",
"pytesseract>=0.3.10",
"pyzbar>=0.1.9",
"numpy>=1.21.0",
]
# vision2: Phase 2 enhancements — DCT stego (scipy), perceptual hashing, PaddleOCR.
# Install with: pip install "ethicore-engine-guardian[vision,vision2]"
# paddleocr is optional and large (~1 GB); only include if multilingual OCR is needed.
# opencv-python-headless is required by imagehash for some hash algorithms.
vision2 = [
"scipy>=1.7.0",
"imagehash>=4.3.1",
"opencv-python-headless>=4.8.0",
]
# video: enables Layer 12 (VideoFrameAnalyzer — frame sampling + temporal correlation).
# Also requires the ffmpeg binary in PATH:
# macOS : brew install ffmpeg
# Ubuntu: apt install ffmpeg
# Windows: https://ffmpeg.org/download.html
video = [
"ffmpeg-python>=0.2.0",
]
# browser: enables Layer 13 (BrowserContentAnalyzer — DOM-level injection detection).
# Covers CSS-hidden injection, URL injection, form injection, and inline JS analysis.
# lxml is strongly recommended for parse speed; falls back to html.parser when absent.
# Install: pip install "ethicore-engine-guardian[browser]"
browser = [
"beautifulsoup4>=4.12.0",
"lxml>=4.9.0",
]
# voice: enables Layer 14 (VoiceAnalyzer — audio/voice threat detection).
# Covers ultrasonic command injection, adversarial audio fingerprinting,
# transcript cross-verification via Whisper, silence/noise injection, and
# prosody anomaly scoring. Also handles video files — audio is extracted
# automatically via ffmpeg-python when a video path is supplied.
# Install: pip install "ethicore-engine-guardian[voice]"
# Note: faster-whisper requires the ctranslate2 binary (~200 MB on first run).
# Override Whisper model size with env var: GUARDIAN_WHISPER_MODEL=tiny
voice = [
"librosa>=0.10.0",
"soundfile>=0.12.0",
"pydub>=0.25.0",
"faster-whisper>=1.0.0",
"ffmpeg-python>=0.2.0", # shared with [video]; also needed for video audio extraction
]
# ml: enables full transformer-based ML inference in MLInferenceEngine.
# Without these packages the engine runs its built-in heuristic fallback,
# which is still effective but less accurate than a fine-tuned classifier.
ml = [
# <5 upper-bound: CVE-2026-1839 fix is 5.0.0rc3 (pre-release).
# Revisit and remove this cap once transformers 5.0.0 stable ships.
"transformers>=4.21.0,<6",
"torch>=1.12.0",
]
# all: every provider + full ML inference + vision (Phase 1 + Phase 2).
# paddleocr excluded from 'all' due to size — install separately if needed.
all = [
"openai>=1.0.0",
"anthropic>=0.8.0",
"google-generativeai>=0.3.0",
"transformers>=4.21.0,<6", # see ml extra comment above
"torch>=1.12.0",
"langdetect>=1.0.9",
"Pillow>=9.0.0",
"pytesseract>=0.3.10",
"pyzbar>=0.1.9",
"numpy>=1.21.0",
"scipy>=1.7.0",
"imagehash>=4.3.1",
"opencv-python-headless>=4.8.0",
"beautifulsoup4>=4.12.0",
"lxml>=4.9.0",
# voice (Layer 14)
"librosa>=0.10.0",
"soundfile>=0.12.0",
"pydub>=0.25.0",
"faster-whisper>=1.0.0",
]
[project.urls]
Homepage = "https://oraclestechnologies.com/guardian"
Documentation = "https://github.com/OraclesTech/guardian-sdk#readme"
Repository = "https://github.com/OraclesTech/guardian-sdk.git"
"Bug Tracker" = "https://github.com/OraclesTech/guardian-sdk/issues"
[project.scripts]
guardian = "ethicore_guardian.cli:main"
# ---------------------------------------------------------------------------
# Package discovery
# ---------------------------------------------------------------------------
# Explicit package list — safer than find + exclude because setuptools
# silently ignores `exclude` when `include` is also present.
# Proprietary packages (analyzers/, guardian.py) are intentionally omitted.
[tool.setuptools]
packages = [
"ethicore_guardian",
"ethicore_guardian.data",
"ethicore_guardian.models",
"ethicore_guardian.providers",
"ethicore_guardian.utils",
]
[tool.setuptools.package-data]
ethicore_guardian = [
# Public model support files — shipped in the community wheel
"models/vocab.json",
"models/special_tokens.json",
"models/ml_learning.json",
"py.typed",
# Supply chain integrity manifest (v2.6.0)
"data/integrity_manifest.json",
# The following are NOT included — distributed in the paid asset bundle only:
# models/*.onnx
# models/*.onnx.data
# models/model_signatures.json
# data/threat_embeddings.json
# data/threat_patterns_licensed.py
# analyzers/ (entire subpackage)
]
[tool.setuptools.dynamic]
version = {attr = "ethicore_guardian.__version__"}
# ---------------------------------------------------------------------------
# Tool configuration
# ---------------------------------------------------------------------------
[tool.black]
line-length = 100
target-version = ["py38", "py39", "py310", "py311"]
include = '\.pyi?$'
extend-exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
[tool.mypy]
python_version = "3.8"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
[[tool.mypy.overrides]]
module = [
"onnxruntime.*",
"scipy.*",
"tenacity.*",
"transformers.*",
"torch.*",
]
ignore_missing_imports = true
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-ra -q --strict-markers --strict-config"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
asyncio_mode = "auto"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"requires_license: skipped in community CI — needs ETHICORE_LICENSE_KEY + full asset bundle",
]
[tool.coverage.run]
source = ["ethicore_guardian"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__pycache__/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]