Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add plugin loading system #190

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
loads_partial,
)
from boa.network import NetworkEnv
from boa.plugins import LOAD_PLUGINS
from boa.precompile import precompile
from boa.test.strategies import fuzz

Expand Down Expand Up @@ -88,3 +89,6 @@ def _jupyter_server_extension_points() -> list[dict]:
where to find the `_load_jupyter_server_extension` function.
"""
return [{"module": "boa.integrations.jupyter"}]


LOAD_PLUGINS()
8 changes: 8 additions & 0 deletions boa/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import importlib
import pkgutil


def LOAD_PLUGINS():
for _, name, _ in pkgutil.iter_modules():
if name.startswith("boa_"):
Copy link
Collaborator

@DanielSchiavini DanielSchiavini May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a vector for a dependency poison attack 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea i think so, but any plugin discovery system is vulnerable to that unless there is a whitelist

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not installing anything

importlib.import_module(name)
Loading