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

pip install with --hash is throwing PinnedDependenciesID #4189

Closed
Tracked by #1583
johnandersen777 opened this issue Jun 22, 2024 · 5 comments
Closed
Tracked by #1583

pip install with --hash is throwing PinnedDependenciesID #4189

johnandersen777 opened this issue Jun 22, 2024 · 5 comments

Comments

@johnandersen777
Copy link

johnandersen777 commented Jun 22, 2024

            {
               "ruleId": "PinnedDependenciesID",
               "ruleIndex": 4,
               "message": {
                  "text": "score is 4: pipCommand not pinned by hash\nClick Remediation section below to solve this issue"
               },
               "locations": [
                  {
                     "physicalLocation": {
                        "region": {
                           "startLine": 8,
                           "endLine": 20,
                           "snippet": {
                              "text": "python3 -m pip install -U pip==24.1 --hash=sha256:a775837439bf5da2c1a0c2fa43d5744854497c689ddbd9344cf3ea6d00598540 --hash=sha256:bdae551038c0ce6a83030b4aedef27fc95f0daa683593fea22fa05e55ed8e317"
                           }
                        },
                        "artifactLocation": {
                           "uri": "operations/image/Dockerfile",
                           "uriBaseId": "%SRCROOT%"
                        }
                     },
                     "message": {
                        "text": "pipCommand not pinned by hash"
                     }
                  }
               ]
            }
@johnandersen777
Copy link
Author

It looks like this is because any pip install without a requirements.txt will trigger a pinning finding.

johnandersen777 pushed a commit to johnandersen777/dffml that referenced this issue Jun 22, 2024
johnandersen777 pushed a commit to johnandersen777/dffml that referenced this issue Jun 23, 2024
johnandersen777 pushed a commit to intel/dffml that referenced this issue Jun 23, 2024
@johnandersen777
Copy link
Author

            {
               "ruleId": "PinnedDependenciesID",
               "ruleIndex": 4,
               "message": {
                  "text": "score is 4: pipCommand not pinned by hash\nClick Remediation section below to solve this issue"
               },
               "locations": [
                  {
                     "physicalLocation": {
                        "region": {
                           "startLine": 8,
                           "endLine": 22,
                           "snippet": {
                              "text": "python -m pip install -r requirements-lock.txt"
                           }
                        },
                        "artifactLocation": {
                           "uri": "operations/image/Dockerfile",
                           "uriBaseId": "%SRCROOT%"
                        }
                     },
                     "message": {
                        "text": "pipCommand not pinned by hash"
                     }
                  }
               ]
            }

@johnandersen777
Copy link
Author

I don't understand, how can one pin dependencies with pip in a way scorecard recognizes? There is no example in testdata/ can someone please help?

@pnacht
Copy link
Contributor

pnacht commented Jun 24, 2024

Scorecard expects the following:

python -m pip install -r requirements-lock.txt --require-hashes

The --requre-hashes means pip will fail if the requirements file isn't hashed. Scorecard doesn't actually open the requirements file itself.

Though it probably should detect the --hash format you tried as well...

@johnandersen777
Copy link
Author

Okay great, thank you!

johnandersen777 pushed a commit to johnandersen777/dffml that referenced this issue Jun 24, 2024
johnandersen777 pushed a commit to johnandersen777/dffml that referenced this issue Jun 24, 2024
johnandersen777 pushed a commit to intel/dffml that referenced this issue Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants