-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
Description
Objective
Replace the insecure workflow_run trigger in ci-doctor.md with a secure scheduled trigger that uses the GitHub API to check for failed workflow runs.
Context
The CI Doctor workflow currently uses the workflow_run trigger, which poses HIGH security risks:
- Privilege Escalation Risk: Triggered workflows inherit permissions/secrets from the triggering workflow
- Branch Protection Bypass: Can execute on protected branches via unprotected branches
- Secret Exposure: Secrets available even when triggered by untrusted code
- No Review Gate: Executes automatically without code review
This is finding #1 from discussion #3945 (Static Analysis Report - November 14, 2025).
Approach
- Replace
workflow_runtrigger with scheduled trigger (cron: '*/30 * * * *') - Add
workflow_dispatchfor manual triggers - Use
actions/github-script@v7to query GitHub API for workflow runs - Filter for failures in the last 30 minutes to avoid duplicate processing
- Preserve all existing CI Doctor analysis logic
Files to Modify
.github/workflows/ci-doctor.md(line 47 - trigger section)- Test the compiled
.github/workflows/ci-doctor.lock.ymlafter changes
Acceptance Criteria
-
workflow_runtrigger removed from ci-doctor.md - Scheduled trigger (every 30 minutes) added
-
workflow_dispatchtrigger added for manual execution - GitHub API call implemented to query workflow runs
- Filtering logic for recent failures (last 30 minutes) implemented
- All existing CI Doctor functionality preserved
- Workflow compiles successfully with
gh aw compile ci-doctor - Manual test confirms workflow detects failures correctly
- Permissions updated to minimum required:
actions: read,contents: read,issues: write
Security Impact
Fixes HIGH severity security vulnerability that could allow:
- Arbitrary code execution with elevated permissions
- Access to repository secrets
- Modification of protected branches
- Bypass of security controls
Estimated Effort
2-4 hours
AI generated by Plan Command for discussion #3945
Copilot