Question 173 of 510
Scripting, Containers and AutomationhardMultiple ChoiceObjective-mapped

Quick Answer

The answer is to run a vulnerability scanner and fail the build on critical findings. This is correct because automated vulnerability scanning in the CI/CD pipeline for container images acts as a security gate, preventing images with known exploitable flaws from progressing to production. By failing the build on critical findings, you enforce a policy that stops vulnerable code from being deployed, directly reducing the attack surface and aligning with secure software supply chain management. On the CompTIA SecurityX CAS-004 exam, this concept tests your understanding of DevSecOps integration and container security controls; a common trap is choosing to only log findings without failing the build, which does not block the vulnerability. Remember the mnemonic “Fail Fast, Fix First” — if a scan finds a critical flaw, the pipeline must stop immediately to protect the runtime environment.

CAS-004 Reduce container attack surface Practice Question

This CAS-004 practice question tests your understanding of scripting, containers and automation. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

In a CI/CD pipeline, a container image is built from a Dockerfile that uses a base image from a public registry. To minimize the attack surface, which of the following actions should be automated in the pipeline?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "minimum / minimize"

    Why it matters: Asks for the least resource use — fewest addresses, smallest subnet, lowest overhead. Eliminate over-provisioned options even if they would technically work.

Question 1hardmultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Run a vulnerability scanner and fail the build on critical findings

Option B is correct because integrating a vulnerability scanner into the CI/CD pipeline and failing the build on critical findings directly reduces the attack surface by preventing deployment of images with known exploitable vulnerabilities. This aligns with the principle of secure software supply chain management, where automated security gates are essential for containerized environments.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use the 'latest' tag for the base image to get latest patches

    Why it's wrong here

    'latest' can introduce breaking changes or untested versions.

  • Store the Dockerfile in a private repository only

    Why it's wrong here

    Storage location does not reduce attack surface.

  • Install all available packages inside the container

    Why it's wrong here

    Installing extra packages increases attack surface.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The CAS-004 exam frequently reuses these exact scenarios with slightly different constraints.

Run a vulnerability scanner and fail the build on critical findingsCorrect answer
Use the 'latest' tag for the base image to get latest patchesWrong answer — click to see why

Why this is wrong here

'latest' can introduce breaking changes or untested versions.

Store the Dockerfile in a private repository onlyWrong answer — click to see why

Why this is wrong here

Storage location does not reduce attack surface.

Install all available packages inside the containerWrong answer — click to see why

Why this is wrong here

Installing extra packages increases attack surface.

Analysis generated from the official CAS-004blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

Common exam traps

Common exam trap: answer the scenario, not the keyword

CompTIA often tests the misconception that using the 'latest' tag is a safe practice for security patching, when in fact it undermines deterministic builds and introduces supply chain risks.

Detailed technical explanation

How to think about this question

Vulnerability scanners like Trivy or Grype compare the packages and libraries in the container image against databases such as the National Vulnerability Database (NVD) or OS-specific advisories (e.g., Debian Security Tracker). In a CI/CD pipeline, the scanner can be invoked as a step after the image build, and a non-zero exit code on critical findings can halt the pipeline, preventing the image from being pushed to a registry or deployed. A real-world scenario is the Log4j vulnerability (CVE-2021-44228), where automated scanning would catch the affected library in a base image before deployment.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CAS-004 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CAS-004 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CAS-004 question test?

Scripting, Containers and Automation — This question tests Scripting, Containers and Automation — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Run a vulnerability scanner and fail the build on critical findings — Option B is correct because integrating a vulnerability scanner into the CI/CD pipeline and failing the build on critical findings directly reduces the attack surface by preventing deployment of images with known exploitable vulnerabilities. This aligns with the principle of secure software supply chain management, where automated security gates are essential for containerized environments.

What should I do if I get this CAS-004 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "minimum / minimize". Asks for the least resource use — fewest addresses, smallest subnet, lowest overhead. Eliminate over-provisioned options even if they would technically work.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on CAS-004

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A small business uses Puppet for configuration management on Linux servers. They are now migrating to containers and want to maintain security. The operations team is unfamiliar with containers. The security team insists on automated vulnerability scanning of container images before deployment. What should be the company's first step?

easy
  • A.Deploy a Kubernetes cluster and migrate all applications.
  • B.Discontinue using Puppet and switch entirely to container-based configurations.
  • C.Train the operations team on Docker and Kubernetes fundamentals.
  • D.Create a hardened base image standard, and set up a CI pipeline that automatically scans every image for vulnerabilities before it is pushed to the registry.

Why D: Creating a hardened base image standard and integrating scanning into CI is foundational. Option C is correct. Training (A) is premature without a plan. Kubernetes (B) is too advanced initially. Discontinuing Puppet (D) is unnecessary.

Variation 2. Which two practices are essential for securing a CI/CD pipeline? (Choose two.)

easy
  • A.Allow any developer to merge code into the main branch without review.
  • B.Implement code signing for all build artifacts.
  • C.Store credentials in plaintext within pipeline configuration files.
  • D.Use immutable tags for container images.
  • E.Scan container images for vulnerabilities before deployment.

Why B: Options B and C are correct. Code signing ensures artifact integrity, and vulnerability scanning prevents deploying insecure images. Option A is insecure. Option D lacks necessary review. Option E is beneficial but not as essential as B and C.

Variation 3. A development team is using Docker containers for microservices. The security team wants to scan containers for vulnerabilities during the CI/CD pipeline. Which approach is most effective?

medium
  • A.Use a runtime security tool that scans containers only when they are running.
  • B.Scan the container image only after deployment to production.
  • C.Rely on the developers to manually check for vulnerabilities.
  • D.Integrate image scanning into the pipeline before promoting images to the registry, using a tool like Trivy.

Why D: Option B is correct because integrating image scanning early in the pipeline prevents vulnerable images from being deployed. Option A scans too late. Option C relies on unreliable manual checks. Option D only catches runtime issues, not build-time vulnerabilities.

Keep practising

More CAS-004 practice questions

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This CAS-004 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CAS-004 exam.