Skip to content

Jetbrains override query#39800

Merged
mostlikelee merged 7 commits intomainfrom
26405-jetbrains
Feb 17, 2026
Merged

Jetbrains override query#39800
mostlikelee merged 7 commits intomainfrom
26405-jetbrains

Conversation

@mostlikelee
Copy link
Contributor

Related issue: Resolves #26405

Checklist for submitter

Found on disk metadata to use that conforms to the desired version scheme of Jetbrains products.

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

  • Added/updated automated tests

  • QA'd all new/changed functionality manually

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.27%. Comparing base (1b2a699) to head (269eea6).
⚠️ Report is 82 commits behind head on main.

Files with missing lines Patch % Lines
server/service/osquery_utils/queries.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #39800      +/-   ##
==========================================
+ Coverage   66.26%   66.27%   +0.01%     
==========================================
  Files        2438     2439       +1     
  Lines      195263   195404     +141     
  Branches     8538     8538              
==========================================
+ Hits       129384   129511     +127     
+ Misses      54165    54158       -7     
- Partials    11714    11735      +21     
Flag Coverage Δ
backend 68.07% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@ksykulev ksykulev left a comment

Choose a reason for hiding this comment

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

Not saying this is the incorrect approach. But would it be possible to use MutateSoftwareOnIngestion?

I know we did some munging of EAP versions: #22723
We also did some grabbing of release notes for versions on mac office:
#30082 (can't grab jetbrains website/docs on every software ingest)

I haven't specifically looked at how the mapping works for jetbrains versions. I assume the reason for the additional query is because a static hardcoded list would be out of the question, and the maintenance would be a nightmare?

`,
Platforms: []string{"windows"},
DirectIngestFunc: directIngestSoftware,
Discovery: discoveryTable("programs"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I see in the description it says Requires fleetd". I assume this is in reference to file_contents which is a fleetd extension table. Should we add it as one of the tables in Discovery?

When we added macos_codesign and macos_executable_sha256 we added the fleetd extension tables as part of the Discovery query. I believe this is because some users might have old versions of orbit after the server is upgraded so it could case breakages (I can't remember the exact mechanism here).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch! i updated the discovery query to use the file_contents table

END

WHERE p.publisher LIKE '%JetBrains%'
AND p.name NOT LIKE '%Toolbox%'
Copy link
Contributor

Choose a reason for hiding this comment

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

query looks good though! 👍


- Discovery query:
```sql
SELECT 1 FROM osquery_registry WHERE active = true AND registry = 'table' AND name = 'programs'
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING: Discovery query mismatch with the actual code

I noticed this documentation says the discovery query checks for the programs table, but the actual code at queries.go uses discoveryTable("file_contents"), which checks for the file_contents table instead. Since file_contents is the fleetd-specific table that might not be available, that's the one that really needs to be discovered. The programs table is always present on Windows.

It would be wonderful if we could update this to match what the code actually does:

Suggested change
SELECT 1 FROM osquery_registry WHERE active = true AND registry = 'table' AND name = 'programs'
SELECT 1 FROM osquery_registry WHERE active = true AND registry = 'table' AND name = 'file_contents'

// windows_jetbrains uses the version contained in the product-info.json file as exe installers
// provide an unconvertible build number in the programs table not used in vulnerability matching.
"windows_jetbrains": {
Description: "A software override query[^1] to append 'JetBrains' to the name of JetBrains Toolbox-managed applications on Windows. Requires `fleetd`",
Copy link
Contributor

Choose a reason for hiding this comment

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

SUGGESTION: Description doesn't match what the query does

The description says "to append 'JetBrains' to the name," but the query doesn't actually append anything to the name — it selects p.name AS name unchanged. The real purpose, as your helpful comment above explains, is to fix the version number by reading from product-info.json. It might be nice to update the description so it reflects what the query truly does — something like "A software override query to use the correct version from product-info.json for JetBrains Toolbox-managed applications on Windows."

This same description also appears in the docs file, so both would want updating together.

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Feb 17, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Well, I've taken a careful look through this PR, and I'm happy to say it all looks quite thoughtful and well-done. The new JetBrains software override query correctly selects the same columns expected by the Windows software ingestion pipeline, the COALESCE fallback to p.version is a nice safety net, and the LEFT JOIN ensures hosts without a product-info.json still report their software. The SoftwareOverrideMatch function properly mirrors the SQL WHERE clause logic, and both test files have been updated to account for the new query. The documentation is clear and matches the implementation.

Files Reviewed (4 files)
  • changes/26405-jetbrains - Changelog entry
  • docs/Contributing/product-groups/orchestration/understanding-host-vitals.md - Documentation for new query
  • server/service/osquery_utils/queries.go - New JetBrains software override query
  • server/service/osquery_test.go - Discovery test updated
  • server/service/osquery_utils/queries_test.go - Detail queries test updated

@mostlikelee
Copy link
Contributor Author

Not saying this is the incorrect approach. But would it be possible to use MutateSoftwareOnIngestion?

Ian and I both looked at a mutation approach, but unfortunately couldn't find a reliable approach

I know we did some munging of EAP versions: #22723 We also did some grabbing of release notes for versions on mac office: #30082 (can't grab jetbrains website/docs on every software ingest)

I chatted with Sharon on the release notes approach, but ultimately decided it was overkill for this case (only affects exe installers on windows)

I haven't specifically looked at how the mapping works for jetbrains versions. I assume the reason for the additional query is because a static hardcoded list would be out of the question, and the maintenance would be a nightmare?

that's the thought, hoping this approach will be maintenance free

@mostlikelee
Copy link
Contributor Author

@getvictor need a codeowner approval here for host vitals docs

Copy link
Collaborator

@sharon-fdm sharon-fdm left a comment

Choose a reason for hiding this comment

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

I only reviewed
docs/Contributing/product-groups/orchestration/understanding-host-vitals.md
LGTM.

Relying on existing approval for the rest.

@mostlikelee mostlikelee merged commit a3bafe8 into main Feb 17, 2026
50 checks passed
@mostlikelee mostlikelee deleted the 26405-jetbrains branch February 17, 2026 15:00
mostlikelee added a commit that referenced this pull request Mar 4, 2026
@mostlikelee mostlikelee mentioned this pull request Mar 4, 2026
4 tasks
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.

🪲JetBrains Windows products installed outside JetBrains Toolbox don't show year-based versions

3 participants