Repository navigation
fix: report: fix text of built-in checks from the rules - #332
Merged
Merged
Conversation
…t from the result files (ADR 0018)
…ck lets a result's text through (ADR 0019)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #331.
vmsctl reportmerges result files, which may come from any host, and rendered their own fix text. ADR 0018 made the dashboard and the scan CSV take the fix of a built-in check from the rules; this does the same for the report, with the rules built into the binary.What
output.TrustFixes(result, content): for each control of a built-in profile, each check's fix is the rule's (English and Korean); a check that the rule's control does not list gets none; a policy pack's controls keep the result's text. The server's scan CSV now uses it too (the server-side copy is removed).vmsctl reportapplies it to every input file.Tests
TestTrustFixes(output): the rule's text, none for an unlisted built-in check or an unknown check, a pack's text kept, nil rules change nothing.TestReportFixFromRules(cli): a result file with planted fix text and a slipped-in check under U-01; the report contains the rule's fix and none of the planted text. It fails without the change.TestScanCSVFixFromRules(server) still passes with the shared function;make test lint.Review (
/code-review high) and what changedThe review found that deciding by control leaves ways around it, in the report and in the server's CSV alike:
TestReportFixNotSharedFromAnotherFile, which fails on the first version of this PR);kisa-2026U-99) was taken for a pack's;TrustFixesnow decides per check: a check the rules know gets the rule's fix, only if it failed (or was waived after failing), wherever it is; an unknown check keeps the result's text only if it is a pack's own (x-) and only pack controls list it; anything else gets none. The dashboard's evidence view follows: under a pack's control, only a pack's own check shows the scan's text. Recorded as ADR 0019 (amends 0018), instead of rewriting 0018's consequences in place as the first version did.Tests:
TestTrustFixescovers each placement (slipped in, made-up control, built-in under a pack, no control, not failed, waived after failing, unknown non-pack ID);fixFor(vitest) a built-in check under a pack control; the browser check with planted results shows none of them on either page or in either scan's CSV.Not changed: the fix shown is the current rule's whatever version of the check ran (ADR 0019 says so); a built-in check under a pack's control shows no fix in that control's evidence view (the CSV and report show the rule's).