Skip to content

fix(OSQUERY-004): CU-86aknprfh 2 review findings across 2 files - #110

Draft
flamingo[bot] wants to merge 2 commits into
masterfrom
ai-fix/osquery-004-a47140a8-116a6ce1
Draft

flamingo[bot] wants to merge 2 commits into
masterfrom
ai-fix/osquery-004-a47140a8-116a6ce1

Conversation

@flamingo

@flamingo flamingo Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Closes 2 review findings across 2 files.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟢 90 high wmi.cpp PrintType uses std::cerr/std::cout/std::wcout for diagnostics instead of LOG()/VLOG() osquery/core/windows/wmi.cpp:75
2 🟡 75 medium std::cerr used for diagnostics instead of LOG()/VLOG() macros plugins/logger/filesystem_logger.cpp:32

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 116a6ce1-ae2a-4217-a4a6-046396b5281c

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86aknprfh Osquery review findings sweep (14 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 What this fix changed, finding by finding

2 finding(s) fixed in this draft — 2 explained inline on the diff.

Comment on lines 77 to 89
VARIANT value;
HRESULT hr = result_->Get(property_name.c_str(), 0, &value, nullptr, nullptr);
if (hr != S_OK) {
std::cerr << "Failed: " << name << "\n";
LOG(ERROR) << "Failed: " << name;
} else {
std::cout << "Name=" << name << ", Type=" << value.vt << "\n";
VLOG(1) << "Name=" << name << ", Type=" << value.vt;
if (value.vt == VT_I4) {
std::cout << " Value=" << value.lVal << "\n";
VLOG(1) << " Value=" << value.lVal;
} else if (value.vt == VT_BSTR) {
std::wcout << " Value=" << value.bstrVal << "\n";
VLOG(1) << " Value=" << wstringToString(value.bstrVal);
}
}
VariantClear(&value);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 wmi.cpp PrintType uses std::cerr/std::cout/std::wcout for diagnostics instead of LOG()/VLOG()

In WmiResultItem::PrintType (osquery/core/windows/wmi.cpp), replaced the direct std::cerr/std::cout/std::wcout diagnostic writes with LOG(ERROR) for the failure path and VLOG(1) for the success/value-printing path, using the existing osquery/logger/logger.h include already present in this file. The std::wcout call for BSTR values was converted via the already-included wstringToString helper (from osquery/utils/conversions/windows/strings.h, already used elsewhere in this file) so the value can be streamed into VLOG(1) as a std::string rather than requiring wide-stream output. No new includes or external modules were introduced.

🤖 Prompt for AI agents
In osquery/core/windows/wmi.cpp around line 75, review and complete this code-review fix: wmi.cpp PrintType uses std::cerr/std::cout/std::wcout for diagnostics instead of LOG()/VLOG().
What the draft fix changed: In `WmiResultItem::PrintType` (osquery/core/windows/wmi.cpp), replaced the direct `std::cerr`/`std::cout`/`std::wcout` diagnostic writes with `LOG(ERROR)` for the failure path and `VLOG(1)` for the success/value-printing path, using the existing `osquery/logger/logger.h` include already present in this file. The `std::wcout` call for BSTR values was converted via the already-included `wstringToString` helper (from `osquery/utils/conversions/windows/strings.h`, already used elsewhere in this file) so the value can be streamed into `VLOG(1)` as a `std::string` rather than requiring wide-stream output. No new includes or external modules were introduced.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

Comment on lines 33 to 39
// Account for leading 0, special bit, and normal permissions
if (value.size() > 5) {
osquery::systemLog(kLoggerModeInvalidValueError);
std::cerr << kLoggerModeInvalidValueError << std::endl;
LOG(ERROR) << kLoggerModeInvalidValueError;

return false;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 std::cerr used for diagnostics instead of LOG()/VLOG() macros

In validateLoggerMode (plugins/logger/filesystem_logger.cpp), replaced the three redundant std::cerr << ... << std::endl; diagnostic lines with LOG(ERROR) << ...;, routing output through the glog-backed LOG() macro instead of raw stderr, per OSQUERY-004/004-2. The <iostream> include was left in place since it is not otherwise flagged and removing it is outside the scope of this finding (risk: low, unused include may remain but causes no build issue since other headers may still rely on standard streams indirectly).

🤖 Prompt for AI agents
In plugins/logger/filesystem_logger.cpp around line 32, review and complete this code-review fix: std::cerr used for diagnostics instead of LOG()/VLOG() macros.
What the draft fix changed: In `validateLoggerMode` (plugins/logger/filesystem_logger.cpp), replaced the three redundant `std::cerr << ... << std::endl;` diagnostic lines with `LOG(ERROR) << ...;`, routing output through the glog-backed LOG() macro instead of raw stderr, per OSQUERY-004/004-2. The `<iostream>` include was left in place since it is not otherwise flagged and removing it is outside the scope of this finding (risk: low, unused include may remain but causes no build issue since other headers may still rely on standard streams indirectly).
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 75 medium — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(OSQUERY-004): 2 review findings across 2 files fix(OSQUERY-004): CU-86aknprfh 2 review findings across 2 files Oct 5, 2026
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.

0 participants