3088: add full text field for licenses to default syft-json output #3450
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.
Description
This PR updates the syft
License
model to include a newFullText
field without any breaking changes to the current license behavior. We select candidates for this new field based on if the metadata being analyzed contains any new line characters. Because we still wantValue
to be populated as it is a required field I've included a default string that will be added here whenFullText
is the selected outcome for a newly constructed license.Verification
Use the following
Dockerfile
and build a test imagedocker build -t syft-3088:latest .
Run the latest syft against this image using this branch:
go run cmd/syft/main.go -o json syft-3088 | jq '.artifacts[] | select(.name=="numpy") | { name: .name, licenses: .licenses }'
The large license value extracted from the package should now be listed under the field
fullText
withvalue
being set toFullText
to keep the field required and not incur any breaking changes.Type of change
Checklist: