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

Fix docker extract bugs #1513

Merged
merged 3 commits into from
Dec 26, 2024
Merged

Fix docker extract bugs #1513

merged 3 commits into from
Dec 26, 2024

Conversation

prabhu
Copy link
Collaborator

@prabhu prabhu commented Dec 24, 2024

Fixes #1511

@prabhu prabhu force-pushed the fix/docker-image-extract-bugs-v2 branch from 90235a7 to 3f6bc32 Compare December 24, 2024 12:51
@prabhu prabhu marked this pull request as ready for review December 24, 2024 12:55
@prabhu
Copy link
Collaborator Author

prabhu commented Dec 25, 2024

  • Getting this error. No idea why some extracts are failing on GitHub but not locally

@prabhu prabhu force-pushed the fix/docker-image-extract-bugs-v2 branch from 7a61dc5 to 3d78683 Compare December 26, 2024 20:07
@prabhu prabhu changed the title Test docker extract bugs Fix docker extract bugs Dec 26, 2024
@prabhu prabhu marked this pull request as draft December 26, 2024 20:19
@prabhu prabhu force-pushed the fix/docker-image-extract-bugs-v2 branch from 0a08b74 to 82d88b6 Compare December 26, 2024 20:37
Signed-off-by: Prabhu Subramanian <[email protected]>

Tweaks

Signed-off-by: Prabhu Subramanian <[email protected]>

Support for fail-on-error for container sbom generation. Env variable to force non-strict tar extraction.

Signed-off-by: Prabhu Subramanian <[email protected]>

Support for fail-on-error for container sbom generation. Env variable to force non-strict tar extraction.

Signed-off-by: Prabhu Subramanian <[email protected]>

Support for fail-on-error for container sbom generation. Env variable to force non-strict tar extraction.

Signed-off-by: Prabhu Subramanian <[email protected]>
@prabhu prabhu force-pushed the fix/docker-image-extract-bugs-v2 branch from 82d88b6 to e1dcfc2 Compare December 26, 2024 20:42
@prabhu prabhu marked this pull request as ready for review December 26, 2024 21:42
… to force non-strict tar extraction.

Signed-off-by: Prabhu Subramanian <[email protected]>
@@ -50,32 +51,36 @@ jobs:
path: 'repotests/grafana-operator'
- name: dockertests
run: |
bin/cdxgen.js ubuntu:latest -t docker -o bomresults/bom-ubuntu.json
bin/cdxgen.js ubuntu:latest -t docker -o bomresults/bom-ubuntu.json --fail-on-error
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Running with --fail-on-error would improve confidence in the tests.

@@ -499,6 +499,9 @@ export function getOSPackages(src) {
}
if (osReleaseData["VERSION_ID"]) {
distro_id = `${distro_id}-${osReleaseData["VERSION_ID"]}`;
if (OS_DISTRO_ALIAS[distro_id]) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This fixes some warning for dependency tree in debian images.

@@ -29,6 +29,16 @@ import { DEBUG_MODE, getAllFiles } from "../helpers/utils.js";
export const isWin = _platform() === "win32";
export const DOCKER_HUB_REGISTRY = "docker.io";

// Should we extract the tar image in non-strict mode
const NON_STRICT_TAR_EXTRACT = ["true", "1"].includes(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is support for untar with strict: false.

["TAR_ENTRY_INFO", "TAR_ENTRY_INVALID"].includes(err.code)
) {
if (
err?.header?.path?.includes("{") ||
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have a different bug where we attempt to untar textual metadata. This condition handles this edge case.

… to force non-strict tar extraction.

Signed-off-by: Prabhu Subramanian <[email protected]>
@prabhu prabhu merged commit 363dd08 into master Dec 26, 2024
23 checks passed
@prabhu prabhu deleted the fix/docker-image-extract-bugs-v2 branch December 26, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incomplete SBOM generated from Docker image
1 participant