jfrog / jfrog/frogbot

Python Requirement file choice is cached and reused incorrectly

Open
#1,034 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
372
Forks
107
Avg merge
2d 20h
Merged PRs (30d)
5

Description

Describe the bug
Description

tryGetRequirementFile() mutates py.pipRequirementsFile, caching the first successful file choice (setup.py or requirements.txt).

Impact
  • Handler reuse across multiple fixes or modules may target the wrong file.
  • Confusing behavior in multi-module or multi-vulnerability runs.
Suggested Fix

Avoid mutating shared state; resolve the requirement file independently per fix attempt.

Current behavior

Even if a requirements.txt file is listed, it will still mysteriously fail on not finding a pyproject.toml or setup.py on scan. Furthermore, once the handler successfully reads either setup.py or requirements.txt, it stores that filename in shared state. Subsequent fix attempts reuse that cached file path, even if it is no longer correct for later fixes or modules.

Reproduction steps

Run As Is for Python Code

Expected behavior

Each fix attempt should determine the correct manifest/requirements file for that project context:

  • Do not rely on mutable cached state that can leak across fixes/modules.
  • If multiple projects are present, selection should be scoped to the relevant project root.
  • In short: file resolution should be deterministic and isolated per fix operation.
JFrog Frogbot version

LATEST

Package manager info

PYTHON

Git provider

GitHub

JFrog Frogbot configuration yaml file

DEFAULT

Operating system type and version

ALL

JFrog Xray version

LATEST

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 with tryGetRequirementFile() and inspect how it mutates py.pipRequirementsFile during Python fix handling. Reproduce the scan with multiple modules or fixes and trace which requirement or manifest file is selected. Done means each fix resolves its file independently and selection is scoped to the relevant project root, without shared cached state.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, python
Domain
devtools, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.