312-97 practice question 12 of 35

(Judi Dench has recently joined an IT company as a DevSecOps engineer. Her organization develops software products and web applications related to…

Full set: 100 questions
(Judi Dench has recently joined an IT company as a DevSecOps engineer. Her organization develops software products and web applications related to electrical engineering. Judi would like to use Anchore tool for container vulnerability scanning and Software Bill of Materials (SBOM) generation. Using Anchore grype, she would like to scan the container images and file systems for known vulnerabilities, and would like to find vulnerabilities in major operating system packages such as Alpine, CentOS, Ubuntu, etc. as well as language specific packages such as Ruby, Java, etc. Which of the following commands should Judi run to scan for vulnerabilities in the image using grype?)
Answer options
A: grype --scope all-layers. Correct answer
B: grype packages --scope all-layers.
C: grype packages .
D: grype .
Correct Answer:
A. grype < image > --scope all-layers.
Explanation

The Anchore Grype tool is used to scan container images and filesystems for vulnerabilities. The command grype initiates a scan. To perform a more comprehensive scan that includes all layers of a container image, not just the squashed final layer, the --scope all-layers flag should be used. This ensures vulnerabilities from base images and intermediate layers are also detected. While the provided option has a syntax error (a trailing period and a missing target), it correctly identifies the essential --scope all-layers flag for a thorough scan as requested. The correct full command syntax would be grype --scope all-layers.

Why Incorrect

B. grype packages is not a valid command for initiating a vulnerability scan; it is used for listing packages, and the syntax is incorrect.
C. grype packages . is an invalid command. The packages subcommand is for listing packages from a previously generated scan result, not for scanning.
D. grype . is a valid command to scan the current directory's filesystem, but it uses the default 'squashed' scope, which is less comprehensive than 'all-layers' for images.

References

- Anchore Grype Documentation. (n.d.). README.md. GitHub. Retrieved from https://github.com/anchore/grype. In the "Usage" section, the basic command is shown as grype , and the --scope flag is detailed under the "Configuration" or command-line options section, specifying its use for all-layers scanning.

- Anchore, Inc. (2023). Scanning Container Images. Anchore Documentation. "To scan an image and see vulnerabilities from all layers, not just the final squashed layer, use the --scope all-layers argument: grype --scope all-layers".

Scroll to Top