-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated python_packages osquery query #26434
base: main
Are you sure you want to change the base?
Conversation
I tried to add some tests in |
ca3afeb
to
0cce418
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #26434 +/- ##
==========================================
+ Coverage 63.72% 63.84% +0.12%
==========================================
Files 1655 1659 +4
Lines 158995 159162 +167
Branches 4144 4144
==========================================
+ Hits 101321 101619 +298
+ Misses 49737 49602 -135
- Partials 7937 7941 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -850,7 +851,7 @@ SELECT | |||
'' AS vendor, | |||
0 AS last_opened_at, | |||
path AS installed_path | |||
FROM python_packages | |||
FROM ` + osqueryVersionGreaterThanEqual("5.16.0", "cached_users CROSS JOIN python_packages USING (uid)", "python_packages") + ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work when a fleet of hosts have mixed osquery versions? This feels like we're hard-coding the query for the entirety of the Fleet server, which means this will either skip the new functionality or break old clients depending on when Fleet was built, rather than based on what the host actually has installed.
Feels like the right place to put this is in GetDetailQueries
, potentially as another type of override. Splitting this query up might allow for more code reuse with that override.
Likely need to update gen_queries_doc.go
as well to either split results based on osquery version, or at least link to GitHub history for how vitals queries change while mentioning which osquery version those queries correspond to.
The catch with this is that we'll have one query in detail queries relying on the result of ingesting another detail query, which is particularly tricky when setting things up on enrollment, but this looks fixable by splitting the detail queries onto a group that relies on host into and a group that doesn't, running the "doesn't" group first, then passing host info into the generator for the rest. Then if we don't get osquery info back we assume an old version of osquery, which will return less info but won't break.
Nice thing about all of the above is it makes this a lot more testable, since calling an endpoint with differing query results for osquery_info
will kick back the relevant software query.
A new feature in osquery 5.16 was created to allow for scanning of user directories for python packages. If the new version of osquery is detected use the new query, otherwise use the old query.
0cce418
to
72c5159
Compare
A new feature in osquery
5.16
was created to allow for scanning of user directories for python packages. If the new version of osquery is detected use the new query, otherwise use the old query.#26423
changes/
,orbit/changes/
oree/fleetd-chrome/changes
.See Changes files for more information.