Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sources/bloodhound/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ impl ReportWriter for TextReportWriter {
writeln!(output, "{:17}{}", "Skipped:", report.skipped)?;
writeln!(output, "{:17}{}", "Total checks:", report.total)?;
writeln!(output)?;
writeln!(output, "Compliance check result: {}", report.status)
if report.contain_known_fail_check("3.4.1.1".to_string()) {
writeln!(
output,
"\x1b[93m WARNING: For Kubernetes Variants, DROP will be unconditionally overwritten. If this applies to you, work with your auditor for an exception. See https://github.com/bottlerocket-os/bottlerocket-core-kit/issues/540 for more details.\x1b[0m"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also prefer not to link to a GitHub issue in code like this, it feels like the wrong way around for the relationship. If we need to document it somewhere outside of the report, it should go on the website. But I'd just add another sentence or two with the actual explanation.

)?;
}
Comment on lines +46 to +51
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer a more generic mechanism where we can drop in explanations like this on a per-variant basis, and have them appended to the output. This is really an aws-k8s-* specific warning and shouldn't be shown elsewhere.

For example, we could add an optional JSON metadata file alongside the files here:

ls -1 /usr/libexec/cis-checks/bottlerocket/
br01010101
br01020100
...
br03040101
br03040101.json <- new
...

Or, since the JSON files aren't executable, they could live in /usr/share:

ls -1 /usr/share/cis-checks/bottlerocket/
br03040101.json

And then within the JSON file, we could have different explanation strings for "failed", "skipped", or even "passed".

writeln!(output, "Compliance check result: {} ", report.status)
}
}

Expand Down
6 changes: 6 additions & 0 deletions sources/bloodhound/src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,10 @@ impl ReportResults {
self.results
.insert(metadata.name.clone(), IndividualResult { metadata, result });
}

pub fn contain_known_fail_check(&self, target_id: String) -> bool {
self.results.values().any(|result| {
result.metadata.id == target_id && result.result.status == CheckStatus::FAIL
})
}
}