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

ossf/scorecard should detect unpinned dependencies via chocolatey installer #1807

Closed
Alan-Jowett opened this issue Apr 1, 2022 · 2 comments · Fixed by #1810
Closed

ossf/scorecard should detect unpinned dependencies via chocolatey installer #1807

Alan-Jowett opened this issue Apr 1, 2022 · 2 comments · Fixed by #1810
Labels
kind/enhancement New feature or request

Comments

@Alan-Jowett
Copy link
Contributor

Is your feature request related to a problem? Please describe.
ossf/scorecard should detect unpinned dependencies via chocolatey installer.

Describe the solution you'd like
ossf/scorecard should detect unpinned dependencies via chocolatey installer.

Describe alternatives you've considered
None.

Additional context
Example:

    - name: Set up OpenCppCoverage and add to PATH
      id: setup_opencppcoverage
      run: |
        choco install OpenCppCoverage -y
        echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH

This should detect an unpinned dependency.

I think this should require something like:

choco install -y --requirechecksum=true --checksum=2295A733DA39412C61E4F478677519DD0BB1893D88313CE56B468C9E50517888 --checksum-type=sha256 OpenCppCoverage
@gossts
Copy link
Contributor

gossts commented Apr 1, 2022

Great, thanks.

So the code to update is https://github.com/ossf/scorecard/blob/main/checks/shell_download_validate.go#L632
There are calls to isPipUnpinnedDownload(), isGoUnpinnedDownload(), etc you can take as example (called in the same function).

These functions are called from https://github.com/ossf/scorecard/blob/main/checks/pinned_dependencies.go, but you don't need to change these.

If you're interested in adding support, you'll also need to add some unit tests:
https://github.com/ossf/scorecard/blob/main/checks/pinned_dependencies_test.go

You should able to use existing test files from https://github.com/ossf/scorecard/tree/main/checks/testdata by adding your example in these files.

Let me know if you're interested in helping. I can give additional help if you need.

Thanks!

@Alan-Jowett
Copy link
Contributor Author

Thanks for the pointers, I will take a stab at fixing this.

laurentsimon added a commit that referenced this issue Apr 25, 2022
* Initial support for choco installer

#1807

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Simplify if statement

Co-authored-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants