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

Installing a Plug-in should not pass the plugin scoped registry as global registry on the NPM install command #2317

Closed
awharn opened this issue Oct 22, 2024 · 1 comment · Fixed by #2318
Assignees
Labels
bug Something isn't working priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases

Comments

@awharn
Copy link
Member

awharn commented Oct 22, 2024

Describe the bug

When:

  • A user does NOT have a global registry configured
  • A user has a scoped registry (i.e npm config set @zowe:registry https://zowe.jfrog.io/artifactory/api/npm/npm-local-release/)
  • The user installs a plug-in with that scope (i.e. @zowe/zos-ftp-for-zowe-cli@zowe-v3-lts)

Zowe CLI appends --registry https://zowe.jfrog.io/artifactory/api/npm/npm-local-release/ to the npm install command run behind the scenes. Since that registry might not contain certain packages such as zos-node-accessor@2.0.11, the installation might fail. The scoped registry should not be passed through as a global registry.

private locationTypeTest(plugin: string){
let isDirTest: boolean;
let installRegistry = getRegistry();
try {
isDirTest = IO.isDir(plugin);
} catch (e) {
isDirTest = false;
}
if (plugin.startsWith("@")) {
installRegistry = getScopeRegistry(
plugin.split("/")[0].substring(1)
).replace("\n", "");
} else if (
plugin.substring(plugin.lastIndexOf(".") + 1) === "tgz" ||
isDirTest
) {
installRegistry = plugin;
}
return installRegistry;
}

if (typeof params.arguments.registry === "undefined") {
installRegistry = this.locationTypeTest(plugin);
} else {
installRegistry = params.arguments.registry;
if (params.arguments.login) {
npmLogin(installRegistry);
}
}
params.response.console.log(
"Plug-ins within the Imperative CLI Framework can legitimately gain\n" +
`control of the ${ImperativeConfig.instance.rootCommandName} CLI application ` +
"during the execution of every command.\n" +
"Install 3rd party plug-ins at your own risk.\n"
);
params.response.console.log(
"Location = " + installRegistry
);
params.response.console.log(
"\n_______________________________________________________________"
);
const pluginName = await install(
`${plugin}`,
installRegistry
);

installPackages(PMFConstants.instance.PLUGIN_INSTALL_LOCATION, registry, npmPackage);

if (!(registry.substring(registry.lastIndexOf(".") + 1) === "tgz") && !isDirTest) {
args.push("--registry",registry);
}

@awharn awharn added bug Something isn't working new The issue wasn't triaged yet labels Oct 22, 2024
@github-project-automation github-project-automation bot moved this to New Issues in Zowe CLI Squad Oct 22, 2024
Copy link

Thank you for creating a bug report.
We will investigate the bug and evaluate its impact on the product.
If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

@awharn awharn changed the title Installing a Plug-in should not pass the plugin scoped registry as registry on the NPM install command Installing a Plug-in should not pass the plugin scoped registry as global registry on the NPM install command Oct 22, 2024
@t1m0thyj t1m0thyj self-assigned this Oct 23, 2024
@JTonda JTonda added priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases and removed new The issue wasn't triaged yet labels Oct 23, 2024
@zowe-robot zowe-robot moved this from New Issues to High Priority in Zowe CLI Squad Oct 23, 2024
@github-project-automation github-project-automation bot moved this from High Priority to Closed in Zowe CLI Squad Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

3 participants