Skip to content

Commit

Permalink
Add strict SBOM validation flag.
Browse files Browse the repository at this point in the history
* trustier will only validate an SBOM with the CycloneDX Bom validator if strict is set to true.
  • Loading branch information
djschleen authored Oct 9, 2024
1 parent e833dd7 commit 4ac8a7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ struct Args {
//Optional file name to write json output to
#[arg(short, long, required = false)]
output_file: Option<String>,

//Optional flag to enable strict SBOM validation
#[arg(short, long, default_value_t = false)]
strict: bool,
}

fn main() {
Expand Down Expand Up @@ -67,7 +71,7 @@ fn main() {
}
};

if !bom.validate().passed() {
if args.strict && !bom.validate().passed() {
eprintln!("* Provided input is not a valid SBOM");
return;
}
Expand Down

0 comments on commit 4ac8a7b

Please sign in to comment.