ART transport core#20386
Draft
SaschaCowley wants to merge 4 commits into
Draft
Conversation
Member
Author
|
Converted to draft pending opening an implementation roadmap |
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.
Link to issue number:
None
Summary of the issue:
NVDA needs an out-of-process, sandboxed add-on runtime (ART) to help protect against malicious and/or buggy add-ons. Before any feature work can be built, ART needs a generic, feature-agnostic transport layer to carry calls across the NVDA—add-on process boundary.
Description of user facing changes:
None, just plumbing/architecture at this point.
Description of developer facing changes:
New
_artpackage and_art.transportsubpackage, which provide the rpyc-over-pipes core that ART will use for IPC:Connection: wraps a single bidirectional rpyc connection over aStream. Exposes a localServiceto the peer and reaches the peer's root service viaremoteService. Serves peer requests either in the calling thread (eventLoop) or a background thread (bgEventLoop).Service: base class for objects exposed across the boundary. Methods are opted-in with@Service.exposed. Owns the lifecycle of dependent connections it opens and dependant services it returns;terminate()cascades teardown to both.Proxy: base class for the local-side wrapper that re-presents a remote service through NVDA's normal interface. Usable as a mixin; closes any held connections on destruction.PROTOCOL_CONFIG: the shared, deliberately restrictive rpyc protocol config.Description of development approach:
Harvested the rpyc-over-pipes transport and Service/Proxy model from the synth driver host (
_bridge), but rebuilt it feature-generic from the start (nothing synth-specific) and added the explicit lifecycle/teardown discipline from the pyro5-based ART prototype.Notes:
_art.transport.config.PROTOCOL_CONFIGsetsallow_public_attrs,allow_safe_attrs,allow_all_attrs,allow_setattr,allow_delattrandallow_pickletoFalse, so only explicitly exposed attributes/methods are available to add-ons, and remote code execution via deserialization is prevented.allow_getattrisTruebecause exposed methods are themselves reached via attribute access; with everything else locked down theexposedallowlist is all that remains reachable. Changing these settings affects the security of ART._art.transportsetsrpyc.core.vinegar.exceptions_module = builtins. This is necessary because NVDA has its own levelexceptionsmodule, which rpyc would otherwise pick up overbuiltins, breaking remote exception deserialization._bridgepatches this on the host side, but it's done globally here so it applies to both sides of the connection. The patch is idempotent.Testing strategy:
tests/unit/test_art/test_artTransport.pyexercises the transport over an in-processPipeStreamduplex pair:AttributeError);vinegarpatch);Known issues with pull request:
Code Review Checklist: