Skip to content

fix: dashboard: fix text from the server's rules, not from a host (ADR 0018) - #328

Merged
with-developer merged 3 commits into
mainfrom
fix/fix-text-from-rules
Nov 24, 2026
Merged

with-developer merged 3 commits into
mainfrom
fix/fix-text-from-rules

Conversation

@with-developer

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

Copy link
Copy Markdown
Owner

A host could put words in the project's mouth: the dashboard showed the fix text a scan carried, as the project's guidance. This makes the dashboard take the fix of a built-in check from the server's own rules, and records why per-distribution shell commands in rules were not built (ADR 0018).

Why

A result carries remediation/remediationKo; the server checks only their length and that they are text, and the evidence view (host page, remediation page) showed them as "How to fix". A compromised host, or anyone with its ingest token, could push a result whose fix reads curl … | sh, and the dashboard would present it to the people who fix the fleet. Reproduced against vmsctl server run with a pushed result whose failing check's remediation was replaced: before this change both the host page and the remediation page showed the planted text; after it, both show the rule's text and the planted text appears nowhere.

What

  • GET /api/v1/controls/PROFILE/ID/info: what a built-in control checks and how to fix it, from the server's rules (404 for a control it has no rules for). Read scope, like the rest.
  • The evidence view takes the fix of a failed check from it. A check the server does not know (a policy pack's) shows the text the scan reported, labelled "as the scan reported it", as plain text.
  • The live demo records the new answers.
  • ADR 0018: the proposal to add per-distribution shell commands to rules was reviewed (independent review, recorded in the ADR) and not built: the trust path above, a container proof that proves too little (NOT_APPLICABLE in containers, idempotence, lock-out), families that are not platforms, parameters, and the remediation non-goal. It sets the conditions a structured fix would have to meet (declarative, rendered from the server's own rules, not in packs, tested per distribution, no bulk copy or export).
  • docs/fleet.md (and .ko).

The reports (vmsctl report) still render the fix text of the results they are given; the ADR lists that as a follow-up.

Tests

  • TestControlInfo: the rule's text, 404 for an unknown control, 401 without a token.
  • The planted-text check above in a browser (before and after); make test lint, make build-web; axe clean and no overflow on the host and remediation pages, en/ko × light/dark × 1280/390.

Review (/code-review high)

Fixed:

  • A check slipped in under a built-in control (a result where kisa-2026/U-01 lists x-evil.fix, failing, with its own fix) still showed its text, labelled "as the scan reported it". When the server knows the control, only its rules speak now: a check the rule does not list shows no fix. Checked in the browser with such a result: nothing of it shows.
  • Any failure to get the rules (500, network) became "unknown control" and let the scan's text through; only 404 means that now, and anything else shows no fix.
  • For one render after opening another control, the previous control's answer could be taken for the new one's; answers carry the control they are for.
  • The scan's CSV, which the dashboard offers in a host's history, wrote the host's fix text; it takes the rules' text the same way (and none for a slipped-in check). TestScanCSVFixFromRules fails without this.
  • A server without rules answered 404 for every control (which would send the dashboard to the hosts' text); it answers 503.
  • The ADR said the rules were cached by the browser, while the API sends no-store; the page keeps them per control now, and the ADR says so.
  • The remediation page no longer repeats the fix under each host's evidence (it is shown once above the hosts).
  • fixFor is a pure function with its own tests (vitest): the rule's text, nothing for an unlisted check, nothing while loading or after a failure, the scan's text only for an unknown control, a check run with other parameters.
  • The new translation key sits with the other host keys.

Not changed: the stored result itself (GET /api/v1/scans/ID, the "raw" link) stays as the host sent it: it is the host's document and the evidence; the ADR says so.

…r's rules, never from a host's result (ADR 0018)
…no fix, only 404 means no rules, answers keyed to their control and kept per page, the scan CSV takes the rules' text, 503 without rules
@with-developer
with-developer merged commit bedd6d0 into main Nov 24, 2026
20 checks passed
@with-developer
with-developer deleted the fix/fix-text-from-rules branch November 24, 2026 12:48
with-developer added a commit that referenced this pull request Nov 24, 2026
Install commands and image tags now name v0.48.1; the translation marker
of docs/fleet.ko.md points at the squash commit of #328 (bedd6d0).
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.

1 participant