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

bug(docker): pip_install_keeping_cached_packages misses --no-cache #7236

Open
sersorrel opened this issue Aug 12, 2024 · 0 comments
Open

bug(docker): pip_install_keeping_cached_packages misses --no-cache #7236

sersorrel opened this issue Aug 12, 2024 · 0 comments
Labels
bug Something isn't working community Community contribution docker Docker query dockerfile query New query feature

Comments

@sersorrel
Copy link

The pip_install_keeping_cached_packages check looks only for --no-cache-dir, but ignores the fact that pip lets you abbreviate its arguments, so --no-cache works just as well.

Expected Behavior

pip install --no-cache should be sufficient to silence the warning: --no-cache is an abbreviation of --no-cache-dir. (Even --no-ca would work; --no-c is ambiguous with e.g. --no-color)

I suppose there's an argument that KICS should not encourage usage that could theoretically become ambiguous with a new version of pip, if the pip authors add a --no-cache-update argument or something, but this specific shortening seems pretty widely used – of 406k GitHub code search results for pip install "--no-cache", up to 109k of them appear to use the shortened form (pip install "--no-cache" NOT "--no-cache-dir").

Actual Behavior

KICS complains that "When installing packages with pip, the '--no-cache-dir' flag should be set to make Docker images smaller".

Steps to Reproduce the Problem

FROM python:3.12
RUN pip install --no-cache .

Specifications

(N/A if not applicable)

  • Version: "GitLab kics analyzer v4.2.1"
  • Platform: Linux amd64
  • Subsystem: Docker
@sersorrel sersorrel added bug Something isn't working community Community contribution labels Aug 12, 2024
@github-actions github-actions bot added query New query feature docker Docker query dockerfile labels Aug 12, 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 community Community contribution docker Docker query dockerfile query New query feature
Projects
None yet
Development

No branches or pull requests

1 participant