Refactoring ListHostSoftware
Spun off of: https://github.com/fleetdm/fleet/issues/22445 Related to: https://github.com/fleetdm/fleet/issues/26824
In order to simplify #22445 & #26824, creating an issue to deal with the refactor and adding search by software name or cve separately. The previous 2 issues are both dealing with the same bit of code and all rely on each other. This issue will also rely on the work from the previous two issues.
Problem
I want to be able to reason about ListHostSoftware method better. I want to be able to search the host software page by software name and cve vulnerability.
What have you tried?
Typing into the search box on the host software detail page. While this allows me to search by software name, it does not allow me to search by cve.
Potential solutions
This type of search is already present on the /software/titles page. Add this same type of search onto the host software page.
What is the expected workflow as a result of your proposal?
Vulnerable only
- Toggle on vulnerability filter
- Type in a search term "ve" or "3"
- See that only vulnerable software installed on the host is being returned
All installed software on host
- Ensure vulnerability filter is toggled off
- Type in search term "ve" or "3"
- See that vulnerable software and software installed on the host is being returned
See the examples from the software titles page:
3 https://dogfood.fleetdm.com/software/titles?query=3&order_direction=desc&order_key=hosts_count&page=2
ve https://dogfood.fleetdm.com/software/titles?query=ve&order_direction=desc&order_key=hosts_count&page=0
moving this out of scope of #22445 as not to block that story
@mostlikelee Hi there. Could you transform this into a story so that it gets a test plan and is ready for QA once we build it.
TEST PLAN
“All software” list
-
[x] All "Available for install", and all apps already installed on the host computer show in All software list.
-
[x] Searching for any available to install or already installed software in the list should return the software item
-
[x] All VPP apps that are available to install show in All software list
-
[x] All VPP apps with custom targets - exclude any labels show in All software list if the host does not have the label
-
[x] All VPP apps with custom targets - include any labels show in All software list if the host has the label
-
[x] All VPP apps with custom targets - exclude any labels do not show in All software list if the host has the label
-
[x] All VPP apps with custom targets - include any labels do not show in All software list if the host does not have the label
-
[x] Searching for any VPP app that is present in the “All software” list, should return the VPP app item, regardless of whether or not it has been installed on the host.
-
[x] VPP apps that are available to install show "Self service" in the "Install status" column when "Self-service" is checked and the host is MDM enabled and within the software's target scope.
-
[x] All FMA/custom packages that are available to install show in All software list
-
[ ] All FMA/custom packages with custom targets - exclude any labels show in All software list if the host does not have the label (filed #29315)
-
[x] All FMA/custom packages with custom targets - include any labels show in All software list if the host has the label
-
[x] All FMA/custom packages with custom targets - exclude any labels do not show in All software list if the host has the label
-
[x] All FMA/custom packages with custom targets - include any labels do not show in All software list if the host does not have the label
-
[x] Searching for any FMA/custom package that is present in the “All software” list, should return the FMA item, regardless of whether or not it has been installed on the host.
“Available for install” list
-
[x] All VPP apps that are available to install show in Available for install list
-
[x] All VPP apps with custom targets - exclude any labels show in Available for install list if the host does not have the label
-
[x] All VPP apps with custom targets - include any labels show in Available for install list if the host has the label
-
[x] All VPP apps with custom targets - exclude any labels do not show in Available for install list if the host has the label
-
[x] All VPP apps with custom targets - include any labels do not show in Available for install list if the host does not have the label
-
[x] With the software filtered to “Available to install”, searching for any VPP app that is present in the “Available to install” list, should return the VPP app item, regardless of whether or not it has been installed on the host.
-
[x] All FMA/custom packages that are available to install show in Available for install list
-
[ ] All FMA/custom packages with custom targets - exclude any labels show in Available for install list if the host does not have the label (Filed #29315)
-
[x] All FMA/custom packages with custom targets - include any labels show in Available for install list if the host has the label
-
[x] All FMA/custom packages with custom targets - exclude any labels do not show in Available for install list if the host has the label
-
[x] All FMA/custom packages with custom targets - include any labels do not show in Available for install list if the host does not have the label
-
[x] With the software filtered to “Available to install”, searching for any FMA/custom package that is present in the “Available for install” list, should return the FMA item, regardless of whether or not it has been installed on the host.
Self-service
-
[x] All VPP apps with "Self-service" option selected show in Self-service
-
[x] All VPP apps with custom targets - exclude any labels and "Self-service" option show in Self-service list if the host does not have the label
-
[x] All VPP apps with custom targets - include any labels and "Self-service" option show in Self-service list if the host has the label
-
[x] All VPP apps with custom targets - exclude any labels and "Self-service" option do not show in Self-service list if the host has the label
-
[x] All VPP apps with custom targets - include any labels and "Self-service" option do not show in Self-service list if the host does not have the label
-
[x] All FMA/custom packages with "Self-service" option selected show in Self-service
-
[ ] All FMA/custom packages with custom targets - exclude any labels and "Self-service" option show in Self-service list if the host does not have the label (Filed #29315)
-
[x] All FMA/custom packages with custom targets - include any labels and "Self-service" option show in Self-service list if the host has the label
-
[x] All FMA/custom packages with custom targets - exclude any labels and "Self-service" option do not show in Self-service list if the host has the label
-
[x] All FMA/custom packages with custom targets - include any labels and "Self-service" option do not show in Self-service list if the host does not have the label
Vulnerability filters (Note: filed #29308)
- [x] Filtering by “Vulnerable software” only returns installed software with one or more vulnerabilities associated with it.
- [x] Searching by CVE while filtered to “Vulnerable software” returns only the software with that CVE associated with it
- [x] Searching by name while filtered to “Vulnerable software” returns only software that contains the string being searched in the software name
- [x] Setting the dropdown to “Available for install” should not clear out the filters associated with vulnerabilities and should return:
- [x] Only software that has vulnerabilities associated with it (and also match any other filters set in the modal)
- [x] Also matches the string/CVE being searched (if any)
- [x] Is also available to install (this means the software will have to be installed already but is also available to install)
- [x] When the dropdown is set to “All software”, and the filter is set to “Vulnerable software” any additional filters (Severity, Has known exploit) should return only the software with associated vulnerabilities that meet the Severity and “Has known exploit” filters.
Refactor code, clear view, Search with ease, CVE true. Safer systems ensue.