mirror of
https://github.com/zizmorcore/zizmor.git
synced 2025-12-23 08:47:33 +00:00
By default, we'll now ignore things like explicit `persist-credentials: true`, since they suggest that they user knows what they're doing. However, in pedantic mode, these will still be flagged. Signed-off-by: William Woodruff <william@yossarian.net>
29 lines
1,005 B
Rust
29 lines
1,005 B
Rust
use github_actions_models::workflow::event::{BareEvent, OptionalBody};
|
|
use github_actions_models::workflow::Trigger;
|
|
|
|
use crate::finding::{Confidence, Finding, Severity};
|
|
use crate::models::{AuditOptions, Workflow};
|
|
|
|
pub(crate) fn audit(_options: &AuditOptions, workflow: &Workflow) -> Vec<Finding> {
|
|
let trigger = &workflow.on;
|
|
|
|
let has_pull_request_target = match trigger {
|
|
Trigger::BareEvent(event) => *event == BareEvent::PullRequestTarget,
|
|
Trigger::BareEvents(events) => events.contains(&BareEvent::PullRequestTarget),
|
|
Trigger::Events(events) => !matches!(events.pull_request_target, OptionalBody::Missing),
|
|
};
|
|
|
|
let mut findings = vec![];
|
|
if has_pull_request_target {
|
|
findings.push(Finding {
|
|
ident: "pull-request-target",
|
|
workflow: workflow.filename.clone(),
|
|
severity: Severity::High,
|
|
confidence: Confidence::Medium,
|
|
job: None,
|
|
steps: vec![],
|
|
})
|
|
}
|
|
|
|
findings
|
|
}
|