Skip to content

Conversation

@arymoraes
Copy link
Contributor

Include VSCode Insiders extensions in vscode_extensions table

Background

As per this issue -> #8350 <- this PR introduces VSCode insiders extensions in the vscode_extensions table.

Changes

This changes:

  • osquery/tables/applications/vscode_extensions.cpp - Add path for .vscode-server-insiders and .vscode-insiders /extensions/extensions.json files, and also adds a new column named version_type to differentiate between vscode or vscode_insiders.
  • Also updates specs/vscode_extensions.table and tests/integration/tables/vscode_extensions.cpp to include the new column.

@arymoraes arymoraes requested review from a team as code owners August 8, 2024 01:59
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Smjert
Smjert previously requested changes Aug 9, 2024
Copy link
Member

@Smjert Smjert left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

I have a minor ask to better support potential expansion to this logic.

for (const auto& confDir : confDirs) {
// Determine the version type
std::string version_type =
(confDir.second.string().find("insiders") != std::string::npos)
Copy link
Member

Choose a reason for hiding this comment

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

Instead of making this generic check, I would just add the information we need in the confDirs set, so we have the correct information already there.

So store a struct with 3 values in it instead of the std::pair, with the third being the version_type.

And at this point I would also make confDirs -> conf_dirs to be consistent with the variable naming scheme.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, think that would be clearer too.

I didn't have time to make the change during the weekend but will do in the next couple days. Thank you for the feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I made a ConfDir struct that contains the uid, path and version_type and am using it inside the conf_dirs set.

Let me know if this is not what you had in mind since my C++ is not great

@arymoraes arymoraes requested a review from Smjert August 18, 2024 03:00
@michael-myers
Copy link
Contributor

michael-myers commented Aug 23, 2024

I just tested this on macOS Sonoma using the current versions of Visual Studio Code (1.92.2) and Visual Studio Code Insiders (1.93.0), with the two apps installed side-by-side (well, the app bundles can be anywhere, but the settings directories are side-by-side). Works well 👍

Column("prerelease", INTEGER, "Pre release version"),
Column("uid", BIGINT, "The local user that owns the plugin",
additional=True),
Column("version_type", TEXT, "VSCode or VSCode Insiders")
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure version_type is the right name. Is this about whether the vscode itself is running an insiders/beta edition or is it specific to the extension?

Reading the code, this is switching off the path. I don't know the ecosystem here, but is server something we'd want to expose?

Would we want this to be vscode_edition? Or omit it, and let clients infer from the path, the same way this does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For server, we’re already exposing it for the regular VSCode version. If I’m running osquery on WSL and have VSCode on my Windows, the extensions come from the /home/.../.vscode-server/extensions path, for example.

And I agree version_type may not be the best name, as it could get confused with the extension’s version type. vscode_edition seems better. We could omit it, but I think having it as a single column adds clarity.

So maybe keep exposing server and change the column to vscode_edition?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think keeping it, but naming it vscode_edition makes more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I kept it and changed the name to vscode_edition

@Smjert Smjert dismissed their stale review November 6, 2024 12:24

The request has been satisfied

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.

4 participants