Using Push Protection to Stop Secrets from Reaching a Repository
Your organization uses GitHub Enterprise and wants to prevent secrets (e.g., API keys) from being pushed to any repository. Which GitHub feature should you enable?
Quick Answer
Push protection for secret scanning is the feature built specifically to stop secrets before they land: it intercepts a push containing a recognized secret pattern — an API key, a token — at the point of push itself and rejects it, rather than just flagging it after the fact the way passive secret-scanning alerts do.
⚠ Common exam trap
Test-takers frequently confuse 'secret scanning' (passive detection) with 'push protection' (active prevention), assuming that enabling GitHub Advanced Security secret scanning alone will block pushes, when in fact push protection is a separate toggle that must be explicitly enabled.
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
✓
Push protection for secret scanning
Push protection for secret scanning (Option C) is the correct answer because it actively blocks pushes that contain known secrets (e.g., API keys, tokens) at the client side, preventing them from ever reaching the remote repository. This is a dedicated feature of GitHub Advanced Security that integrates with pre-receive hooks to scan commits in real time, rejecting the push if a secret pattern is detected. It is specifically designed to prevent secrets from being pushed, unlike passive scanning which only alerts after the fact.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Repository rulesets
Why it's wrong here
Rulesets can enforce various policies, but push protection is the specific feature for secrets.
- ✗
GitHub Advanced Security secret scanning
Why it's wrong here
Secret scanning detects secrets after they are committed, but does not block pushes.
- ✓
Push protection for secret scanning
Why this is correct
Push protection prevents commits with secrets from being pushed.
- ✗
Branch protection rules requiring signed commits
Why it's wrong here
Signed commits verify identity but do not block secrets.
Go deeper
Related to this question
Learn chapter
Designing a Security and Compliance Plan
Key term
GitHub Advanced Security
GitHub Advanced Security is a suite of security tools integrated into GitHub that helps developers find and fix vulnerabilities, secrets, and code quality issues directly in their repositories.
Key term
Repository
A repository is a central storage location where software packages, code, or configuration files are kept, managed, and distributed for use by IT systems.
About these practice questions
This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on AZ-400
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. Your team uses Azure Repos and needs to prevent secrets from being committed to the repository. Which built-in feature should you enable?
medium- A.Enable GitHub secret scanning
- B.Enable Azure Policy to scan repositories
- C.Configure a pre-commit hook with a secret scanning tool
- ✓ D.Enable push protection in Azure Repos
Why D: Push protection in Azure Repos is a built-in feature that scans commits for high-confidence secrets (e.g., Azure service connection strings, SSH keys, and other credential patterns) and blocks the push if a secret is detected. This prevents secrets from ever reaching the remote repository, enforcing security at the server side without requiring client-side configuration.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft 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 AZ-400 exam.