Conversation
added 2 commits
April 20, 2026 13:16
…plugin The url_reputation plugin was missing its complete Rust implementation after migration from mcp-context-forge. This commit recovers all missing Rust source files from git history (commit 8bb308c50). Recovered files: - src/engine.rs (707 lines) - Core validation engine - src/types.rs (79 lines) - Type definitions and PyO3 bindings - src/filters/ - Heuristic, IANA TLD, and pattern filters - benches/url_validation.rs - Performance benchmarks - Enhanced test suite and documentation The plugin now has complete functionality including: - URL reputation validation with configurable policies - Heuristic entropy-based checks - IANA TLD validation - Pattern-based allow/block lists - Domain whitelist/blocklist support - HTTP/HTTPS scheme enforcement Updated Cargo.toml with required dependencies: - idna, url, regex for URL parsing and validation - phf for efficient TLD lookups - unicode-script, unicode-security for domain validation - criterion for benchmarking Fixed test imports to use cpex_url_reputation module path. Added _RUST_AVAILABLE flag for Python fallback detection. Build verification: - All 24 Rust unit tests pass - 30 out of 32 Python tests pass (2 pre-existing test issues) - Plugin compiles and installs successfully Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
The url_reputation plugin now requires the Rust implementation and will raise a clear error if the Rust module is not available, rather than falling back to a limited Python implementation. Changes: - Modified URLReputationPlugin.__init__ to raise RuntimeError if Rust module is not available - Removed all Python fallback tests (test_python_* functions) - Removed Rust error fallback test (test_rust_error_fallback_blocks_url) - Plugin now enforces Rust-only operation for consistency and performance Test results: - 22 tests passed - 9 tests skipped (Rust-specific features) - 0 tests failed This ensures users get the full Rust-powered functionality or a clear error message to install the plugin properly with 'make install'. Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
lucarlig
approved these changes
Apr 20, 2026
lucarlig
pushed a commit
that referenced
this pull request
Apr 20, 2026
… plugin (#38) * fix(plugins): recover missing Rust implementation for url_reputation plugin The url_reputation plugin was missing its complete Rust implementation after migration from mcp-context-forge. This commit recovers all missing Rust source files from git history (commit 8bb308c50). Recovered files: - src/engine.rs (707 lines) - Core validation engine - src/types.rs (79 lines) - Type definitions and PyO3 bindings - src/filters/ - Heuristic, IANA TLD, and pattern filters - benches/url_validation.rs - Performance benchmarks - Enhanced test suite and documentation The plugin now has complete functionality including: - URL reputation validation with configurable policies - Heuristic entropy-based checks - IANA TLD validation - Pattern-based allow/block lists - Domain whitelist/blocklist support - HTTP/HTTPS scheme enforcement Updated Cargo.toml with required dependencies: - idna, url, regex for URL parsing and validation - phf for efficient TLD lookups - unicode-script, unicode-security for domain validation - criterion for benchmarking Fixed test imports to use cpex_url_reputation module path. Added _RUST_AVAILABLE flag for Python fallback detection. Build verification: - All 24 Rust unit tests pass - 30 out of 32 Python tests pass (2 pre-existing test issues) - Plugin compiles and installs successfully Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com> * fix(plugins): remove Python fallback logic from url_reputation plugin The url_reputation plugin now requires the Rust implementation and will raise a clear error if the Rust module is not available, rather than falling back to a limited Python implementation. Changes: - Modified URLReputationPlugin.__init__ to raise RuntimeError if Rust module is not available - Removed all Python fallback tests (test_python_* functions) - Removed Rust error fallback test (test_rust_error_fallback_blocks_url) - Plugin now enforces Rust-only operation for consistency and performance Test results: - 22 tests passed - 9 tests skipped (Rust-specific features) - 0 tests failed This ensures users get the full Rust-powered functionality or a clear error message to install the plugin properly with 'make install'. Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com> --------- Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com> Co-authored-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com> Signed-off-by: lucarlig <luca.carlig@ibm.com>
Collaborator
Author
|
Linked to #20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #37
Summary
This PR recovers the complete Rust implementation for the
url_reputationplugin that was lost during migration frommcp-context-forgeto thecpex-pluginsmonorepo. The plugin now has full functionality with all Rust source files, tests, benchmarks, and documentation properly integrated.Problem
The
url_reputationplugin directory existed in cpex-plugins but only contained a stubsrc/lib.rsfile with minimal PyO3 boilerplate. The complete Rust implementation (707-line engine, filters, types, benchmarks) was missing, making the plugin non-functional.Solution
Recovered all missing files from
mcp-context-forgegit history (commit8bb308c50from March 22, 2026) and properly integrated them into the cpex-plugins repository structure.Changes
Recovered Rust Source Files (Commit 1: b6eae38)
Core Implementation:
src/engine.rs(707 lines) - Core URL reputation validation enginesrc/types.rs(79 lines) - Type definitions and PyO3 bindingssrc/lib.rs- Updated PyO3 module entry pointFilter Modules:
src/filters/mod.rs- Filter module declarationssrc/filters/heuristic.rs(92 lines) - Entropy-based heuristic checkssrc/filters/iana_tlds.rs(364 lines) - IANA TLD validationsrc/filters/patterns.rs(26 lines) - Pattern-based filteringBenchmarks:
benches/url_validation.rs(241 lines) - Performance benchmarksDocumentation & Support:
README.md(174 lines) - Complete usage documentationcompare_performance.py(241 lines) - Performance comparison scriptbench_config.json(280 lines) - Benchmark configurationdeny.toml(27 lines) - Cargo-deny license policyTests:
tests/test_url_reputation.py(583 lines) - Enhanced unit testsConfiguration Updates:
Cargo.tomlwith required dependencies:idna(1.1.0) - Internationalized domain name supporturl(2.5.8) - URL parsingregex(1.12.3) - Pattern matchingphf(0.13.1) - Perfect hash functions for efficient TLD lookupsunicode-script(0.5.8),unicode-security(0.1.2) - Domain validationcriterion(0.8.2) - Benchmarkingplugins.url_reputationtocpex_url_reputation_RUST_AVAILABLEflag for proper module detectionRemoved Python Fallback Logic (Commit 2: f92ba48)
URLReputationPlugin.__init__to raiseRuntimeErrorif Rust module is not availabletest_python_*functions - 9 tests)test_rust_error_fallback_blocks_url)make installif Rust module is missingFeatures
The plugin now provides complete functionality including:
Testing
Build Verification
Test Results
Rust Unit Tests:
Python Integration Tests:
Test Coverage
Breaking Changes
None. The plugin was non-functional before this PR, so this is purely additive functionality.
Migration Notes
For users who had the plugin directory but couldn't use it:
make installin the plugin directoryIf the Rust module fails to install, the plugin will raise a clear error:
Checklist
make installRelated Issues
Closes #[issue-number]
Original Implementation
The complete implementation was originally added to mcp-context-forge in:
8bb308c50fb882172131411d6854d789c27273ecAdditional Notes
This PR ensures the url_reputation plugin is fully functional and provides the high-performance Rust-based URL validation that was originally designed. The plugin is now ready for production use in the cpex-plugins ecosystem.