make sure vulns are shown in list OS page, and fix the names (#31930)

# Checklist for submitter

If some of the following don't apply, delete the relevant line.


## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually

For unreleased bug fixes in a release candidate, one of:
- [x] Confirmed that the fix is not expected to adversely impact load
test results
This commit is contained in:
Jahziel Villasana-Espinoza 2025-08-14 16:47:58 -04:00 committed by GitHub
parent d09e631b5c
commit 56284ef87b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 5 deletions

View file

@ -26,6 +26,7 @@ import {
INumberCellProps,
IStringCellProps,
} from "interfaces/datatable_config";
import { isLinuxLike } from "interfaces/platform";
type ITableColumnConfig = Column<IOperatingSystemVersion>;
@ -65,7 +66,7 @@ const generateDefaultTableHeaders = (
);
}
const { name, os_version_id, platform } = cellProps.row.original;
const { name_only, os_version_id, platform } = cellProps.row.original;
const softwareOsDetailsPath = getPathWithQueryParams(
PATHS.SOFTWARE_OS_DETAILS(os_version_id),
@ -85,7 +86,7 @@ const generateDefaultTableHeaders = (
customOnClick={onClickSoftware}
tooltipTruncate
prefix={<OSIcon name={platform} />}
value={name}
value={name_only}
/>
);
},
@ -104,7 +105,11 @@ const generateDefaultTableHeaders = (
accessor: "vulnerabilities",
Cell: (cellProps: IVulnCellProps) => {
const platform = cellProps.row.original.platform;
if (platform !== "darwin" && platform !== "windows") {
if (
platform !== "darwin" &&
platform !== "windows" &&
!isLinuxLike(platform)
) {
return <TextCell value="Not supported" grey />;
}
return <VulnerabilitiesCell vulnerabilities={cellProps.cell.value} />;

View file

@ -2306,7 +2306,10 @@ func (svc *Service) populateOSVersionDetails(ctx context.Context, osVersion *fle
if err != nil {
return err
}
osVersion.Kernels = kernels
if len(kernels) > 0 {
osVersion.Kernels = kernels
}
}
return nil

View file

@ -3,6 +3,7 @@ package service
import (
"context"
"fmt"
"io"
"net/http"
"sort"
"testing"
@ -118,8 +119,14 @@ func (s *integrationEnterpriseTestSuite) TestLinuxOSVulns() {
require.NoError(t, err)
}
// Aggregate OS versions
// Entity endpoint kernels field should be empty
require.NoError(t, s.ds.UpdateOSVersions(ctx))
resp := s.Do("GET", fmt.Sprintf("/api/latest/fleet/os_versions/%d", osinfo.OSVersionID), nil, http.StatusOK, "team_id", fmt.Sprintf("%d", 0))
bodyBytes, err := io.ReadAll(resp.Body)
require.NoError(t, err)
assert.Contains(t, string(bodyBytes), `"kernels": []`)
// Aggregate OS versions
require.NoError(t, s.ds.UpdateOSVersions(ctx))
require.NoError(t, s.ds.SyncHostsSoftware(ctx, time.Now()))
require.NoError(t, s.ds.ReconcileSoftwareTitles(ctx))