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 one or more options in configuration file to disable plugin hooks #1173

Closed
henry40408 opened this issue Feb 22, 2022 · 4 comments
Closed

Comments

@henry40408
Copy link

Is your feature request related to a problem? Please describe

No.

Describe the proposed solution

I'd like to implement an option like disable_plugin_hooks or disable_plugin_{add,update,remove}_hook or both in .asdfrc:

disable_plugin_hooks = true

or

disable_plugin_add_hook = true
disable_plugin_update_hook = true
disable_plugin_remove_hook = true

...so I can review plugin before I asdf plugin add them

No breaking changes will be introduced.

Describe similar asdf features and why they are not sufficient

There is no method or option to disable plugin hooks as for v0.9.0

asdf plugin add

if [ -f "${plugin_path}/bin/post-plugin-add" ]; then
(
export ASDF_PLUGIN_SOURCE_URL=$source_url
export ASDF_PLUGIN_PATH=$plugin_path
"${plugin_path}/bin/post-plugin-add"
)
fi

asdf plugin update

if [ -f "${plugin_path}/bin/post-plugin-update" ]; then
(
export ASDF_PLUGIN_PATH=$plugin_path
export ASDF_PLUGIN_PREV_REF=$prev_ref
export ASDF_PLUGIN_POST_REF=$post_ref
"${plugin_path}/bin/post-plugin-update"
)
fi

asdf plugin remove

if [ -f "${plugin_path}/bin/pre-plugin-remove" ]; then
(
export ASDF_PLUGIN_PATH=$plugin_path
"${plugin_path}/bin/pre-plugin-remove"
)
fi

Describe other workarounds you've considered

Create a plugin to clone and checkout plugin repositories.

@weihanglo
Copy link

Second this feature. It is really useful!

@Stratus3D
Copy link
Member

Why is disabling plugin hooks necessary? I'm not sure what you mean by "so I can review plugin before I asdf plugin add them". Plugins are just a set of shell script callbacks that can be reviewed prior to asdf plugin add.

@henry40408
Copy link
Author

Hi @Stratus3D

What I actually want is version lock on plugins. Currently only repository URLs are recorded in https://github.com/asdf-vm/asdf-plugins , so generally when I asdf plugin add [plugin], asdf will clone the plugin repository on the recent commit of default branch. If maintainer's account got breached and malicious code might be injected into plugin hooks, sensitive data e.g. SSH keys on user's machine might be stolen.

I can review plugin hooks every time before I add the plugin, but I might get careless and miss the step at any moment. However, if we record commit SHA1 in https://github.com/asdf-vm/asdf-plugins , then we will have to update asdf-plugins when the downstream plugin updated, which is a lof of work. Freshness and stability are mutually exclusive.

So I maintain a clone of asdf-plugins myself, which is a set of submodules of plugin repositories. Every time I clone the repository, I can be absolutely sure that the plugin has already been reviewed by myself.

I will close this issue since what I want is different feature.

related issue: #166

@jthegedus
Copy link
Contributor

jthegedus commented Jun 26, 2022

Related #1204

Also note, you can "update" to a specific git ref to any sha: asdf plugin update <name> <git-ref>. So add then update, though not ideal, is doable. <git-ref> also accepts git tags, so tagged releases are usable. My personally maintained asdf plugins use GitHub releases, eg: asdf plugin update gcloud v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants