Skip to content
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

docs: update all documentation #688

Merged
merged 9 commits into from
Jul 5, 2024

Conversation

ashnamehrotra
Copy link
Contributor

Describe the changes in this pull request using active verbs such as Add, Remove, Replace ...

Closes #687
Part of #522

@sozercan
Copy link
Member

sozercan commented Jul 3, 2024

let's merge this into quick start instead of a separate page. we'll need to rearrange some parts there. we can call out scanners being optional and if users are interested in targeted updates.

@@ -12,32 +12,18 @@ This sample illustrates how to patch containers using vulnerability reports with
* The `docker` daemon runs a buildkit service in-process. If you are using this for your buildkit instance, Docker must have the [containerd image store feature](https://docs.docker.com/storage/containerd/) enabled.
* If you are using a buildx instance, or using buildkitd directly, there is no need to enable the containerd image store. However, only images in a remote registry can be patched using these methods.
* [docker](https://docs.docker.com/desktop/linux/install/#generic-installation-steps) daemon running and CLI installed & pathed.
* [trivy CLI](https://aquasecurity.github.io/trivy/latest/getting-started/installation/) installed & pathed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we keep this but under an optional section?


You can also see the existing patchable vulnerabilities in table form on the shell with:
Upgrading all packages may introduce compatibility issues or break existing functionality. Test the patched image to ensure stability.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Upgrading all packages may introduce compatibility issues or break existing functionality. Test the patched image to ensure stability.
Upgrading all packages may introduce compatibility issues or break existing functionality. Make sure to test the patched image to ensure stability. If you are interested in targeted updates for vulnerabilities only, please see [Patch with an optional scanner report](#patch-with-an-optional-scanner-report) section.

2. Scan the container image for patchable OS vulnerabilities, outputting the results to a JSON file:

```bash
trivy image --vuln-type os --ignore-unfixed -f json -o nginx.1.21.6.json docker.io/library/nginx:1.21.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trivy image --vuln-type os --ignore-unfixed -f json -o nginx.1.21.6.json docker.io/library/nginx:1.21.6
export IMAGE=docker.io/library/nginx:1.21.6
trivy image --vuln-type os --ignore-unfixed -f json -o $(basename $IMAGE).json $IMAGE


```bash
copa patch -i docker.io/library/nginx:1.21.6
trivy image --vuln-type os --ignore-unfixed docker.io/library/nginx:1.21.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trivy image --vuln-type os --ignore-unfixed docker.io/library/nginx:1.21.6
trivy image --vuln-type os --ignore-unfixed $IMAGE

2024/01/22 23:32:54 [notice] 1#1: OS: Linux 6.2.0-1018-azure
2024/01/22 23:32:54 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/01/22 23:32:54 [notice] 1#1: start worker processes
copa patch -r nginx.1.21.6.json -i docker.io/library/nginx:1.21.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
copa patch -r nginx.1.21.6.json -i docker.io/library/nginx:1.21.6
copa patch -r $(basename $IMAGE).json -i $IMAGE


```bash
copa patch -r nginx.1.21.6.json -i docker.io/library/nginx:1.21.6
copa patch -i docker.io/library/nginx:1.21.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
copa patch -i docker.io/library/nginx:1.21.6
export IMAGE=docker.io/library/nginx:1.21.6
copa patch -i $IMAGE

```bash
copa patch -r nginx.1.21.6.json -i docker.io/library/nginx:1.21.6@sha256:25dedae0aceb6b4fe5837a0acbacc6580453717f126a095aa05a3c6fcea14dd4
copa patch -i docker.io/library/nginx:1.21.6@sha256:25dedae0aceb6b4fe5837a0acbacc6580453717f126a095aa05a3c6fcea14dd4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
copa patch -i docker.io/library/nginx:1.21.6@sha256:25dedae0aceb6b4fe5837a0acbacc6580453717f126a095aa05a3c6fcea14dd4
export IMAGE="docker.io/library/nginx:1.21.6@sha256:25dedae0aceb6b4fe5837a0acbacc6580453717f126a095aa05a3c6fcea14dd4"
copa patch -i $IMAGE

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add this as a tip?

:::note
The update all functionality allows you to address discrepancies that may arise between scanners and the packages they flag as vulnerable. It is important to note, however, that some upgrades can introduce dependency or compatibility conflicts.
:::
The following steps will update all outdated packages in an image to the latest available version:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following steps will update all outdated packages in an image to the latest available version:
The following steps will update all outdated packages in an image to the latest available versions:

4. Scan the patched image and verify that the vulnerabilities have been patched:

```bash
trivy image --vuln-type os --ignore-unfixed docker.io/library/nginx:1.21.6-patched
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add an example/expected trivy output after this

@@ -46,16 +32,16 @@ The update all functionality allows you to address discrepancies that may arise

If an instance doesn't exist or that instance doesn't support all the features copa needs the next will be attempted. Please see [custom buildkit addresses](custom-address.md) for more information.

After setting up the buildkit instance, run the following command to patch the image:
2. After setting up the buildkit instance, run the following Copa command to patch the supplied image:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep the trivy sections here. so the flow would be

  • set up buildkit
  • trivy scan
  • copa patch
    • copa patch all
    • copa patch trivy report
  • trivy scan

Signed-off-by: ashnamehrotra <[email protected]>
Signed-off-by: ashnamehrotra <[email protected]>
Signed-off-by: ashnamehrotra <[email protected]>
Signed-off-by: ashnamehrotra <[email protected]>
Signed-off-by: ashnamehrotra <[email protected]>
Signed-off-by: ashnamehrotra <[email protected]>
Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few minor comments, otherwise LGTM

@@ -12,72 +12,127 @@ This sample illustrates how to patch containers using vulnerability reports with
* The `docker` daemon runs a buildkit service in-process. If you are using this for your buildkit instance, Docker must have the [containerd image store feature](https://docs.docker.com/storage/containerd/) enabled.
* If you are using a buildx instance, or using buildkitd directly, there is no need to enable the containerd image store. However, only images in a remote registry can be patched using these methods.
* [docker](https://docs.docker.com/desktop/linux/install/#generic-installation-steps) daemon running and CLI installed & pathed.
* [trivy CLI](https://aquasecurity.github.io/trivy/latest/getting-started/installation/) installed & pathed.
* Alternatively, see [scanner plugins](#scanner-plugins) for custom scanner support.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this too

@@ -2,7 +2,7 @@
title: Quick Start
---

This sample illustrates how to patch containers using vulnerability reports with `copa`.
This sample illustrates how to patch outdated containers with `copa`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This sample illustrates how to patch outdated containers with `copa`.
This guide illustrates how to patch outdated containers with `copa`.

2024-07-03T14:11:29.864-0700 INFO If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-07-03T14:11:29.864-0700 INFO Please see also https://aquasecurity.github.io/trivy/v0.44/docs/scanner/secret/#recommendation for faster secret detection
2024-07-03T14:11:32.197-0700 INFO Detected OS: debian
2024-07-03T14:11:32.197-0700 INFO Detecting Debian vulnerabilities...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's delete the info lines for brevity

2024-07-03T14:30:26.167-0700 INFO If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-07-03T14:30:26.167-0700 INFO Please see also https://aquasecurity.github.io/trivy/v0.44/docs/scanner/secret/#recommendation for faster secret detection
2024-07-03T14:30:27.980-0700 INFO Detected OS: debian
2024-07-03T14:30:27.980-0700 INFO Detecting Debian vulnerabilities...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's delete the info lines for brevity

Comment on lines 46 to 48
3. Patch the supplied image with Copa:

###### 3.1 Update all outdated packages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Patch the supplied image with Copa:
###### 3.1 Update all outdated packages
3. Patch the supplied image with Copa:
1. Update all outdated packages

nit: would this work?

Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few minor comments, otherwise LGTM

Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few minor comments, otherwise LGTM

Signed-off-by: ashnamehrotra <[email protected]>
@ashnamehrotra ashnamehrotra merged commit b1df0e9 into project-copacetic:main Jul 5, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add documentation for update all feature.
2 participants