Skip to content
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

Add kolide_flatpak_upgradeable table with exec parser #1635

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

Micah-Kolide
Copy link
Contributor

@Micah-Kolide Micah-Kolide commented Mar 1, 2024

Add a Kolide table for flatpak outdated packages. This one was very frustrating with how flatpak outputs data. Perhaps I should've started with only the app id and stopping there, but I was hoping to use the new StringDelimitedLineFunc to handle parsing the flatpak data table flatpak-table-printer.c. I was defeated in a truly brutal battle, the ages will never forget the terror that was flatpak tables.

Besides manually defining a header list for each Linux distribution I'm not sure how we could correctly parse flatpak remote-ls output. I did not feel like doing that at the moment, so that's why I've settled on only app id.

osquery> SELECT * FROM kolide_flatpak_upgradeable;
+---------+--------+-----+-------------------------------------+-------+
| fullkey | parent | key | value                               | query |
+---------+--------+-----+-------------------------------------+-------+
| 0/id    | 0      | id  | com.discordapp.Discord              | *     |
| 1/id    | 1      | id  | org.freedesktop.Platform.GL.default | *     |
| 2/id    | 2      | id  | org.freedesktop.Platform.GL.default | *     |
| 3/id    | 3      | id  | org.freedesktop.Platform.Locale     | *     |
| 4/id    | 4      | id  | org.freedesktop.Platform            | *     |
+---------+--------+-----+-------------------------------------+-------+

@Micah-Kolide Micah-Kolide force-pushed the micah/add_flatpak_package_update_table branch from 787e25a to 0c47455 Compare March 1, 2024 20:08
@Micah-Kolide Micah-Kolide changed the title Add flatpak upgradeable kolide table with exec parser Add kolide_flatpak_upgradeable table with exec parser Mar 1, 2024
@Micah-Kolide Micah-Kolide marked this pull request as ready for review March 1, 2024 20:26
Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the documentation + the thorough tests -- just one suggestion

Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

🔥

@Micah-Kolide Micah-Kolide added this pull request to the merge queue Mar 1, 2024
//
// flatpak remote-ls --updates
// data is separated by whitespace only
// data headers aren't in stdout, they are written directly to TTY
Copy link
Contributor

Choose a reason for hiding this comment

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

OMG really?

Copy link
Contributor

Choose a reason for hiding this comment

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

You know... we used to have an exec tool that faked a pty. We deleted it a bit ago, but https://github.com/kolide/launcher/tree/19cb2b48a4df91021132ab5b62dadbff79a74def/pkg/ptycmd

Is it worth looking at bringing that back for headers and then doing something straightforward?

Copy link
Contributor Author

@Micah-Kolide Micah-Kolide Mar 1, 2024

Choose a reason for hiding this comment

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

I did go down the path of attempting to read the headers from tty, but I spent a while without making progress, so I stepped away from that solution. If there's prior art for this, then it's worth revisiting and trying out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried going down this list, but I wasn't able to get any output in my testing, so I'm going to merge this for now and revisit as needed.

@directionless directionless removed this pull request from the merge queue due to a manual request Mar 1, 2024
@directionless
Copy link
Contributor

(I'm pulling from the merge queue, because I want to ponder pty with micah. We can carry on if we don't want to pick that up)

@Micah-Kolide
Copy link
Contributor Author

(I'm pulling from the merge queue, because I want to ponder pty with micah. We can carry on if we don't want to pick that up)

No worries, I'm good to discuss the options.

@Micah-Kolide Micah-Kolide added this pull request to the merge queue Mar 11, 2024
Merged via the queue into main with commit 07772f6 Mar 11, 2024
31 checks passed
@Micah-Kolide Micah-Kolide deleted the micah/add_flatpak_package_update_table branch March 11, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants