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

Added the option for secure_plugins_only #3247

Merged
merged 4 commits into from
Mar 8, 2023
Merged
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 app.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
"GITHUB_TOKEN": {
"description": "A github personal access token with the repo scope.",
"required": false
},
"REGISTRY_PLUGINS_ONLY": {
"description": "If set to true, only plugins that are in the registry can be loaded.",
"required": false
}
}
}
8 changes: 8 additions & 0 deletions cogs/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ async def parse_user_input(self, ctx, plugin_name, check_version=False):
plugin = Plugin(user, repo, plugin_name, branch)

else:
if not self.bot.config.get("registry_plugins_only", False):
Taaku18 marked this conversation as resolved.
Show resolved Hide resolved
embed = discord.Embed(
description="This plugin is not in the registry. "
"To install it, you must set `REGISTRY_PLUGINS_ONLY=false` in your .env file or config settings.",
color=self.bot.error_color,
)
await ctx.send(embed=embed)
return
try:
plugin = Plugin.from_string(plugin_name)
except InvalidPluginError:
Expand Down
2 changes: 2 additions & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class ConfigManager:
"connection_uri": None, # replace mongo uri in the future
"owners": None,
"enable_presence_intent": False,
"registry_plugins_only": False,
# bot
"token": None,
"enable_plugins": True,
Expand Down Expand Up @@ -223,6 +224,7 @@ class ConfigManager:
"thread_show_join_age",
"use_hoisted_top_role",
"enable_presence_intent",
"registry_plugins_only",
}

enums = {
Expand Down