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

OSInfo: Distroless Scanner #345

Merged
merged 9 commits into from
Sep 16, 2023
Merged

Conversation

puerco
Copy link
Member

@puerco puerco commented Sep 16, 2023

What type of PR is this?

/kind bug
/kind feature

What this PR does / why we need it:

This PR adds a new OS Info image scanner to support the scanning of images based on distroless.

At this time it will read OS packages from the split dpkg database used by distroless. Support for files could be added later, the test fixtures include file data when we decide to implement it.

The layer scanner now has a function to extract directories from tarballs, I refactored the tar logic to reuse some of the code among the different tar functions.

I'm also adding two bug fixes:

  1. OCI purls were encoded wrong due to a long-running bug in the package URL go package. It should be harmless once a new release is cut.
  2. Fixes a bug in the debian image OS scanner where it would always drop the last package dropped from the database.

All the affected tests are fixed as those bugs modify data expected by the test cases.

Plus: I moved some of the needless verbose messages in the SPDX package to Debug to reduce the verbosity (this is on its own commit so it should be easy to hide when reviewing)

Which issue(s) this PR fixes:

Follow-up to #342

Special notes for your reviewer:

/assign @cpanato @saschagrunert

Does this PR introduce a user-facing change?

- `bom` now supports scanning OS packages from images based on distroless.
- Fixed a bug where `bom` would drop the last package read from the debian database
- Fixed an encoding bug in oci-typed purls where the version had an unescaped colon.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
This commit refactors some of the tarcode in the layer scanner to
reuse it some of the functions.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
This commit moves some messages to the debugger level to reduce the
verbosity of bom when running.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
This commit fixes a bug where the debian scanner would drop the
last OS pacakge read from the database

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
This commit fixes a bug in the version encoding when generating
purls from image references.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 16, 2023
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 16, 2023
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 16, 2023
@puerco
Copy link
Member Author

puerco commented Sep 16, 2023

Example generating an SBOM of the kube-apiserver image:

image

@puerco
Copy link
Member Author

puerco commented Sep 16, 2023

After this one merges we should cut a new release

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 16, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, puerco

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit f27d7ec into kubernetes-sigs:main Sep 16, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants