-
-
Notifications
You must be signed in to change notification settings - Fork 121
Check for timeout-minutes in jobs and steps
#1347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
zizmorcore#1023 feat: add basic timeout-minutes audit for GitHub Actions jobs Implements a new audit rule that detects missing timeout-minutes property on GitHub Actions jobs to prevent runaway jobs from consuming runner minutes. What's implemented: - Basic audit structure following existing patterns (unpinned-images) - Detection of missing timeout-minutes on normal jobs - Proper finding generation with medium severity - Integration with pedantic persona - Registration in audit registry What's still needed (for future iterations): - Handle reusable workflows (jobs with 'uses' don't support timeout-minutes directly) - Check step-level timeout-minutes and transitive coverage by job timeouts - Add comprehensive test coverage - Consider different severity levels?
| Ok(Self) | ||
| } | ||
|
|
||
| async fn audit_normal_job<'doc>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here seems pretty deeply nested 🙂 -- maybe we could do this in a "bubble up" style instead, i.e. use audit_step and then check the step's parent (the job) if a timeout is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. I separated out audit_step in f9a4803 but the logic is still quite complex. I wanted to make sure that we don't get reports for both the job and the step when neither set timeout-minutes. Is there a simpler way?
Pre-submission checks
Please check these boxes:
Mandatory: This PR corresponds to an issue (if not, please create
one first).
I hereby disclose the use of an LLM or other AI coding assistant in the
creation of this PR. PRs will not be rejected for using AI tools, but
will be rejected for undisclosed use.
If a checkbox is not applicable, you can leave it unchecked.
Summary
Fixes #1023
Towards #1225
This PR builds on the work of @EmmanuelBerkowicz in #1067 and gets the
timeout-minutescheck working.I'm still quite new to Rust so I reimplemented it using what I did in #1227 as a template.
I've included checks for steps as well as jobs. There's an initial check whether any of the steps in a job set
timeout-minutes. If so, we check the other steps to ensure they do, too. If not, we check if the job itself setstimeout-minutes.Test Plan
A test workflow is provided and the test data and snapshots are updated for the existing tests.