Courseiva
hardMultiple ChoiceObjective-mapped

CAS-004 Practice Question: A financial services company uses a continuous…

A financial services company uses a continuous integration/continuous delivery (CI/CD) pipeline to deploy microservices. The security team wants to ensure that no secrets (e.g., API keys, database passwords) are hard-coded in source code repositories. Which tool or practice is most appropriate for detecting secrets before they are committed?

⚠ Common exam trap

CompTIA CASP+ often tests the distinction between 'detecting secrets before commit' (pre-commit hooks) versus 'scanning after commit' (SAST in build pipeline), where candidates mistakenly choose SAST because it is a familiar security testing method, but it fails to prevent the secret from entering the repository history.

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

Implement a pre-commit hook using git-secrets or similar

A pre-commit hook using a tool like git-secrets scans staged changes for patterns matching common secret formats (e.g., AWS keys, passwords) before the commit is finalized. This prevents secrets from ever entering the local repository, which is the earliest and most effective point of control. Unlike later-stage scans, pre-commit hooks catch issues before they are pushed to shared branches or CI/CD pipelines.

Answer analysis

Option-by-option breakdown

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

  • Run dynamic application security testing (DAST) on deployed apps

    Why it's wrong here

    DAST identifies runtime vulnerabilities, not secrets in code.

  • Implement a pre-commit hook using git-secrets or similar

    Why this is correct

    Scans code before commit, blocking secrets from being pushed.

  • Perform static application security testing (SAST) in the build pipeline

    Why it's wrong here

    SAST can detect secrets, but after commit it's too late.

  • Deploy runtime application self-protection (RASP)

    Why it's wrong here

    RASP protects apps at runtime, not prevent secret exposure in code.

About these practice questions

One of 968 original CAS-005 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CAS-005 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-005 exam.