-
Notifications
You must be signed in to change notification settings - Fork 0
fix(adhoc-sweep-fixes): 21 review findings across 21 files #40
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
61b6965
6519cb0
28c23e8
e03775c
f59ca2c
d18f43e
d782687
3288390
d7ff196
819cfe8
99c01c0
cf536e1
5c36af7
87316db
5bfdddb
5e07aec
d30f725
e9add70
9c91272
792dd17
4db61f3
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 |
|---|---|---|
|
|
@@ -221,17 +221,19 @@ static void concatFunc(sqlite3_context* context, | |
| } | ||
|
|
||
| std::string output; | ||
| bool wroteAny = false; | ||
|
|
||
| for (auto i = starting; i < argc; i++) { | ||
| if (SQLITE_NULL == sqlite3_value_type(argv[i])) { | ||
| continue; | ||
| } | ||
|
|
||
| output.append(reinterpret_cast<const char*>(sqlite3_value_text(argv[i]))); | ||
|
|
||
| if (sep != "" && i + 1 < argc) { | ||
| if (wroteAny && sep != "") { | ||
| output.append(sep); | ||
| } | ||
|
|
||
| output.append(reinterpret_cast<const char*>(sqlite3_value_text(argv[i]))); | ||
| wroteAny = true; | ||
| } | ||
|
|
||
| // Give up if the output is so large it's length overflows int | ||
|
Comment on lines
221
to
239
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. 𦩠π concatFunc silently produces incorrect separator placement when trailing NULL args are skipped In concatFunc (osquery/sql/sqlite_string.cpp), replaced the position-based separator lookahead ( (Automatically downgraded: no change in this fix lands near this finding's line β verify whether it was actually addressed.) π€ Prompt for AI agentsfix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -354,3 +356,4 @@ void registerStringExtensions(sqlite3* db) { | |
| nullptr); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,7 @@ Status FileEventSubscriber::Callback(const FSEventsEventContextRef& ec, | |
| // Need to call configure on the publisher, not the subscriber | ||
| if (ec->fsevent_flags & kFSEventStreamEventFlagMount) { | ||
| // Should we add listening to the mount point | ||
| auto subscriber = ([this, &ec]() { | ||
| auto subscriber = ([this, ec]() { | ||
| auto msc = createSubscriptionContext(); | ||
| msc->path = ec->path + "/*"; | ||
| msc->category = "tmp"; | ||
|
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. 𦩠π Lambda captures In π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
@@ -109,3 +109,4 @@ Status FileEventSubscriber::Callback(const FSEventsEventContextRef& ec, | |
| return Status::success(); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,8 +37,14 @@ void UserInteractionSubscriber::configure() { | |
| Status UserInteractionSubscriber::Callback( | ||
| const EventTappingEventContextRef& ec, | ||
| const EventTappingSubscriptionContextRef& sc) { | ||
| // TODO/FIXME: this Row is not populated from `ec` (the | ||
| // EventTappingEventContextRef) and is therefore emitted empty. This is | ||
| // incomplete scaffolding; the table should be populated with the actual | ||
| // event data (e.g. timestamp, event type, coordinates) from `ec` before | ||
| // this subscriber is considered production-ready. | ||
| Row r; | ||
| add(r); | ||
| return Status(0); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
|
Comment on lines
37
to
+50
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. 𦩠π UserInteractionSubscriber::Callback adds an entirely empty Row for every event, discarding all event data In π€ Prompt for AI agentsfix confidence: π΄ 45 low β review closely β react π/π to teach the reviewer |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,7 +206,7 @@ Status AuditProcessEventSubscriber::ProcessEvents( | |
| event_data.syscall_number, | ||
| *syscall_event_record); | ||
| if (!s.ok()) { | ||
| VLOG(1) << "Malformed AUDIT_SYSCALL event: " << status.getMessage(); | ||
| VLOG(1) << "Malformed AUDIT_SYSCALL event: " << s.getMessage(); | ||
| continue; | ||
| } | ||
|
|
||
|
Comment on lines
206
to
212
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. 𦩠π΅ Stale In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -388,3 +388,4 @@ AuditProcessEventSubscriber::GetSyscallNameMap() noexcept { | |
| return kSyscallNameMap; | ||
| } | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
|
|
||
| #include <osquery/core/tables.h> | ||
| #include <osquery/filesystem/filesystem.h> | ||
| #include <osquery/logger/logger.h> | ||
| #include <osquery/utils/conversions/split.h> | ||
| #include <osquery/utils/expected/expected.h> | ||
|
|
||
|
|
@@ -26,7 +27,12 @@ QueryData genMemoryMap(QueryContext& context) { | |
|
|
||
| std::vector<std::string> regions; | ||
| std::string content; | ||
| readFile(kIOMemLocation, content); | ||
| auto status = readFile(kIOMemLocation, content); | ||
| if (!status.ok()) { | ||
| VLOG(1) << "Could not read " << kIOMemLocation << ": " | ||
| << status.getMessage(); | ||
| return results; | ||
| } | ||
|
|
||
| regions = osquery::split(content, "\n"); | ||
| for (const auto& line : regions) { | ||
|
Comment on lines
27
to
38
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. 𦩠π genMemoryMap ignores the Status returned by readFile, silently proceeding on failure In genMemoryMap (osquery/tables/system/linux/memory_map.cpp), the Status returned by readFile(kIOMemLocation, content) is now captured and checked; on failure a VLOG(1) diagnostic message including the status message is logged and the function returns the empty results early, matching the established pattern in sibling files. Added #include <osquery/logger/logger.h> to support VLOG usage. π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,6 @@ static void fetchMethodResultLong(std::string& result, | |
| } | ||
|
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. 𦩠π bitlocker_info.cpp: unchecked GetString/GetLong return statuses can leave stale row data across iterations In genBitlockerInfo (osquery/tables/system/windows/bitlocker_info.cpp), moved the π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
||
| QueryData genBitlockerInfo(QueryContext& context) { | ||
| Row r; | ||
| QueryData results; | ||
|
|
||
| const Expected<WmiRequest, WmiError> wmiSystemReq = | ||
|
|
@@ -54,16 +53,32 @@ QueryData genBitlockerInfo(QueryContext& context) { | |
| } | ||
| const std::vector<WmiResultItem>& wmiResults = wmiSystemReq->results(); | ||
| for (const auto& data : wmiResults) { | ||
| Row r; | ||
| long status = 0; | ||
| long emethod; | ||
| data.GetString("DeviceID", r["device_id"]); | ||
| data.GetString("DriveLetter", r["drive_letter"]); | ||
| data.GetString("PersistentVolumeID", r["persistent_volume_id"]); | ||
| data.GetLong("ConversionStatus", status); | ||
| r["conversion_status"] = INTEGER(status); | ||
| data.GetLong("ProtectionStatus", status); | ||
| r["protection_status"] = INTEGER(status); | ||
| data.GetLong("EncryptionMethod", emethod); | ||
| if (!data.GetString("DeviceID", r["device_id"]).ok()) { | ||
| r["device_id"] = ""; | ||
| } | ||
| if (!data.GetString("DriveLetter", r["drive_letter"]).ok()) { | ||
| r["drive_letter"] = ""; | ||
| } | ||
| if (!data.GetString("PersistentVolumeID", r["persistent_volume_id"]) | ||
| .ok()) { | ||
| r["persistent_volume_id"] = ""; | ||
| } | ||
| if (data.GetLong("ConversionStatus", status).ok()) { | ||
| r["conversion_status"] = INTEGER(status); | ||
| } else { | ||
| r["conversion_status"] = INTEGER(-1); | ||
| } | ||
| if (data.GetLong("ProtectionStatus", status).ok()) { | ||
| r["protection_status"] = INTEGER(status); | ||
| } else { | ||
| r["protection_status"] = INTEGER(-1); | ||
| } | ||
| if (!data.GetLong("EncryptionMethod", emethod).ok()) { | ||
| emethod = -1; | ||
| } | ||
| std::string emethod_str; | ||
| std::map<long, std::string> methods; | ||
|
|
||
|
|
@@ -100,3 +115,4 @@ QueryData genBitlockerInfo(QueryContext& context) { | |
| } | ||
| } // namespace tables | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ namespace osquery { | |
| namespace tables { | ||
|
|
||
| QueryData genDiskInfo(QueryContext& context) { | ||
| Row r; | ||
|
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. 𦩠π disk_info.cpp reuses a single Row across all WMI results without clearing it In genDiskInfo (osquery/tables/system/windows/disk_info.cpp), moved π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| QueryData results; | ||
|
|
||
| const Expected<WmiRequest, WmiError> wmiSystemReq = | ||
|
|
@@ -30,6 +29,7 @@ QueryData genDiskInfo(QueryContext& context) { | |
| } | ||
| const std::vector<WmiResultItem>& wmiResults = wmiSystemReq->results(); | ||
| for (const auto& data : wmiResults) { | ||
| Row r; | ||
| long partitionCount = 0; | ||
| long index = 0; | ||
| data.GetLong("Partitions", partitionCount); | ||
|
|
@@ -52,3 +52,4 @@ QueryData genDiskInfo(QueryContext& context) { | |
| } | ||
| } // namespace tables | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,8 +65,6 @@ QueryData genGroups(QueryContext& context) { | |
| } | ||
|
|
||
| } else if (!selected_gids.empty()) { | ||
| auto selected_gids = gid_it->second.getAll(EQUALS); | ||
|
|
||
|
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. 𦩠π groups.cpp genGroups() shadows outer selected_gids variable inside the gid branch Removed the redundant, shadowing local declaration π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| for (const auto& selected_gid_str : selected_gids) { | ||
| auto selected_gid_res = tryTo<std::uint32_t>(selected_gid_str); | ||
|
|
||
|
|
@@ -94,3 +92,4 @@ QueryData genGroups(QueryContext& context) { | |
| } | ||
| } // namespace tables | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ namespace { | |
| // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-share | ||
| const std::string kWin32ShareQuery{"SELECT * FROM Win32_Share"}; | ||
|
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. 𦩠π genShares: signed/unsigned mismatch when checking WMI 'Type' bit flag against admin-share sentinel values In the anonymous namespace of π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
||
| const std::unordered_map<long, std::string> kShareTypeNameMap = { | ||
| const std::unordered_map<std::uint32_t, std::string> kShareTypeNameMap = { | ||
| {0, "Disk Drive"}, | ||
| {1, "Print Queue"}, | ||
| {2, "Device"}, | ||
|
|
@@ -33,7 +33,7 @@ const std::unordered_map<long, std::string> kShareTypeNameMap = { | |
| {2147483650, "Device Admin"}, | ||
| {2147483651, "IPC Admin"}}; | ||
|
|
||
| const std::string& getShareTypeName(const long& share_type) { | ||
| const std::string& getShareTypeName(const std::uint32_t& share_type) { | ||
| static const std::string kInvalidShareTypeName; | ||
|
|
||
| auto it = kShareTypeNameMap.find(share_type); | ||
|
|
@@ -96,8 +96,9 @@ QueryData genShares(QueryContext& context) { | |
|
|
||
| long type{}; | ||
| status = wmi_item.GetLong("Type", type); | ||
| row["type"] = BIGINT(status.ok() ? static_cast<std::uint32_t>(type) : 0); | ||
| row["type_name"] = SQL_TEXT(getShareTypeName(type)); | ||
| auto unsigned_type = status.ok() ? static_cast<std::uint32_t>(type) : 0; | ||
| row["type"] = BIGINT(unsigned_type); | ||
| row["type_name"] = SQL_TEXT(getShareTypeName(unsigned_type)); | ||
|
|
||
| row_list.push_back(std::move(row)); | ||
| row.clear(); | ||
|
|
@@ -107,3 +108,4 @@ QueryData genShares(QueryContext& context) { | |
| } | ||
|
|
||
| } // namespace osquery::tables | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,10 +24,10 @@ constexpr auto kFullRegPath = | |
| "\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist"; | ||
|
|
||
| // Get execution count | ||
|
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. 𦩠π userassist executionNum() returns -1 cast to std::size_t (huge unsigned value) on error paths, propagated into INTEGER() column Changed executionNum()'s return type from π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
| std::size_t executionNum(const std::string& assist_data) { | ||
| long long executionNum(const std::string& assist_data) { | ||
| if (assist_data.length() <= 16) { | ||
| LOG(WARNING) << "Userassist execution count format is incorrect"; | ||
| return -1; | ||
| return -1LL; | ||
| } | ||
|
|
||
| std::string execution_count = assist_data.substr(8, 8); | ||
|
|
@@ -43,9 +43,9 @@ std::size_t executionNum(const std::string& assist_data) { | |
| auto count = tryTo<std::size_t>(execution_count, 16); | ||
| if (count.isError()) { | ||
| LOG(WARNING) << "Error getting execution count: " << count.takeError(); | ||
| return -1; | ||
| return -1LL; | ||
| } | ||
| return count.get(); | ||
| return static_cast<long long>(count.get()); | ||
| } | ||
|
|
||
| QueryData genUserAssist(QueryContext& context) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ | |
| #include <osquery/utils/info/version.h> | ||
| #include <osquery/utils/conversions/split.h> | ||
|
|
||
|
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. 𦩠π΅ Duplicate #include in version.cpp Removed the duplicate π€ Prompt for AI agentsfix confidence: π’ 100 high β react π/π to teach the reviewer |
||
| #include <stdexcept> | ||
| #include <stdexcept> | ||
|
|
||
| namespace osquery { | ||
|
|
@@ -49,3 +48,4 @@ bool versionAtLeast(const std::string& v, const std::string& sdk) { | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,8 +114,6 @@ boost::optional<Pidfile::Error> Pidfile::writeFile( | |
| auto buffer_size = static_cast<ssize_t>(buffer.size()); | ||
| auto remaining_bytes = buffer_size; | ||
|
|
||
| buffer_size = remaining_bytes = {static_cast<ssize_t>(buffer.size())}; | ||
|
|
||
| for (int retry = 0; retry < 5 && remaining_bytes > 0; ++retry) { | ||
| auto buffer_ptr = buffer.data() + buffer_size - remaining_bytes; | ||
|
|
||
|
Comment on lines
114
to
119
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. 𦩠π pidfile_posix.cpp writeFile has redundant/confusing double-initialization of buffer_size and remaining_bytes Removed the redundant reassignment line π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -187,3 +185,4 @@ void Pidfile::destroyFile(FileHandle file_handle, | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,6 +161,10 @@ Expected<std::string, Pidfile::Error> Pidfile::readFile( | |
| remaining_bytes -= static_cast<std::size_t>(bytes_read); | ||
| } | ||
|
|
||
| if (remaining_bytes != 0) { | ||
| return createError(Pidfile::Error::IOError); | ||
| } | ||
|
|
||
| return buffer; | ||
| } | ||
|
|
||
|
Comment on lines
161
to
170
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. 𦩠π pidfile_windows.cpp readFile ignores retry counter's remaining_bytes check and can return truncated buffer without error In Pidfile::readFile (Windows), added a check after the retry loop: (Automatically downgraded: no change in this fix lands near this finding's line β verify whether it was actually addressed.) π€ Prompt for AI agentsfix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -173,3 +177,4 @@ void Pidfile::destroyFile(FileHandle file_handle, const std::string&) noexcept { | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ | |
| namespace osquery { | ||
|
|
||
| long getUptime() { | ||
| #if defined(DARWIN) | ||
| #if defined(__APPLE__) | ||
| struct timeval boot_time; | ||
| size_t len = sizeof(boot_time); | ||
| int mib[2] = {CTL_KERN, KERN_BOOTTIME}; | ||
|
Comment on lines
22
to
28
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. 𦩠π getUptime() on Apple platforms is gated on DARWIN but the file's #if/#elif chain checks APPLE In getUptime() in osquery/utils/system/uptime.cpp, changed the preprocessor guard π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
@@ -51,3 +51,4 @@ long getUptime() { | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,9 @@ class WorkerIPCChannelsTest : public testing::Test { | |
| std::string descriptors_path = "/dev/fd"; | ||
| boost::filesystem::directory_iterator it(descriptors_path), end; | ||
| return std::distance(it, end) - 1; | ||
| #else | ||
| // Unsupported platform for this test helper | ||
| return -1; | ||
| #endif | ||
| } | ||
|
|
||
|
Comment on lines
43
to
51
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. 𦩠π getFdsOpen() has no return on the non-Linux/non-Darwin branch Added an π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
@@ -169,3 +172,4 @@ TEST_F(WorkerIPCChannelsTest, test_pipe_ticket_leak) { | |
| ASSERT_EQ(getFdsOpen(), fds_open + 4); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -425,8 +425,12 @@ Status RocksDBDatabasePlugin::removeRange(const std::string& domain, | |
| } else { | ||
| options.sync = false; | ||
| } | ||
| // DeleteRange is exclusive of the high bound; explicitly delete the | ||
| // high key too so the overall range removed is inclusive of `high`, | ||
| // matching this method's documented/expected semantics. Preserve the | ||
| // first failing status instead of overwriting it. | ||
| auto s = getDB()->DeleteRange(options, cfh, low, high); | ||
| if (low <= high) { | ||
| if (s.ok()) { | ||
| s = getDB()->Delete(options, cfh, high); | ||
| } | ||
| return Status(s.code(), s.ToString()); | ||
|
Comment on lines
425
to
436
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. 𦩠π removeRange performs a redundant/contradictory extra delete of the high bound In (Automatically downgraded: no change in this fix lands near this finding's line β verify whether it was actually addressed.) π€ Prompt for AI agentsfix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -466,3 +470,4 @@ Status RocksDBDatabasePlugin::scan(const std::string& domain, | |
| return Status::success(); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,6 @@ namespace osquery { | |
|
|
||
| DECLARE_string(enroll_secret_path); | ||
| DECLARE_bool(disable_enrollment); | ||
| DECLARE_bool(openframe_mode); | ||
|
|
||
| CLI_FLAG(uint64, | ||
| tls_enroll_max_attempts, | ||
|
|
@@ -51,6 +50,14 @@ CLI_FLAG(string, | |
| "", | ||
| "TLS/HTTPS endpoint for client enrollment"); | ||
|
|
||
| /// Optional path prefix inserted before the enroll endpoint (e.g. for | ||
| /// gateway/backend specific routing). Empty by default, meaning no prefix | ||
| /// is added. | ||
| CLI_FLAG(string, | ||
| enroll_tls_endpoint_prefix, | ||
| "", | ||
| "Optional URL path prefix prepended to the enroll TLS endpoint"); | ||
|
|
||
| /// Undocumented feature for TLS access token passing. | ||
| HIDDEN_FLAG(bool, | ||
| tls_secret_always, | ||
|
|
@@ -73,12 +80,13 @@ std::string TLSEnrollPlugin::enroll() { | |
|
|
||
| // If no node secret has been negotiated, try a TLS request. | ||
| auto uri = "https://" + FLAGS_tls_hostname; | ||
|
|
||
| // Add the prefix "/tools/agent/fleetmdm-server" to all requests only if openframe mode is enabled | ||
| if (FLAGS_openframe_mode) { | ||
|
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. 𦩠π TLS enroll hardcodes OpenFrame-specific URL path segment inline in shared plugin logic In π€ Prompt for AI agentsfix confidence: π΄ 55 low β review closely β react π/π to teach the reviewer |
||
| uri += "/tools/agent/fleetmdm-server"; | ||
|
|
||
| // Add an optional path prefix to all requests, configurable via flag | ||
| // rather than hardcoded in this shared plugin logic. | ||
| if (!FLAGS_enroll_tls_endpoint_prefix.empty()) { | ||
| uri += FLAGS_enroll_tls_endpoint_prefix; | ||
| } | ||
|
|
||
| uri += FLAGS_enroll_tls_endpoint; | ||
|
|
||
| if (FLAGS_tls_secret_always) { | ||
|
|
@@ -174,3 +182,4 @@ Status TLSEnrollPlugin::requestKey(const std::string& uri, | |
| return Status::success(); | ||
| } | ||
| } // 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.
𦩠π platformGlob leaks glob_t buffer and its internal allocations if glob() throws no exception but function returns early on failure paths
In platformGlob() (osquery/filesystem/posix/fileops.cpp), captured the return code of ::glob() into
rcand added anif (rc != 0) { return results; }guard before readingdata->gl_pathc/data->gl_pathv, preventing consumption of uninitialized/stale glob_t contents on failure (e.g. GLOB_NOMATCH, GLOB_ABORTED). This matches the suggested fix exactly; note::globfree(data)is still only called on the success path, consistent with glob(3) semantics where globfree should not be called on a glob_t that glob() did not successfully populate.(Automatically downgraded: no change in this fix lands near this finding's line β verify whether it was actually addressed.)
π€ Prompt for AI agents
fix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer