Skip to content

Conversation

@EmmanuelBerkowicz
Copy link

feat: add basic timeout-minutes audit for GitHub Actions jobs

Summary: I have made a start on the open issue, requesting feedback on progress as this is my first rust project.

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 or personas

Addresses #1023

EmmanuelBerkowicz and others added 2 commits August 10, 2025 12:20
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?
@kusari-inspector
Copy link

Kusari Analysis Results

Analysis for commit: f0c3711, performed at: 2025-08-10T02:25:03Z

@kusari-inspector rerun - Trigger a re-analysis of this PR

@kusari-inspector feedback [your message] - Send feedback to our AI and team


Recommendation

✅ PROCEED with this Pull Request

Summary

No Flagged Issues Detected

All values appear to be within acceptable risk parameters.

No pinned version dependency changes, code issues or exposed secrets detected!

Found this helpful? Give it a 👍 or 👎 reaction!

@funnelfiasco funnelfiasco added the new-audit New audits label Aug 10, 2025
@woodruffw
Copy link
Member

Thanks for tackling this @EmmanuelBerkowicz!

Please give me a ping when this is ready for an initial review (that can be now, but I didn't want to assume).

@woodruffw woodruffw added the enhancement New feature or request label Aug 11, 2025
@EmmanuelBerkowicz
Copy link
Author

@woodruffw ,
No worries mate! It was a bit more complicated than I thought which is why it took me so long.

I've given it my best shot, but like I said in the PR, it's not the entire issue scope just yet.

If you could give it a once over and let me know if my approach is in the right direction that would be a huge help! If I am reading the scope correctly, there is still a fair bit to go and it will be a lot easier for me to do if I know that I'm heading in the right direction :)

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EmmanuelBerkowicz!

Your approach here looks good to me; I think once this includes checks for step-level timeouts and some tests then it'll be good to go.

(Let me know if you have any questions about how to run the tests, including updating the snapshots. Most of it is documented here: https://docs.zizmor.sh/development/#testing)

if job.timeout_minutes.is_none() {
findings.push(self.build_finding(
job.location().primary(),
"job is missing timeout-minutes",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"job is missing timeout-minutes",
"missing timeout-minutes",

let mut findings = vec![];

// Check if timeout-minutes is missing
if job.timeout_minutes.is_none() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach looks right to me! Let's do the same for each step in the job as well 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be moved under crates/zizmor/tests/integration/test-data and named timeout-minutes.yml or similar, once you're ready 🙂

register_audit!(audit::self_hosted_runner::SelfHostedRunner);
register_audit!(audit::known_vulnerable_actions::KnownVulnerableActions);
register_audit!(audit::unpinned_uses::UnpinnedUses);
register_audit!(audit::timeout_minutes::TimeoutMinutes);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the end, please -- right now these are declared in order of introduction, not alphabetically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new-audit New audits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants