How do you catch vulnerable or malicious dependencies before they reach `main`?
IntermediateScenarioSecrets, Signing and Security
Answer
Situation read → Dependency changes should be reviewed like code.
What I'd do →
- Enable Dependabot alerts and security updates.
- Add the Dependency Review action on PRs to fail on new vulnerable packages or disallowed licenses.
- Commit lockfiles and install with
npm cior equivalent. - Add CodeQL or another SAST scan as a required check.
Why → Catching it in the PR is much cheaper than after release.
Interview tip → Lockfiles plus review of dependency diffs address both bad versions and typosquats.
More on Secrets, Signing and Security
A developer pushed an AWS access key to a public repo 10 minutes ago. What is your first move?BeginnerAfter rotating the leaked key, you must purge it from repository history. How?AdvancedA push is rejected: "GH013: Repository rule violations found ... Push cannot contain secrets". What do you do?IntermediateSecret scanning alerts have piled up, and many look like false positives or old test credentials.IntermediateYou must set up signed commits on your laptop. Which method do you pick?BeginnerYour GPG signing key expires next week. What is the correct way to handle it?Intermediate