Skip to content

Commit 8142acb

Browse files
authored
MVP SARIF support (#9)
1 parent f8468b8 commit 8142acb

File tree

4 files changed

+287
-12
lines changed

4 files changed

+287
-12
lines changed

Cargo.lock

Lines changed: 168 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
name = "zizmor"
33
version = "0.1.0"
44
edition = "2021"
5+
repository = "https://github.com/woodruffw/zizmor"
6+
homepage = "https://github.com/woodruffw/zizmor"
57

68
[dependencies]
79
anyhow = "1.0.86"
@@ -13,6 +15,7 @@ log = "0.4.22"
1315
regex = "1.10.6"
1416
reqwest = { version = "0.12.7", features = ["blocking", "json"] }
1517
serde = { version = "1.0.208", features = ["derive"] }
18+
serde-sarif = "0.6.5"
1619
serde_json = "1.0.125"
1720
serde_yaml = "0.9.34"
1821
tree-sitter = "0.22.6"

src/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod audit;
99
mod finding;
1010
mod github_api;
1111
mod models;
12+
mod sarif;
1213
mod utils;
1314

1415
/// A tool to detect "ArtiPACKED"-type credential disclosures in GitHub Actions.
@@ -103,13 +104,18 @@ fn main() -> Result<()> {
103104
for workflow in workflows.iter() {
104105
// TODO: Proper abstraction for multiple audits here.
105106
for audit in audits.iter_mut() {
106-
for finding in audit.audit(workflow)? {
107-
results.push(finding);
108-
}
107+
results.extend(audit.audit(workflow)?);
109108
}
110109
}
111110

112-
serde_json::to_writer_pretty(stdout(), &results)?;
111+
match args.format {
112+
None | Some(OutputFormat::Json) | Some(OutputFormat::Plain) => {
113+
serde_json::to_writer_pretty(stdout(), &results)?;
114+
}
115+
Some(OutputFormat::Sarif) => {
116+
serde_json::to_writer_pretty(stdout(), &sarif::build(results))?;
117+
}
118+
}
113119

114120
Ok(())
115121
}

0 commit comments

Comments
 (0)