Skip to main content

Towards more secure containerized workloads

One element to improve the security of your software systems, is the Software Bill Of Materials(SBOM). Today most applications are build using a combination of open source and commercial software components. The SBOM lists all the components that make up the software , or were used to build it.

The concept of a BOM is well-established in traditional manufacturing as part of supply chain management.A manufacturer uses a BOM to track the parts it uses to create a product. If defects are later found in a specific part, the BOM makes it easy to locate affected products.

The recent Log4J vulnerability was a good example of why such an SBOM is important to find out if one of your systems or applications is impacted or not. Some of my customers had no idea if they were impacted or not and had to search through all there systems and applications which of course is time consuming and error-prone.

Docker sbom

Starting from Docker Desktop 4.7, a new CLI command is introduced that displays the SBOM for a docker image. This helps to make container images more transparent and gives you an easy way to see what is inside of them.

It is using the open source syft project behind the scenes.

Let’s give the command a try for one of our containers. We’ll use the masstransit/rabbitmq:latest image as an example. 

PS C:\> docker sbom masstransit/rabbitmq:latest
NAME                    VERSION                TYPE
.otp-run-deps           20211006.011020        apk
alpine-baselayout       3.2.0-r16              apk
alpine-keys             2.3-r1                 apk
apk-tools               2.12.7-r0              apk
bash                    5.1.4-r0               apk
busybox                 1.33.1-r3              apk
ca-certificates-bundle  20191127-r5            apk
expat                   2.4.1-r0               apk
gdbm                    1.19-r0                apk
libbz2                  1.0.8-r1               apk
libc-utils              0.7.2-r3               apk
libcrypto1.1            1.1.1l-r0              apk
libffi                  3.3-r2                 apk
libgcc                  10.3.1_git20210424-r2  apk
libintl                 0.21-r0                apk
libproc                 3.3.17-r0              apk
libretls                3.3.3p1-r2             apk
libssl1.1               1.1.1l-r0              apk
libstdc++               10.3.1_git20210424-r2  apk
mpdecimal               2.5.1-r1               apk
musl                    1.2.2-r3               apk
musl-utils              1.2.2-r3               apk
ncurses-libs            6.2_p20210612-r0       apk
ncurses-terminfo-base   6.2_p20210612-r0       apk
procps                  3.3.17-r0              apk
python3                 3.9.5-r1               apk
readline                8.1.0-r0               apk
scanelf                 1.3.2-r0               apk
sqlite-libs             3.35.5-r0              apk
ssl_client              1.33.1-r3              apk
su-exec                 0.2-r1                 apk
xz-libs                 5.2.5-r0               apk
zlib                    1.2.11-r3              apk
   

It is also possible to output this list to a file in any of the following formats:

Here we write the output to an sbom.json file using the syft format:

PS C:\> docker sbom masstransit/rabbitmq:latest --format syft-json --output sbom.json

We can now load this file in a tool like Grype to check for any known vulnerabilities, but that is something I’ll show in my post tomorrow.

More information: https://anchore.com/sbom/docker-sbom-command-creates-sbom-using-syft/

Popular posts from this blog

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Cache stampede: when our cache turned against us

While investigating some performance issues, we ran into an ASP.NET Core API that cached a fairly expensive aggregation query for 60 seconds. Under normal load, that was fine: one request rebuilds the cache, everyone else reads from it. Under peak load, dozens of requests would arrive in that same expiry window, all see a cache miss, and all fire the same expensive query in parallel. The database didn't like that. That was the moment when our caching layer stopped helping and started hurting. A burst of requests comes in at the same time, all miss the cache, and all go hammer the database or the downstream API at once. That's a cache stampede . The cache was supposed to protect our backend, and for a few hundred milliseconds it did the opposite. Why this happens IMemoryCache.GetOrCreate (and its async sibling) looks like it protects you, but it doesn't add any locking on its own. Look at the naive version: public async Task<Report> GetReportAsync(string key) ...

A complex system designed from scratch never works

A few years ago, I worked as an architect on a big mainframe rewrite. I still count it as one of my failures. Not because the technology was wrong, but because I couldn't convince the management team to simplify the approach. Years later, the organization is still struggling to get the new system up and running. I left the project at the time, because I couldn't put my name behind an approach that would take very long and cost a lot of money without a working system to show for it along the way. Gall’s Law That memory keeps coming back to me, because it's a textbook case of Gall's Law playing out in real life. Gall's Law , from John Gall's Systemantics , states it plainly: A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works, and it cannot be patched to make it work. You have to start over with a simple system that works. What does that mean in practice,...