-
Couldn't load subscription status.
- Fork 727
Add distro information to JSON presenter #250
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
Conversation
3fc80c2 to
17392f5
Compare
|
I was fully expecting the JSON schema to bark at me and that didn't happen... going through the |
17392f5 to
005380a
Compare
syft/presenter/json/image.go
Outdated
| } | ||
|
|
||
| func NewImage(src scope.ImageSource) *Image { | ||
| type Distro struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit, but would architecture information be a useful include field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not available information from the current parsers that provide distro information. In most cases it is looking into /etc/os-release which doesn't provide that. For example, this is Debian 8:
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the distro information belongs as a separate top-level item instead of being nested under "source":
{
"artifacts": [],
"distro": {
"name": "busybox",
"version": "1.32.0"
},
"source": {}
}That is, "source" is all about in a raw sense what the image that was cataloged is, outside of any detections made. The other sections are about what was detected from analyzing the contents (in "artifacts").
Signed-off-by: Alfredo Deza <[email protected]>
Signed-off-by: Alfredo Deza <[email protected]>
005380a to
c2cf4eb
Compare
|
@wagoodman with the latest changes, this is how this looks now: {
"artifacts": [],
"source": {
"type": "image",
"target": {
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"digest": "sha256:d2421964bad195c959ba147ad21626ccddc73a4f2638664ad1c07bd9df48a675",
"size": 1231733
}
],
"size": 1231733,
"digest": "sha256:f0b02e9d092d905d0d87a8455a1ae3e9bb47b4aa3dc125125ca5cd10d6441c9f",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"tags": [
"busybox:latest"
]
}
},
"distro": {
"name": "busybox",
"version": "1.32.0"
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Add distro information to JSON presenter
Includes distro information that gets parsed in the very beginning of the scanning process down to the JSON presenter for images.
Closes #169
Sample output (adds
distrowithintarget):