Repository navigation
fix: dashboard: fix text from the server's rules, not from a host (ADR 0018) - #328
Merged
Merged
Conversation
…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
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.
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 readscurl … | sh, and the dashboard would present it to the people who fix the fleet. Reproduced againstvmsctl server runwith 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.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.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:
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.TestScanCSVFixFromRulesfails without this.no-store; the page keeps them per control now, and the ADR says so.fixForis 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.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.