Repository navigation
fix(OSQUERY-004): CU-86aknprfh 2 review findings across 2 files - #110
flamingo[bot] wants to merge 2 commits into
Conversation
| 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); |
There was a problem hiding this comment.
🦩 🟠 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
| // 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; | ||
| } |
There was a problem hiding this comment.
🦩 🟠 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
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.
osquery/core/windows/wmi.cpp:75plugins/logger/filesystem_logger.cpp:32What 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-046396b5281cMerging 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)