Open spiffcs opened 1 year ago
opkg
is designed to be compatible with Debian. As far as I understand, .ipk
and .opk
packages use the same or nearly the same metadata as Debian packages.
opkg
installs packages under the directory /var/lib/opkg/info/
. Rather than create an entirely new cataloger, we could just add this directory to the list of directories that the Debian cataloger searches, e.g.
func NewDpkgdbCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName).
// note: these globs have been intentionally split up in order to improve search performance,
// please do NOT combine into: "**/var/lib/dpkg/{status,status.d/*}"
WithParserByGlobs(parseDpkgDB, "**/var/lib/dpkg/status", "**/var/lib/dpkg/status.d/*", "**/var/lib/opkg/info/*", "**/var/lib/opkg/status")
}
For example, I have a branch up in my forked repo that makes this change. When I run syft on an internal image we have at my company, this is all the output I get:
$> syft mycompany.repo.com/internalimage:latest
✔ Loaded image
✔ Parsed image
✔ Cataloged packages [1 packages]
NAME VERSION TYPE
busybox ... binary
But when I build syft locally on my branch and run it against the image, I get a lot more output:
$> docker run -it anchore/syft:latest mycompany.repo.com/internalimage:latest
✔ Parsed image
✔ Cataloged packages [53 packages]
NAME VERSION TYPE
base-files ... deb
base-passwd ... deb
busybox ... binary
busybox ... deb
ca-certificates ... deb
// ...
wget ... deb
If anyone knows of a public docker image that installs packages using opkg
, let me know. I wasn't sure how to search on hub.docker.com for something like that
Heads up that openwrt/rootfs is a great image to test this feature on. Running syft as-is on openwrt/rootfs:
$> syft openwrt/rootfs
✔ Loaded image
✔ Parsed image
✔ Cataloged packages [1 packages]
NAME VERSION TYPE
busybox 0.45.6 binary
Running syft from the branch in my forked repo on openwrt/rootfs:
$> docker run anchore/syft:latest openwrt/rootfs
✔ Parsed image sha256:1bbaca497d1b2463463c525960e6556006a1785c2d03b8ea9405cc05346bc107
✔ Cataloged packages [197 packages]
NAME VERSION TYPE
base-files 1234-r12345-f1234567 deb
busybox 0.45.6 binary
busybox 0.45.6-1 deb
// ...
urngd 2023-01-21-c7f7b6b6 deb
usign 2019-01-01-abcd12345 deb
What would you like to be added: I followed these instructions to generate an Open WRT docker image: OpenWrt as a Docker Image
After scanning the image with syft I found only kernel modules being detected:
When I query the images package manager I see:
I would like the above packages to appear in the SBOM Why is this needed: Support for users who want to generate SBOM for software containerized with OpenWrt
Context:
looks like there are a bunch of flat files laying around that may indicate they are installed