Skip software_id=0 and log, but otherwise complete counts, when counting host software on a host_software table including rows with software ID zero - #30523
Conversation
…ing host software on a host_software table including rows with software ID zero Fixes #30522.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30523 +/- ##
=======================================
Coverage 64.15% 64.15%
=======================================
Files 1874 1874
Lines 184168 184173 +5
Branches 5387 5387
=======================================
+ Hits 118154 118158 +4
- Misses 56697 56698 +1
Partials 9317 9317
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Previously, we were no-op'ing datastore logs, and I was confused on why we weren't seeing the log I had added when running vuln processing.
WalkthroughThe changes address an issue where host software counts were not updated if the Changes
Sequence Diagram(s)sequenceDiagram
participant VulnerabilityJob
participant Datastore
participant Logger
VulnerabilityJob->>Datastore: SyncHostsSoftware()
Datastore->>Datastore: Query min/max software_id from host_software
alt min_software_id == 0
Datastore->>Logger: Log warning about software_id 0
Datastore->>Datastore: Set min_software_id = 1
end
Datastore->>Datastore: Count host software (excluding software_id 0)
Datastore-->>VulnerabilityJob: Return updated counts
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code Graph Analysis (2)cmd/fleet/vuln_process.go (1)
server/datastore/mysql/software_test.go (1)
⏰ Context from checks skipped due to timeout of 90000ms (28)
🔇 Additional comments (5)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Fixes #30522.
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements)Summary by CodeRabbit
Bug Fixes
Tests