The vulnerability was caused by a lack of server-side validation when installing extensions in JupyterLab. The allowed_extensions_uris setting, which is intended to restrict the extensions that can be installed, was not being enforced. This allowed an authenticated user to install any extension, including malicious ones, by sending a specially crafted POST request to the extension manager. The patch fixes this by introducing a new function, is_install_allowed, which checks if an extension is allowed to be installed based on the allowed_extensions_uris and blocked_extensions_uris settings. This function is now called before any extension is installed, effectively preventing the installation of unauthorized extensions. The vulnerable functions were jupyterlab.extensions.pypi.PyPIExtensionManager.install and jupyterlab.handlers.extension_manager_handler.ExtensionHandler.post, as they were responsible for handling the installation of extensions without proper validation.