-
Notifications
You must be signed in to change notification settings - Fork 0
fix(OSQUERY-004-2): 8 review findings across 4 files #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
efed3c2
38e9b87
45955a7
f7b4a0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,13 +77,13 @@ void WmiResultItem::PrintType(const std::string& name) const { | |
| VARIANT value; | ||
| HRESULT hr = result_->Get(property_name.c_str(), 0, &value, nullptr, nullptr); | ||
| if (hr != S_OK) { | ||
| std::cerr << "Failed: " << name << "\n"; | ||
| LOG(INFO) << "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); | ||
|
|
@@ -238,7 +238,7 @@ Status WmiResultItem::GetUnsignedLong(const std::string& name, | |
| VariantClear(&value); | ||
| return Status::failure("Invalid data type returned."); | ||
| } | ||
| ret = value.lVal; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π WmiResultItem::GetUnsignedLong and GetLongLong read the wrong VARIANT union member for wide types In WmiResultItem::GetUnsignedLong, changed π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| ret = value.ulVal; | ||
| VariantClear(&value); | ||
| return Status::success(); | ||
| } | ||
|
|
@@ -255,7 +255,7 @@ Status WmiResultItem::GetLongLong(const std::string& name, | |
| VariantClear(&value); | ||
| return Status::failure("Invalid data type returned."); | ||
| } | ||
| ret = value.lVal; | ||
| ret = value.llVal; | ||
| VariantClear(&value); | ||
| return Status::success(); | ||
| } | ||
|
|
@@ -272,7 +272,7 @@ Status WmiResultItem::GetUnsignedLongLong(const std::string& name, | |
| VariantClear(&value); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π GetUnsignedLongLong reads 32-bit value.lVal instead of the 64-bit unsigned member for VT_UI8 In WmiResultItem::GetUnsignedLongLong, changed π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| return Status::failure("Invalid data type returned."); | ||
| } | ||
| ret = value.lVal; | ||
| ret = value.ullVal; | ||
| VariantClear(&value); | ||
| return Status::success(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,6 +153,7 @@ void UserEtwSessionRunnable::resume() { | |
| void UserEtwSessionRunnable::initUserTraceSession( | ||
| const std::string& sessionName) { | ||
| if (sessionName.empty()) { | ||
| LOG(ERROR) << "UserTraceSession does not have a name."; | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -176,6 +177,7 @@ void UserEtwSessionRunnable::initUserTraceSession( | |
| void UserEtwSessionRunnable::stopUserTraceSession( | ||
| const std::string& sessionName) { | ||
| if (sessionName.empty()) { | ||
| LOG(ERROR) << "Failed to stop user trace session, session name is empty."; | ||
| return; | ||
| } | ||
|
|
||
|
Comment on lines
177
to
183
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π initUserTraceSession silently returns on empty session name without logging, unlike its kernel counterpart Added π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -201,4 +203,4 @@ void UserEtwSessionRunnable::stopUserTraceSession( | |
| LOG(WARNING) << "ControlTrace() failed with error code " << retCtrl; | ||
| } | ||
| } | ||
| } // namespace osquery | ||
| } // namespace osquery | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,7 +144,7 @@ void FilePathsConfigParserPlugin::updateFilePathsQuery( | |
| for (const auto& row : sql.rows()) { | ||
| auto pathIt = row.find("path"); | ||
| if (pathIt == row.end()) { | ||
| LOG(ERROR) << "Cold not find non-empty 'path' column in the " | ||
| LOG(ERROR) << "Could not find non-empty 'path' column in the " | ||
| "results of file_paths_query '" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π LOG(ERROR) message typo 'Cold not find' in file_paths.cpp Fixed the typo "Cold not find" to "Could not find" in the LOG(ERROR) message inside FilePathsConfigParserPlugin::updateFilePathsQuery, at the branch handling a missing 'path' column in query results. π€ Prompt for AI agentsfix confidence: π’ 98 high β react π/π to teach the reviewer |
||
| << query.GetString() << "'"; | ||
| } else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,26 +32,23 @@ namespace { | |
| bool validateLoggerMode(const char* flagname, const std::string& value) { | ||
| // Account for leading 0, special bit, and normal permissions | ||
| if (value.size() > 5) { | ||
| osquery::systemLog(kLoggerModeInvalidValueError); | ||
| std::cerr << kLoggerModeInvalidValueError << std::endl; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π std::cerr used for diagnostic output instead of LOG() macros in validateLoggerMode In validateLoggerMode() (size check branch), replaced π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| LOG(ERROR) << kLoggerModeInvalidValueError; | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| const auto logger_mode_octal_exp = tryTo<std::int32_t>(value, 8); | ||
|
|
||
| if (logger_mode_octal_exp.isError()) { | ||
| osquery::systemLog(kLoggerModeConversionFailureError); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π std::cerr used for diagnostic output instead of LOG() macros (octal conversion failure path) In validateLoggerMode() (octal conversion failure branch), replaced π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| std::cerr << kLoggerModeConversionFailureError << std::endl; | ||
| LOG(ERROR) << kLoggerModeConversionFailureError; | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| const auto logger_mode_octal = logger_mode_octal_exp.get(); | ||
|
|
||
| if (logger_mode_octal <= 0 || logger_mode_octal > 07777) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π std::cerr used instead of LOG() macro for logger_mode range validation error In validateLoggerMode() (range validation branch), replaced π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| osquery::systemLog(kLoggerModeInvalidValueError); | ||
| std::cerr << kLoggerModeInvalidValueError << std::endl; | ||
| LOG(ERROR) << kLoggerModeInvalidValueError; | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -320,3 +317,4 @@ void FilesystemLoggerPlugin::init(const std::string& name, | |
| FLAGS_stderrthreshold = stderr_threshold; | ||
| } | ||
| } // namespace osquery | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π WMI PrintType() uses std::cerr/std::cout instead of osquery LOG/VLOG macros
In WmiResultItem::PrintType, replaced std::cerr with LOG(INFO) for the failure message, and std::cout/std::wcout with VLOG(1) for the diagnostic type/value output; the wide-string bstrVal is converted via existing wstringToString() helper to be compatible with the ostream-based VLOG macro instead of std::wcout.
π€ Prompt for AI agents
fix confidence: π‘ 85 medium β react π/π to teach the reviewer