-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: make PURLs use oci type / fixed SBOM component name #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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9f8c03d
fix: make PURLs use oci type
dervoeti 17f506e
fix: use product name as source name in syft / SBOMs
dervoeti ea90853
fix: addressed review comments
dervoeti e3c41b6
fix: addressed comments from @NickLarsenNZ
dervoeti 0347d7d
chore: removed unnecessary curly braces
dervoeti d96caa8
fix: curly braces syntax
dervoeti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,9 +109,20 @@ runs: | |
# Extract the digest from the image repo digest (right side of '@') | ||
DIGEST=${IMAGE_REPO_DIGEST#*@} | ||
|
||
# URL encode the digest and image repository, needed for the purl | ||
URLENCODED_DIGEST=$(jq -rn --arg input "$DIGEST" '$input | @uri') | ||
URLENCODED_IMAGE_REPOSITORY=$(jq -rn --arg input "$IMAGE_REPOSITORY" '$input | @uri') | ||
# Last item, split by / | ||
# Example: sdp/kafka -> kafka | ||
SOURCE_NAME=$(echo "$IMAGE_REPOSITORY" | awk -F'/' '{print $NF}') | ||
# Extract architecture from image tag | ||
ARCH=$(echo "$IMAGE_MANIFEST_TAG" | awk -F'-' '{print $NF}') | ||
if [ "$ARCH" != "amd64" ] && [ "$ARCH" != "arm64" ]; then | ||
echo "Invalid architecture obtained from image tag. IMAGE_MANIFEST_TAG: $IMAGE_MANIFEST_TAG, ARCH: $ARCH" | ||
exit 1 | ||
fi | ||
# Construct the package url (purl) | ||
# TODO (@Techassi): Can we use 'oci' instead of 'docker' as the type? | ||
PURL="pkg:docker/$IMAGE_REPOSITORY@$DIGEST?repository_url=$REGISTRY_URI" | ||
PURL="pkg:oci/{$SOURCE_NAME}@{$URLENCODED_DIGEST}?arch=${ARCH}&repository_url=${REGISTRY_URI}%2F${URLENCODED_IMAGE_REPOSITORY}" | ||
|
||
# Get metadata from the image | ||
# NOTE (@Techassi): Maybe we should run this command only once | ||
|
@@ -123,7 +134,7 @@ runs: | |
--output [email protected]=sbom_raw.json \ | ||
--select-catalogers "-cargo-auditable-binary-cataloger,+sbom-cataloger" \ | ||
--scope all-layers \ | ||
--source-name "$IMAGE_REPOSITORY" \ | ||
--source-name "$SOURCE_NAME" \ | ||
--source-version "$IMAGE_MANIFEST_TAG" "${IMAGE_REPO_DIGEST}" | ||
|
||
# Merge SBOM components using https://github.com/stackabletech/mergebom | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.