File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed
server/service/osquery_utils Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change
1
+ * removed duplicate software records from homebrew casks already reported in the osquery `apps` table to address false positive vulnerabilities due to lack of bundle_identifier
Original file line number Diff line number Diff line change @@ -662,7 +662,22 @@ SELECT
662
662
' ' AS vendor,
663
663
0 AS last_opened_at,
664
664
path AS installed_path
665
- FROM homebrew_packages;
665
+ FROM homebrew_packages
666
+ WHERE type = ' formula'
667
+ UNION
668
+ SELECT
669
+ name AS name,
670
+ version AS version,
671
+ ' ' AS bundle_identifier,
672
+ ' ' AS extension_id,
673
+ ' ' AS browser,
674
+ ' homebrew_packages' AS source,
675
+ ' ' AS vendor,
676
+ 0 AS last_opened_at,
677
+ path AS installed_path
678
+ FROM homebrew_packages
679
+ WHERE type = ' cask'
680
+ AND NOT EXISTS (SELECT 1 FROM file WHERE file.path LIKE CONCAT(homebrew_packages.path, ' / %%' ) AND file.path LIKE ' %.app%' LIMIT 1);
666
681
```
667
682
668
683
## software_macos_codesign
Original file line number Diff line number Diff line change @@ -823,6 +823,10 @@ var softwareMacOS = DetailQuery{
823
823
// ensure that the nested loops in the query generation are ordered correctly for the _extensions
824
824
// tables that need a uid parameter. CROSS JOIN ensures that SQLite does not reorder the loop
825
825
// nesting, which is important as described in https://youtu.be/hcn3HIcHAAo?t=77.
826
+ //
827
+ // Homebrew package casks are filtered to exclude those that have an associated .app bundle
828
+ // as these are already included in the apps table. Apps table software includes bundle_identifier
829
+ // which is used in vulnerability scanning.
826
830
Query : withCachedUsers (`WITH cached_users AS (%s)
827
831
SELECT
828
832
name AS name,
@@ -894,7 +898,22 @@ SELECT
894
898
'' AS vendor,
895
899
0 AS last_opened_at,
896
900
path AS installed_path
897
- FROM homebrew_packages;
901
+ FROM homebrew_packages
902
+ WHERE type = 'formula'
903
+ UNION
904
+ SELECT
905
+ name AS name,
906
+ version AS version,
907
+ '' AS bundle_identifier,
908
+ '' AS extension_id,
909
+ '' AS browser,
910
+ 'homebrew_packages' AS source,
911
+ '' AS vendor,
912
+ 0 AS last_opened_at,
913
+ path AS installed_path
914
+ FROM homebrew_packages
915
+ WHERE type = 'cask'
916
+ AND NOT EXISTS (SELECT 1 FROM file WHERE file.path LIKE CONCAT(homebrew_packages.path, '/%%%%') AND file.path LIKE '%%.app%%' LIMIT 1);
898
917
` ),
899
918
Platforms : []string {"darwin" },
900
919
DirectIngestFunc : directIngestSoftware ,
You can’t perform that action at this time.
0 commit comments