Conversation
|
Thanks for the gRPC and Unix Socket transport work, @terylt! This looks like a substantial feature with good test coverage. Since this is still in draft, just a couple of early notes:
Let us know when this is ready for a full review! |
araujof
left a comment
There was a problem hiding this comment.
Nice work on this PR, @terylt !
Architecturally, the PR looks sound.
While still in draft, here are a few comments worth looking into:
1. Security: Unix Domain Socket Permissions
The UnixSocketPluginServer creates a socket file on the filesystem to facilitate IPC.
Vulnerability: By default, Unix sockets are created using the process's umask, which often results in permissions like 0666 or 0644. This allows any local user on the system to connect to the plugin server, potentially intercepting sensitive context data or triggering unauthorized hooks. Note: asyncio.start_unix_server does not guarantee secure permissions on the created Unix domain socket file by default.
Recommendation: Explicitly set the socket file permissions to 0600 (read/write only by the owner) immediately after binding.
# After starting the server
os.chmod(self.socket_path, 0o600)2. Portability: Makefile gRPC Generation
The Makefile uses sed -i '' to fix imports in the generated gRPC Python stubs.
Logic Error: The syntax -i '' is specific to BSD sed (macOS). On GNU sed (Linux), this will fail because Linux sed does not expect a space between -i and the extension, or it will interpret the empty string as the script and the actual script as the file path.
Recommendation: Use a portable approach to handle both macOS and Linux, or use a Python script for post-processing the imports.
# Portable sed -i example
sed -i.bak 's/old/new/' file && rm file.bak|
Okay I address the comments. Note @crivetimihai I made grpc an optional package, and the unit tests will only run if grpc is installed. I don't see a way to install optional packages in the CICD, so they don't get run as part of it. |
Signed-off-by: Teryl Taylor <terylt@ibm.com>
…socket. Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
…alled. Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Teryl Taylor <terylt@ibm.com>
ebc672d to
bdbca64
Compare
Review SummaryRebased onto main (clean, no merge commits). Two conflicts resolved in Tests
ArchitectureWell-designed — follows existing external plugin patterns exactly. Both Security
Minor Items (tracked in follow-up issue)
Overall: production-quality addition, recommended for merge after follow-up items are tracked. |
…gin files Add grpcio to dev dependencies so CI installs it and grpc/unix plugin tests run during coverage checks. Exclude generated proto _pb2 files from coverage measurement. Add comprehensive tests for proto_convert, unix runtime, and extend existing test suites to cover exception handling, error dispatch, reconnection, and lifecycle edge cases. Signed-off-by: Mihai Criveti <crmihai1@ie.ibm.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
…lures Adding grpcio without grpcio-reflection caused grpc_service.py to set GRPC_AVAILABLE=True but reflection_pb2 remained None, breaking all gRPC reflection tests. Signed-off-by: Mihai Criveti <crmihai1@ie.ibm.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* feat: added grpc capabilities to plugin framework. Signed-off-by: Teryl Taylor <terylt@ibm.com> * feat: added test cases, documentation and features for gRPC and unix socket. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: added proto files to manifest. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: CI/CD failings. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: lint issues, test cases etc. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: skip grpc tests if grpc not available. Signed-off-by: Teryl Taylor <terylt@ibm.com> * cicd: excluded generated pb files from vulture. Signed-off-by: Teryl Taylor <terylt@ibm.com> * cicd: exclude pb files from main linter. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: flake8 issue. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: added conftest.py to ignore grpc doc tests when grpc is not installed. Signed-off-by: Teryl Taylor <terylt@ibm.com> * docs: updated the docs and template to support tls. Signed-off-by: Teryl Taylor <terylt@ibm.com> * fix: add grpc to dev deps and boost test coverage to 90%+ for new plugin files Add grpcio to dev dependencies so CI installs it and grpc/unix plugin tests run during coverage checks. Exclude generated proto _pb2 files from coverage measurement. Add comprehensive tests for proto_convert, unix runtime, and extend existing test suites to cover exception handling, error dispatch, reconnection, and lifecycle edge cases. Signed-off-by: Mihai Criveti <crmihai1@ie.ibm.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: add grpcio-reflection to dev deps to fix test_translate_grpc failures Adding grpcio without grpcio-reflection caused grpc_service.py to set GRPC_AVAILABLE=True but reflection_pb2 remained None, breaking all gRPC reflection tests. Signed-off-by: Mihai Criveti <crmihai1@ie.ibm.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Teryl Taylor <terylt@ibm.com> Signed-off-by: Mihai Criveti <crmihai1@ie.ibm.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Teryl Taylor <terylt@ibm.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
📝 Summary
Add gRPC and Unix Socket Transports for External Plugins
Adds two new high-performance transport options for external plugins alongside the existing MCP/HTTP transport:
Both new transports use Protocol Buffers for serialization, sharing the same plugin_service.proto schema.
gRPC Transport
Full-featured gRPC transport with optional mTLS authentication.
Supports both TCP and Unix domain sockets:
Unix Socket Transport
Lightweight, high-performance transport using length-prefixed protobuf messages directly over Unix sockets (no HTTP/2 framing overhead).
Wire format: [4-byte big-endian length][protobuf payload]
Files Added/Modified
🏷️ Type of Change
🧪 Verification
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes (optional)
Screenshots, design decisions, or additional context.