jfrog / jfrog/jfrog-cli-security

pnpm handler ignores InstallCommandArgs

Open
#626 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
13
Forks
50
Avg merge
3d 48m
Merged PRs (30d)
26

Description

Describe the bug

The pnpm BOM generator ignores custom InstallCommandArgs and always runs pnpm install --ignore-scripts, unlike npm, yarn, and python handlers which respect user-provided install arguments.

Maybe I also misunderstood the internal behavior of frogbot, but this seems to be the behavior based on my experiments and my understanding of the code.

Current behavior

installProjectIfNeeded() in https://github.com/jfrog/jfrog-cli-security/blob/main/sca/bom/buildinfo/technologies/pnpm/pnpm.go#L123 hardcodes the install command:

output, err := getPnpmCmd(pnpmExecPath, dirForDependenciesCalculation, "install", npm.IgnoreScriptsFlag).GetCmd().CombinedOutput()

This will always call pnpm install --ignore-scripts.

Other handlers like the one for yarn and python respect custom arguments:

yarn:

func runYarnInstallAccordingToVersion(curWd, yarnExecPath string, installCommandArgs []string) (err error) {
    installCommandProvidedFromUser := len(installCommandArgs) != 0

    if installCommandProvidedFromUser {
        return build.RunYarnCommand(yarnExecPath, curWd, installCommandArgs...)
    }
    
    // default install command only if no custom args provided
    installCommandArgs = []string{"install"}
    // ...
}

python:

func getPipInstallArgs(requirementsFile, remoteUrl, cacheFolder, reportFileName string, customArgs ...string) []string {
    args := []string{"-m", "pip", "install"}
    // ... base args ...
    args = append(args, parseCustomArgs(remoteUrl, cacheFolder, reportFileName, customArgs...)...)
    return args
}
Reproduction steps

Configure a custom installCommand in the frogbot config file that points to a custom script, this script will not be run.

Expected behavior

When InstallCommandArgs is provided (e.g., via frogbot's installCommand: "pnpm custom-script"), pnpm should execute the custom command like other technology handlers do. My use case is that I want to run a custom script before installing dependencies, something like running pnpm run custom-script where custom-script does some preparation and then installs dependencies.

JFrog CLI-Security version

1.24.2

JFrog CLI version (if applicable)

No response

Operating system type and version

Ubuntu 24.04.3

JFrog Xray version

3.131.22

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in sca/bom/buildinfo/technologies/pnpm/pnpm.go at installProjectIfNeeded(), then compare the pnpm behavior with the referenced yarn and python handlers. Reproduce the issue with a custom frogbot installCommand and verify that the configured command is executed instead of always running pnpm install --ignore-scripts.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.