Skip to content

Conversation

@Micah-Kolide
Copy link
Contributor

This PR extends the optimized columns for the Darwin platform. I've split up the optimized changes into multiple PRs to make it easier to validate the table generation methods. I've only added tables where I believe and tested the generate methods support the IN optimization.

I've confirmed that the columns can support these changes by querying the tables with an IN constraint on the optimized columns. I validated the expected results by comparing returned values from osquery 5.13.1 (before IN optimization existed), 5.14.1, and 5.14.1 containing these spec file changes.

With each query I included a NULL, '' (empty string), and some non-existent values in my IN constraint.

Tests were ran on macOS Sequoia: Version 15.2 Beta (24C5079e).

@Micah-Kolide Micah-Kolide requested review from a team as code owners November 27, 2024 19:16
Copy link
Member

@directionless directionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay. These one do some extra stuff to expand LIKE expressions, but it's probably fine

schema([
Column("name", TEXT, "Name of the Name.app folder"),
Column("path", TEXT, "Absolute and full Name.app path", index=True),
Column("path", TEXT, "Absolute and full Name.app path", index=True, optimized=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole Application path accumulator could be less nested, but I think this is correct.

description("Query file metadata in the Spotlight database.")
schema([
Column("path", TEXT, "Path of the file", required=True),
Column("path", TEXT, "Path of the file", required=True, optimized=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if

context.expandConstraints(
"path",
LIKE,
paths,
is going to tweak this

Column("value", TEXT, "String value of most CF types"),
Column("path", TEXT, "(required) read preferences from a plist",
required=True),
Column("path", TEXT, "(required) read preferences from a plist", required=True, optimized=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same path expansion for LIKE, but sure

schema([
Column("path", TEXT, "Must provide a path or directory",
index=True, required=True),
Column("path", TEXT, "Must provide a path or directory", index=True, optimized=True, required=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same exapansions

@directionless directionless merged commit 2af0eb7 into osquery:master Dec 12, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants