Skip to content

fix: report: fix text of built-in checks from the rules - #332

Merged
with-developer merged 2 commits into
mainfrom
fix/331-report-fix-text
Nov 26, 2026
Merged

with-developer merged 2 commits into
mainfrom
fix/331-report-fix-text

Conversation

@with-developer

@with-developer with-developer commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Closes #331.

vmsctl report merges 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 report applies it to every input file.
  • ADR 0018's consequences say so.

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 changed

The review found that deciding by control leaves ways around it, in the report and in the server's CSV alike:

  • a built-in check listed under no control kept its text, and the report's one entry per check across hosts carried one file's planted fix to another host's control (reproduced by the reviewer; now TestReportFixNotSharedFromAnotherFile, which fails on the first version of this PR);
  • a made-up control of a built-in profile (kisa-2026 U-99) was taken for a pack's;
  • a built-in check under a pack's control kept the result's text;
  • the rule's text was put on checks that had not failed (ERROR), where a scan writes none.

TrustFixes now 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: TestTrustFixes covers 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).

@with-developer
with-developer merged commit 1fd560e into main Nov 26, 2026
20 checks passed
@with-developer
with-developer deleted the fix/331-report-fix-text branch November 26, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reports: take the fix text of built-in checks from the rules, not from the results

1 participant