|
34 | 34 | ToolPostInvokePayload, |
35 | 35 | ToolPostInvokeResult, |
36 | 36 | ) |
37 | | - |
38 | | -try: |
39 | | - from cpex_encoded_exfil_detection.encoded_exfil_detection_rust import ( |
40 | | - ExfilDetectorEngine, |
41 | | - py_scan_container as _py_scan_container, |
42 | | - ) |
43 | | - _RUST_IMPORT_ERROR: ImportError | None = None |
44 | | -except ImportError as _err: |
45 | | - ExfilDetectorEngine = None # type: ignore[assignment,misc] |
46 | | - _py_scan_container = None # type: ignore[assignment] |
47 | | - _RUST_IMPORT_ERROR = _err |
| 37 | +from cpex_encoded_exfil_detection.encoded_exfil_detection_rust import ( |
| 38 | + ExfilDetectorEngine, |
| 39 | + py_scan_container as _py_scan_container, |
| 40 | +) |
48 | 41 |
|
49 | 42 | logger = logging.getLogger(__name__) |
50 | 43 |
|
@@ -136,10 +129,6 @@ def _scan_container( |
136 | 129 | path: str = "", |
137 | 130 | ) -> tuple[int, Any, list[dict[str, Any]]]: |
138 | 131 | """Scan a container for encoded exfiltration patterns via the Rust engine.""" |
139 | | - if _RUST_IMPORT_ERROR is not None: |
140 | | - raise ImportError( |
141 | | - "Rust extension not built — run 'make install' before using this plugin" |
142 | | - ) from _RUST_IMPORT_ERROR |
143 | 132 | count, redacted, findings = _py_scan_container(container, cfg) |
144 | 133 | normalized = _prefix_finding_paths( |
145 | 134 | [f for f in findings if isinstance(f, dict)], |
@@ -168,10 +157,6 @@ def __init__(self, config: PluginConfig) -> None: |
168 | 157 | config: Plugin configuration. |
169 | 158 | """ |
170 | 159 | super().__init__(config) |
171 | | - if _RUST_IMPORT_ERROR is not None: |
172 | | - raise ImportError( |
173 | | - "Rust extension not built — run 'make install' before using this plugin" |
174 | | - ) from _RUST_IMPORT_ERROR |
175 | 160 | self._cfg = EncodedExfilDetectorConfig(**(config.config or {})) |
176 | 161 | try: |
177 | 162 | self._rust_engine = ExfilDetectorEngine(self._cfg) |
|
0 commit comments