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

Let developers override or disable a command in a different extension #725

Open
JasonWeill opened this issue Oct 18, 2024 · 2 comments
Open
Labels

Comments

@JasonWeill
Copy link
Contributor

Problem

While investigating possible solutions for jupyterlab/jupyter-collaboration#364, I was considering disabling the docmanager:save command in JupyterLab when a user has installed and activated the jupyter-collaboration extension. However, it doesn't seem like this is supported. I found a Discourse thread from 2020–2021 in which @lodka (not necessarily the same user on Discourse as on GitHub) shared an idea that technically worked, but, as @jasongrout confirmed, was not recommended and not expected to be durable.

Proposed Solution

Allow extensions to override or disable commands in other extensions, such as by replacing a command with a no-op.

Additional context

This introduces a risk that a malicious actor could override an innocuous command to do something harmful, such as by injecting code that leaks data to an untrusted third party. Extensions that override built-in commands might require additional confirmation upon installation.

@JasonWeill JasonWeill changed the title Practice to override or disable a command in a different extension Let developers override or disable a command in a different extension Oct 18, 2024
@jasongrout
Copy link
Contributor

IIRC, the way we addressed this basic issue in the menu system, where we wanted some generic command that could have alternative implementations depending on the context (like the current document), was to make a top-level command that would delegate the work out to other extensions. So the base command essentially was making itself extensible. What do you think about making the save command extensible, rather than making an override mechanism?

@JasonWeill
Copy link
Contributor Author

Making the save command extensible would allow us to implement jupyterlab/jupyter-collaboration#364 without creating a new command for use with RTC. There is still the risk that an extension, including a safe-looking extension, might modify the save command to do something harmful with user data. Should we warn users, at least once after extension install, that the save functionality has been modified by an extension? I want to provide safety without causing alarm here.

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

No branches or pull requests

2 participants