Security gates and cleanup must be fail-closed and boundary-proven.
Apply these rules when implementing/adjusting secure workflows:
1) Authorization must not degrade
2) Re-sweep after PR-controlled lifecycle scripts
npm ci/build (or any PR-controlled lifecycle hooks), assume they may plant artifacts into runner temp/upload staging.rm -rf then mkdir -p in the same step, and keep ordering stable (rm → mkdir → proxy/agent).3) Prove the auth boundary with real requests
Authorization header → 4014) Make security tests hermetic (no global/system config influence)
GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_SYSTEM=/dev/null).core.hooksPath) so failures can’t be masked by developer machines.Example (authorization routing + fail-closed execution):
# In the shell gate script
body_lc="${COMMENT_BODY,,}"
case "$body_lc" in
*@qwen-code /verify*)
# FAIL CLOSED: require BOTH principals to have permission
# (e.g., should_run=false unless author_has_write && commenter_has_write)
;;
*@qwen-code /tmux*)
# Keep existing narrower gate
;;
*)
should_run=false
;;
esac
Example (post-PR lifecycle hygiene):
# In the agent step, immediately before upload/agent start
rm -rf "$RUNNER_TEMP/verify-results"
mkdir -p "$RUNNER_TEMP/verify-results"
start_openai_proxy
Enter the URL of a public GitHub repository