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

feat: VerifyNpmPackage API with supplied tuf client #768

Open
wants to merge 49 commits into
base: main
Choose a base branch
from

Commits on May 8, 2024

  1. refactor: allow passing in an optional SigstoreTufClient

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed May 8, 2024
    Configuration menu
    Copy the full SHA
    e4c034a View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2024

  1. add Test_VerifyNpmPackage

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    1f04dce View commit details
    Browse the repository at this point in the history
  2. lint

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    7d7448b View commit details
    Browse the repository at this point in the history
  3. use sigstore-go@v0.3.0

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    6c69c5c View commit details
    Browse the repository at this point in the history
  4. make it a new function in the interface

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    d5d6f6e View commit details
    Browse the repository at this point in the history
  5. disbale parallel test for runVerify...

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    88ba4da View commit details
    Browse the repository at this point in the history
  6. feat: workflow to update actions dist (slsa-framework#760)

    Add a new Post-Commit workflow, to make these renovate-bot updates a bit
    easier.
    Previously, we had to clone the PR locally, run `make package`, and then
    push to the PR.
    Now we would just need to use the github UI to invoke this new workflow
    against the PR number.
    We could also copy this over to the slsa-github-generator repo.
    
    > A workflow to run against renovate-bot's PRs,
    > such as `make package` after it updates the package.json and
    package-lock.json files.
    > The potentially untrusted code is first run inside a low-privilege
    Job, and the diff is uploaded as an artifact.
    > Then a higher-privilege Job applies the diff and pushes the changes to
    the PR.
    > It's important to only run this workflow against PRs from trusted
    sources, after also reviewing the changes!
    
    ## Testing.
    
    Tested in my own private fork, where when applicable, it pushed a commit
    of changes to `dist/` folders
    -
    https://github.com/ramonpetgrave64/slsa-verifier/actions/runs/8806815483
      - https://github.com/ramonpetgrave64/slsa-verifier/pull/8/commits
    -
    https://github.com/ramonpetgrave64/slsa-verifier/actions/runs/8806841353
      - https://github.com/ramonpetgrave64/slsa-verifier/pull/16/commits
    
    ---------
    
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    Signed-off-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    ef7384f View commit details
    Browse the repository at this point in the history
  7. fix(deps): update dependency @actions/core to v1.10.1 (slsa-framework…

    …#717)
    
    [![Mend
    Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
    
    This PR contains the following updates:
    
    | Package | Change | Age | Adoption | Passing | Confidence |
    |---|---|---|---|---|---|
    |
    [@actions/core](https://github.com/actions/toolkit/tree/main/packages/core)
    ([source](https://github.com/actions/toolkit/tree/HEAD/packages/core))
    | [`1.10.0` ->
    `1.10.1`](https://renovatebot.com/diffs/npm/@actions%2fcore/1.10.0/1.10.1)
    |
    [![age](https://developer.mend.io/api/mc/badges/age/npm/@actions%2fcore/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@actions%2fcore/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@actions%2fcore/1.10.0/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@actions%2fcore/1.10.0/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    
    ---
    
    > [!WARNING]
    > Some dependencies could not be looked up. Check the Dependency
    Dashboard for more information.
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>actions/toolkit (@&#8203;actions/core)</summary>
    
    ###
    [`v1.10.1`](https://github.com/actions/toolkit/blob/HEAD/packages/core/RELEASES.md#1101)
    
    - Fix error message reference in oidc utils
    [#&#8203;1511](https://github.com/actions/toolkit/pull/1511)
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: Branch creation - "before 4am on the first day of the
    month" (UTC), Automerge - At any time (no schedule defined).
    
    🚦 **Automerge**: Disabled by config. Please merge this manually once you
    are satisfied.
    
    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
    rebase/retry checkbox.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about this update
    again.
    
    ---
    
    - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
    this box
    
    ---
    
    This PR has been generated by [Mend
    Renovate](https://www.mend.io/free-developer-tools/renovate/). View
    repository job log
    [here](https://developer.mend.io/github/slsa-framework/slsa-verifier).
    
    <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNy4zNDAuMTAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->
    
    ---------
    
    Signed-off-by: Mend Renovate <bot@renovateapp.com>
    Signed-off-by: github-actions <github-actions@github.com>
    Co-authored-by: github-actions <github-actions@github.com>
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    2 people authored and ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    4da9d12 View commit details
    Browse the repository at this point in the history
  8. document the new feature

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    e208b4a View commit details
    Browse the repository at this point in the history
  9. cleanup

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    3fd185e View commit details
    Browse the repository at this point in the history
  10. undo

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    f414666 View commit details
    Browse the repository at this point in the history
  11. add io readfer for attestations

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    0356825 View commit details
    Browse the repository at this point in the history
  12. add specific test

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    9d0f2b2 View commit details
    Browse the repository at this point in the history
  13. typo

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    bec1ad9 View commit details
    Browse the repository at this point in the history
  14. make attestations an io reader

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    96ea870 View commit details
    Browse the repository at this point in the history
  15. Revert "make attestations an io reader"

    This reverts commit e855e4f.
    
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    91173c1 View commit details
    Browse the repository at this point in the history
  16. builderId to builderID

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    aad1c11 View commit details
    Browse the repository at this point in the history
  17. no ioreader, better example in docs

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    0629763 View commit details
    Browse the repository at this point in the history
  18. copy testdata

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    f41e1fd View commit details
    Browse the repository at this point in the history
  19. chore: fix pr-title-checker (slsa-framework#770)

    Updates `thehanimo/pr-title-checker` to v1.4.2 and fixes the version
    comment.
    
    Signed-off-by: Ian Lewis <ianlewis@google.com>
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ianlewis authored and ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    3803a16 View commit details
    Browse the repository at this point in the history
  20. chore: Update Renovate config (slsa-framework#769)

    # Summary
    
    Updates renovate config to use the
    [`config:best-practices`](https://docs.renovatebot.com/presets-config/#configbest-practices)
    preset rather than the `config:base` preset since `config:base` seems to
    be deprecated.
    
    Also updates the `schedule` config to use the
    [`schedule:monthly`](https://docs.renovatebot.com/presets-schedule/#schedulemonthly)
    preset.
    
    Also adds a pre-submit to run the
    [`renovate-config-validator`](https://docs.renovatebot.com/config-validation/)
    to ensure that renovate config is valid. This pre-submit will need to be
    made required in the repository branch protection rule for `main` in the
    repository settings after this PR is merged.
    
    ---------
    
    Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
    Signed-off-by: Ian Lewis <ianlewis@google.com>
    Co-authored-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ianlewis and ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    efa3fa5 View commit details
    Browse the repository at this point in the history
  21. readme comments

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    3ccbce7 View commit details
    Browse the repository at this point in the history
  22. fix docstring

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    7a8a94d View commit details
    Browse the repository at this point in the history
  23. tuf to TUF initialism

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    e53b528 View commit details
    Browse the repository at this point in the history
  24. add example about utility method for making a client

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    ada0207 View commit details
    Browse the repository at this point in the history
  25. typo

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    a2cb9b9 View commit details
    Browse the repository at this point in the history
  26. undo WithSigstoreTUFClient

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    e2dcffc View commit details
    Browse the repository at this point in the history
  27. use VerifierOpts

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    a0c70c8 View commit details
    Browse the repository at this point in the history
  28. cache the verifierOpts

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    57b3797 View commit details
    Browse the repository at this point in the history
  29. use variadic for VefifierOpts

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    c9318ae View commit details
    Browse the repository at this point in the history
  30. remove NewSigstoreTufClient()

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    f1ee89d View commit details
    Browse the repository at this point in the history
  31. better docs for VerifierOpts

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    5b1c921 View commit details
    Browse the repository at this point in the history
  32. update docs

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    cde7688 View commit details
    Browse the repository at this point in the history
  33. fix: use pr_number as env variable (slsa-framework#771)

    changing the update-dist workflow to use the `pr_number` input as an env
    variable to avoid [script
    injection](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#good-practices-for-mitigating-script-injection-attacks).
    
    Our workflows are only invokable by our trusted maintainers so we should
    be okay. This is just an extra hardening measure.
    
    Open issue
    actions/runner#1070 (comment)
    
    ## Testing
    
    I confirmed the issue by invoking the workflow with `650 && echo SCRIPT
    INJECTION`, and it did also do the extra `echo` command.
    -
    https://github.com/slsa-framework/slsa-verifier/actions/runs/9101350247/job/25018333703#step:3:36
    
    after invoking the workflow again with this PR's version, the problem is
    mitigated.
    -
    https://github.com/slsa-framework/slsa-verifier/actions/runs/9101495332/job/25018812710#step:3:8
    -
    https://github.com/slsa-framework/slsa-verifier/actions/runs/9101516757/job/25018888519#step:3:7
    
    Signed-off-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    667215a View commit details
    Browse the repository at this point in the history
  34. fix: signoff commit (slsa-framework#767)

    Followup to slsa-framework#760
    
    Fix the .github/workflows/update-actions-dist-post-commit.yml workflow
    to also signoff commit
    
    # Testing
    
    - [x] Invoked this PR's branch copy of the workflow against slsa-framework#717, and it
    did signoff the commit.
    -
    slsa-framework@9670f76
    
    Signed-off-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    1bd8955 View commit details
    Browse the repository at this point in the history
  35. go mods from main

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    3a09aac View commit details
    Browse the repository at this point in the history
  36. lint

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    5845e1c View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    5356a7c View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. make GetDefaultSigstoreTUFClient() public

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    65dce19 View commit details
    Browse the repository at this point in the history
  2. cleanup test

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    8e038e4 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2024

  1. update docs

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    7268490 View commit details
    Browse the repository at this point in the history
  2. use sync.Do instead of atomic.Value

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    6cf042a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4bdc88a View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2024

  1. enable print-provenance

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    b4381c5 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2024

  1. golang to Go

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    772f659 View commit details
    Browse the repository at this point in the history
  2. tabs to spaces

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    4ca058b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8ba939a View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. change to ClientOpts, check for more than 1

    Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
    ramonpetgrave64 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    a1d45cc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    74bf48e View commit details
    Browse the repository at this point in the history