-
Notifications
You must be signed in to change notification settings - Fork 11
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: add git-audit support when building the package artifacts #307
Conversation
0dcbcc9
to
19cbd9e
Compare
2689cde
to
aae32ed
Compare
As a third alternative (as discussed) here is the change that audits all packages instead of only shipping packages: index b7c0b3c..302cfad 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -60,19 +60,25 @@ jobs:
# those targets first and only builds the package if they succeed.
# Build the sdist and wheel distribution of the package and docs as a zip file.
run: make dist
+ # Generate the requirements.txt that contains the hash digests of the dependencies and
+ # generate the SBOM using CyclonDX SBOM generator.
+ - name: Generate requirements and SBOM for all packages
+ run: make requirements sbom
+ # Audit all required packages for security vulnerabilities.
+ - name: Audit required packages
+ uses: pypa/[email protected]
+ with:
+ inputs: requirements.txt
+ # Remove the old requirements.txt file (which includes _all_ packages) and generate a
+ # new one for the package and its actual and required dependencies only.
+ - name: Pruning requirements for shipping package
+ run: make prune requirements
- name: Compute package hash
if: matrix.os == env.ARTIFACT_OS && matrix.python == env.ARTIFACT_PYTHON
id: compute-hash
shell: bash
run: |
set -euo pipefail
- # Generate the requirements.txt that contains the hash digests of the dependencies and
- # generate the SBOM using CyclonDX SBOM generator.
- make requirements sbom
- # Remove the old requirements.txt file (which includes _all_ packages) and generate a
- # new one for the package and its actual and required dependencies only.
- rm requirements.txt
- make prune requirements
# Find the paths to the files that will be included in the release.
TARBALL_PATH=$(find dist -name "*.tar.gz")
WHEEL_PATH=$(find dist -name "*.whl")
@@ -85,12 +91,6 @@ jobs:
echo "Digest of artifacts is $DIGEST."
# Set the computed sha digest as the output of this job.
echo "::set-output name=artifacts-sha256::$DIGEST"
- # Audit the required packages for security vulnerabilities.
- - name: Audit required packages
- if: matrix.os == env.ARTIFACT_OS && matrix.python == env.ARTIFACT_PYTHON
- uses: pypa/[email protected]
- with:
- inputs: requirements.txt
# For now only generate artifacts for the specified OS and Python version in env variables.
# Currently reusable workflows do not support setting strategy property from the caller workflow.
- name: Upload the package artifact for debugging and release However, I think this is a disagreeable approach because the pip-audit Action installs a whole bunch of additional packages (see this run) which introduces new packages and dependencies outside of the SBOM we just created. |
Commit 2ad6a60 adds Should we mention the use of @behnazh the SBOM is generated from the @behnazh alternatively, we could remove the |
2ee985a
to
2ad6a60
Compare
See issue pypa/pip-audit#365 for the failing runs on Windows. |
b203ce9
to
541ec90
Compare
541ec90
to
b0de08c
Compare
944e607
to
9d55d0d
Compare
Related to #5 (comment): runs
git-audit
when therequirements.txt
file is generated.@behnazh this PR has two commits where I tried to use
git-audit
in two different ways:requirements.txt
file — but that adds a new dependency to thepip-audit
package for a pruned tree which makes the run a little ugly and adds a hard-wired dependency into our Makefile;requirements.txt
because we can’tgit-audit
the package itself and had to exclude it from therequirements.txt
for the audit run.*I wonder if we should document that
git-audit
runs and checks all dependent packages?—————
* And now the Action installs the
pip-audit
package…