GH-500 · Question #77
Which of the following is the best way to prevent developers from adding secrets to the repository?
The correct answer is D. Enable push protection. Enabling push protection in GitHub Advanced Security is the most direct and effective technical control for preventing secrets from being committed. When push protection is active, GitHub scans every push in real time and blocks the push if a known secret pattern (API key…
Question
Which of the following is the best way to prevent developers from adding secrets to the repository?
Options
- AMake the repository public.
- BConfigure a security manager.
- CCreate a CODEOWNERS file.
- DEnable push protection.
How the community answered
(26 responses)- A4% (1)
- B12% (3)
- C8% (2)
- D77% (20)
Explanation
Enabling push protection in GitHub Advanced Security is the most direct and effective technical control for preventing secrets from being committed. When push protection is active, GitHub scans every push in real time and blocks the push if a known secret pattern (API key, token, credential) is detected - stopping the secret before it ever enters the repository history. Making a repository public (option A) has the opposite effect and would expose any secrets. A security manager role (option B) is an administrative role that manages security settings but does not automatically block secret commits. A CODEOWNERS file (option C) defines code ownership for review purposes but has no capability to detect or block secrets.
Topics
Community Discussion
No community discussion yet for this question.