-
Notifications
You must be signed in to change notification settings - Fork 0
fix(adhoc-sweep-fixes): 58 review findings across 40 files #39
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
f6b4862
cc1be12
d194e54
af9ee8f
70fb4e0
f18d91b
b55833d
c3524c2
9db52a0
4c76386
d9c7a0f
73afb9f
5d2d281
103ad07
dd1d63c
b6935b8
8b60319
1783b0c
c3c1bd3
9e15dd6
6515ffc
e46d689
3c62da2
20d960b
920b133
d3feee6
8da9019
7808ddf
a687fa7
f2bba78
6e4950b
34255b1
6b0ca8b
3022797
810fc41
c551568
de74453
4413fda
8f5e1b4
66bf5af
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 |
|---|---|---|
|
|
@@ -126,7 +126,7 @@ std::string getCDHash(const es_process_t* p) { | |
| << static_cast<unsigned int>(i); | ||
| } | ||
| auto s = hash.str(); | ||
| return s.find_first_not_of(s.front()) == std::string::npos ? "" : s; | ||
| return s.find_first_not_of('0') == std::string::npos ? "" : s; | ||
| } | ||
|
|
||
| void getProcessProperties(const es_process_t* p, | ||
|
Comment on lines
126
to
132
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. 𦩠π getCDHash() uses find_first_not_of(s.front()) which is a character-search bug, not an all-zero-check In getCDHash() (osquery/events/darwin/es_utils.cpp), changed π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
|
|
@@ -146,7 +146,7 @@ void getProcessProperties(const es_process_t* p, | |
| ec->cwd = getCwdPathFromPid(ec->pid); | ||
|
|
||
| ec->uid = audit_token_to_ruid(audit_token); | ||
| ec->euid = audit_token_to_egid(audit_token); | ||
| ec->euid = audit_token_to_euid(audit_token); | ||
| ec->gid = audit_token_to_rgid(audit_token); | ||
| ec->egid = audit_token_to_egid(audit_token); | ||
|
|
||
|
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. 𦩠π getProcessProperties() copies egid into euid field, duplicating egid lookup and never reading ruid for euid In getProcessProperties() (osquery/events/darwin/es_utils.cpp), changed π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -171,3 +171,4 @@ void appendQuotedString(std::ostream& out, std::string s, char delim) { | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,7 @@ REGISTER(FSEventsEventPublisher, "event_publisher", "fsevents"); | |
| void FSEventsSubscriptionContext::requireAction(const std::string& action) { | ||
| for (const auto& bit : kMaskActions) { | ||
| if (action == bit.second) { | ||
| mask = mask & bit.first; | ||
| mask = mask | bit.first; | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
55
to
61
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. 𦩠π΄ requireAction uses bitwise-AND assignment instead of OR, silently discarding previously-set mask bits In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -380,3 +380,4 @@ bool FSEventsEventPublisher::isStreamRunning() const { | |
| return CFRunLoopIsWaiting(run_loop_); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ void SCNetworkEventPublisher::Callback(const SCNetworkReachabilityRef target, | |
| auto ec = createEventContext(); | ||
| ec->subscription = *(SCNetworkSubscriptionContextRef*)info; | ||
| ec->flags = flags; | ||
| EventFactory::fire<SCNetworkEventPublisher>(ec); | ||
| } | ||
|
|
||
| bool SCNetworkEventPublisher::shouldFire( | ||
|
Comment on lines
34
to
40
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. 𦩠π΄ SCNetworkEventPublisher::Callback never fires the event to subscribers In π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
|
|
@@ -116,14 +117,14 @@ void SCNetworkEventPublisher::configure() { | |
| if (sc->type == ADDRESS_TARGET) { | ||
| auto existing_address = std::find( | ||
| target_addresses_.begin(), target_addresses_.end(), sc->target); | ||
| if (existing_address != target_addresses_.end()) { | ||
| if (existing_address == target_addresses_.end()) { | ||
| // Add the address target. | ||
| addAddress(sc); | ||
| } | ||
| } else { | ||
| auto existing_hostname = | ||
| std::find(target_names_.begin(), target_names_.end(), sc->target); | ||
| if (existing_hostname != target_names_.end()) { | ||
| if (existing_hostname == target_names_.end()) { | ||
| // Add the hostname target. | ||
| addHostname(sc); | ||
| } | ||
|
Comment on lines
117
to
130
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. 𦩠π΄ Inverted existence check causes SCNetwork subscription targets to never be re-added during configure() In π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -183,3 +184,4 @@ Status SCNetworkEventPublisher::run() { | |
| return Status::success(); | ||
| } | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,16 +125,16 @@ bool Filesystem::enumFiles(int dirfd, EnumFilesCallback callback) const { | |
| continue; | ||
| } | ||
|
|
||
| bool directory; | ||
| bool is_directory; | ||
| if (entry->d_type == DT_DIR) { | ||
| directory = true; | ||
| is_directory = true; | ||
| } else if (entry->d_type == DT_LNK || entry->d_type == DT_REG) { | ||
| directory = false; | ||
| is_directory = false; | ||
| } else { | ||
| continue; | ||
| } | ||
|
|
||
| callback(string_fd, directory); | ||
| callback(string_fd, is_directory); | ||
| } | ||
|
|
||
| return true; | ||
|
Comment on lines
125
to
140
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. 𦩠π Filesystem::enumFiles shadows outer-scope Renamed the inner π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -171,3 +171,4 @@ Status IFilesystem::create(Ref& obj) { | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -375,7 +375,7 @@ class FakeEventSubscriber : public EventSubscriber<FakeEventPublisher> { | |
|
|
||
| explicit FakeEventSubscriber(bool skip_name) { | ||
| if (!skip_name) { | ||
| FakeEventSubscriber(); | ||
| setName("fake_events"); | ||
| } | ||
| } | ||
|
|
||
|
Comment on lines
375
to
381
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. 𦩠π΄ FakeEventSubscriber(bool skip_name) constructor calls FakeEventSubscriber() as a temporary, not delegating construction 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 |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,8 +168,8 @@ bool validateSocketDescriptor(const ProcessContext& process_context, | |
| const auto& socket_info = | ||
| std::get<ProcessContext::FileDescriptor::SocketData>(fd_info.data); | ||
|
|
||
|
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. 𦩠π΄ Inverted boolean logic makes validateSocketDescriptor always fail when domain is set In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| if (!socket_info.opt_domain.has_value() || socket_info.opt_type.has_value() || | ||
| socket_info.opt_protocol.has_value()) { | ||
| if (!socket_info.opt_domain.has_value() || !socket_info.opt_type.has_value() || | ||
| !socket_info.opt_protocol.has_value()) { | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -232,3 +232,4 @@ bool validateSocketDescriptor(const ProcessContextMap& process_context_map, | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,8 @@ Status EtwProviderConfig::isValid() const { | |
| return Status::failure("Type handlers were not provided"); | ||
| } | ||
|
|
||
| if (getPostProcessor() == nullptr) { | ||
| return Status::failure("Invalid Provider PostProcessor function"); | ||
| if (getPreProcessor() == nullptr) { | ||
| return Status::failure("Invalid Provider PreProcessor function"); | ||
| } | ||
|
|
||
| return Status::success(); | ||
|
Comment on lines
26
to
33
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. 𦩠π΄ EtwProviderConfig::isValid() checks getPostProcessor() twice instead of also validating getPreProcessor() In EtwProviderConfig::isValid(), the second duplicate π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -166,4 +166,4 @@ void EtwProviderConfig::addEventTypeToHandle(const EtwEventType& value) { | |
| eventTypes_.push_back(value); | ||
| } | ||
|
|
||
| } // namespace osquery | ||
| } // namespace osquery | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -352,8 +352,13 @@ void EtwPublisherProcesses::providerPostProcessor( | |
| // Houskeeping of expired aggregation cache entries | ||
| cleanOldAggregationCacheEntries(); | ||
|
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. 𦩠π cleanOldAggregationCacheEntries erases the current iterator then increments it, causing use-after-erase In cleanOldAggregationCacheEntries(), replaced the unconditional π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
| // Houskeeping of the process image cache to avoid unbounded growth | ||
| cleanOldProcessImageCacheEntries(); | ||
|
|
||
| // Caching image full path | ||
| processImageCache_.insert({searchKey, procStartData->ImageName}); | ||
| processImageCache_.insert( | ||
| {searchKey, | ||
| {procStartData->ImageName, std::time(nullptr)}}); | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
352
to
364
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. 𦩠π processImageCache_ in EtwPublisherProcesses grows unbounded with no eviction Added a time-based eviction policy for processImageCache_: the map value type is assumed to now be a π€ Prompt for AI agentsfix confidence: π΄ 45 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -385,10 +390,31 @@ void EtwPublisherProcesses::cleanOldAggregationCacheEntries() { | |
| if ((eventTimestamp.QuadPart + expiredTime10secs) < | ||
| currentTimestamp.QuadPart) { | ||
| // event expire and should be deleted | ||
| processStartAggregationCache_.erase(it); | ||
| it = processStartAggregationCache_.erase(it); | ||
| } else { | ||
| ++it; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ++it; | ||
| void EtwPublisherProcesses::cleanOldProcessImageCacheEntries() { | ||
| // Entries older than this many seconds are considered stale and removed | ||
| // to avoid unbounded growth of processImageCache_. | ||
| static constexpr std::time_t expiredTimeSecs = 300; | ||
|
|
||
| if (processImageCache_.empty()) { | ||
| return; | ||
| } | ||
|
|
||
| std::time_t currentTime = std::time(nullptr); | ||
|
|
||
| auto it = processImageCache_.begin(); | ||
| while (it != processImageCache_.end()) { | ||
| if ((it->second.second + expiredTimeSecs) < currentTime) { | ||
| it = processImageCache_.erase(it); | ||
| } else { | ||
| ++it; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -399,7 +425,11 @@ void EtwPublisherProcesses::updateImagePath(const std::uint64_t& key1, | |
| std::uint64_t searchKey = getComposedKey(key1, key2); | ||
|
|
||
| // Event specific post processing callback logic | ||
| imagePath = tryTake(processImageCache_, searchKey).takeOr(imagePath); | ||
| auto cachedEntryIt = processImageCache_.find(searchKey); | ||
| if (cachedEntryIt != processImageCache_.end()) { | ||
| imagePath = cachedEntryIt->second.first; | ||
| processImageCache_.erase(cachedEntryIt); | ||
| } | ||
| } | ||
|
|
||
| void EtwPublisherProcesses::updateTokenInfo(const std::uint32_t& tokenType, | ||
|
|
@@ -479,3 +509,4 @@ std::uint64_t EtwPublisherProcesses::getComposedKey(const std::uint64_t& key1, | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,8 +147,6 @@ Status WindowsEventLogPublisher::run() { | |
| auto last_fired_event_time = std::chrono::steady_clock::now(); | ||
|
|
||
| while (!isEnding()) { | ||
| EvtSubscription::EventList event_list; | ||
|
|
||
| for (auto& subscription : d_->subscription_list) { | ||
| auto event_list = subscription->getEvents(); | ||
|
|
||
|
Comment on lines
147
to
152
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. 𦩠π Shadowed variable name Removed the dead/unused outer π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -208,6 +206,10 @@ double WindowsEventLogPublisher::cosineSimilarity( | |
| std::vector<double> buffer_freqs(kCharFreqVectorLen, 0.0); | ||
|
|
||
| auto buffer_size = buffer.size(); | ||
| if (buffer_size == 0) { | ||
| return 0.0; | ||
| } | ||
|
|
||
| for (unsigned char chr : buffer) { | ||
| if (chr < kCharFreqVectorLen) { | ||
| buffer_freqs[chr] += 1.0 / buffer_size; | ||
|
Comment on lines
206
to
215
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. 𦩠π Potential division by zero in cosineSimilarity when buffer_size is 0 Added a guard π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -249,3 +251,4 @@ bool WindowsEventLogPublisher::shouldFire(const SCRef& subscription, | |
| return (subscription->channel_list.count(lowercase_channel) > 0U); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,8 @@ Status compress(const boost::filesystem::path& in, | |
|
|
||
| size_t const buffInSize = ZSTD_CStreamInSize(); | ||
| size_t const buffOutSize = ZSTD_CStreamOutSize(); | ||
| std::vector<void*> buffIn(buffInSize); | ||
| std::vector<void*> buffOut(buffOutSize); | ||
| std::vector<char> buffIn(buffInSize); | ||
| std::vector<char> buffOut(buffOutSize); | ||
| auto read = buffInSize; | ||
| auto toRead = buffInSize; | ||
| size_t readSoFar = 0; | ||
|
Comment on lines
48
to
55
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. 𦩠π΄ compress()/decompress() use std::vector<void> as raw byte buffers, wasting 8x memory and risking undefined behavior with read()/write()* In compress(), changed (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
Comment on lines
48
to
55
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. 𦩠π΄ decompress() repeats the same std::vector<void> buffer sizing bug as compress()* In decompress(), changed (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 |
||
|
|
@@ -114,8 +114,8 @@ Status decompress(const boost::filesystem::path& in, | |
| auto inFileSize = inFile.size(); | ||
| size_t const buffInSize = ZSTD_DStreamInSize(); | ||
| size_t const buffOutSize = ZSTD_DStreamOutSize(); | ||
| std::vector<void*> buffIn(buffInSize); | ||
| std::vector<void*> buffOut(buffOutSize); | ||
| std::vector<char> buffIn(buffInSize); | ||
| std::vector<char> buffOut(buffOutSize); | ||
|
|
||
| ZSTD_DStream* const dstream = ZSTD_createDStream(); | ||
| if (dstream == NULL) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ CodeProfiler::~CodeProfiler() { | |
| code_profiler_data_end.getWallTime() - | ||
| code_profiler_data_->getWallTime()); | ||
|
|
||
| record(names_, ".time.wall.millis", query_duration.count()); | ||
| record(names_, "time.wall.millis", query_duration.count()); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
|
Comment on lines
51
to
+57
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. 𦩠π Windows CodeProfiler passes metric name with a leading dot, producing a malformed metric key In CodeProfiler::~CodeProfiler() (destructor), changed the metricName argument passed to record() from ".time.wall.millis" to "time.wall.millis", removing the leading dot so the concatenated key "." + metricName produces a single-dot separator ".time.wall.millis", matching the POSIX implementation's naming convention. π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,13 +56,15 @@ static void executeCarve(sqlite3_context* ctx) { | |
| if (!FLAGS_carver_disable_function) { | ||
| std::string new_carve_guid; | ||
| carvePaths(kFunctionCarvePaths, createCarveGuid(), new_carve_guid); | ||
| std::string message = std::string("Carve Started: " + new_carve_guid); | ||
| sqlite3_result_text(ctx, | ||
| std::string("Carve Started: " + new_carve_guid).c_str(), | ||
| 13, | ||
| message.c_str(), | ||
| static_cast<int>(message.size()), | ||
| SQLITE_TRANSIENT); | ||
| } else { | ||
| std::string message = "Carve Failed: function disabled"; | ||
| sqlite3_result_text( | ||
| ctx, "Carve Failed: function disabled", 13, SQLITE_TRANSIENT); | ||
| ctx, message.c_str(), static_cast<int>(message.size()), SQLITE_TRANSIENT); | ||
| } | ||
| kFunctionCarvePaths.clear(); | ||
| } | ||
|
Comment on lines
56
to
70
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. 𦩠π executeCarve() truncates carve-status message to a hardcoded length of 13, corrupting output In executeCarve() (osquery/sql/sqlite_operations.cpp), replaced the hardcoded length argument π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -97,3 +99,4 @@ void registerOperationExtensions(sqlite3* db) { | |
| db, "sleep", 1, SQLITE_UTF8, nullptr, sqlSleep, nullptr, nullptr); | ||
| } | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,7 @@ std::vector<User> UsersCache::getAllUsers() const { | |
| } | ||
|
|
||
| void GroupsCache::initializeCache(std::vector<Group> initial_groups) { | ||
| std::lock_guard<std::mutex> lock(cache_mutex_); | ||
| cached_groups_ = std::move(initial_groups); | ||
|
|
||
| if (cached_groups_.size() > 0) { | ||
|
Comment on lines
111
to
117
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. 𦩠π GroupsCache::initializeCache does not hold cache_mutex_ while other methods do Added π€ Prompt for AI agentsfix confidence: π’ 97 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,7 @@ const std::unordered_map<ChromeBrowserType, std::string> | |
| {ChromeBrowserType::Yandex, "yandex"}, | ||
| {ChromeBrowserType::Opera, "opera"}, | ||
| {ChromeBrowserType::Edge, "edge"}, | ||
| {ChromeBrowserType::Edge, "edge_beta"}, | ||
| {ChromeBrowserType::EdgeBeta, "edge_beta"}, | ||
| {ChromeBrowserType::Vivaldi, "vivaldi"}, | ||
| {ChromeBrowserType::Arc, "arc"}, | ||
| }; | ||
|
Comment on lines
104
to
110
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 map entry silently makes ChromeBrowserType::Edge alias to 'edge_beta' unreachable In the π€ Prompt for AI agentsfix confidence: π’ 98 high β react π/π to teach the reviewer |
||
|
|
@@ -1264,3 +1264,4 @@ ExpectedExtensionKey computeExtensionIdentifier( | |
| } // namespace tables | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,7 +151,7 @@ Status OpenBSMProcEvSubscriber::handleExec(const OpenBSMEventContextRef& ec) { | |
| r["egid"] = INTEGER(tok.tt.subj64.egid); | ||
| r["uid"] = INTEGER(tok.tt.subj64.ruid); | ||
| r["gid"] = INTEGER(tok.tt.subj64.rgid); | ||
| pid = tok.tt.subj32.pid; | ||
| pid = tok.tt.subj64.pid; | ||
| break; | ||
| case AUT_SUBJECT32_EX: | ||
| OpenBSM_AUT_SUBJECT32_EX(r, tok); | ||
|
Comment on lines
151
to
157
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. 𦩠π AUT_SUBJECT64 case copies pid from the 32-bit subject union member (copy-paste bug) In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,7 +105,7 @@ Status OpenBSMNetEvSubscriber::Callback( | |
| r["action"] = "connect"; | ||
| } else if (tok.tt.hdr32_ex.e_type == AUE_BIND) { | ||
| r["action"] = "bind"; | ||
| } else if (tok.tt.hdr32.e_type == AUE_ACCEPT) { | ||
| } else if (tok.tt.hdr32_ex.e_type == AUE_ACCEPT) { | ||
| r["action"] = "accept"; | ||
|
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. 𦩠π Typo bug in AUT_HEADER32_EX branch: AUE_ACCEPT check reads from wrong header token (hdr32 instead of hdr32_ex) In π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| } else { | ||
| continue; | ||
|
|
@@ -118,7 +118,7 @@ Status OpenBSMNetEvSubscriber::Callback( | |
| r["action"] = "connect"; | ||
| } else if (tok.tt.hdr64_ex.e_type == AUE_BIND) { | ||
| r["action"] = "bind"; | ||
|
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. 𦩠π Same header-union typo repeated in AUT_HEADER64/HEADER64_EX branch In π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| } else if (tok.tt.hdr64.e_type == AUE_ACCEPT) { | ||
| } else if (tok.tt.hdr64_ex.e_type == AUE_ACCEPT) { | ||
| r["action"] = "accept"; | ||
| } else { | ||
| continue; | ||
|
|
@@ -146,7 +146,7 @@ Status OpenBSMNetEvSubscriber::Callback( | |
| case AUT_SUBJECT64: | ||
| r["auid"] = INTEGER(tok.tt.subj64.auid); | ||
| r["pid"] = INTEGER(tok.tt.subj64.pid); | ||
| pid = tok.tt.subj32.pid; | ||
| pid = tok.tt.subj64.pid; | ||
| break; | ||
| case AUT_SUBJECT32_EX: | ||
| r["auid"] = INTEGER(tok.tt.subj32_ex.auid); | ||
|
Comment on lines
146
to
152
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. 𦩠π΄ Wrong subject token copied into pid for AUT_SUBJECT64 in socket_events.cpp In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -234,3 +234,4 @@ Status OpenBSMNetEvSubscriber::Callback( | |
| } | ||
|
|
||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -302,7 +302,7 @@ Status getTLSCertificate(const std::string& hostname, | |
| std::string port = "443"; | ||
| auto connect_hostname = hostname; | ||
| auto delim = hostname.find(":"); | ||
| if (delim + 1 == hostname.length()) { | ||
| if (delim != std::string::npos && delim + 1 == hostname.length()) { | ||
| // if no port specified use default port | ||
| connect_hostname = hostname.substr(0, delim); | ||
| } else if (delim != std::string::npos) { | ||
|
Comment on lines
302
to
308
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. 𦩠π΄ Off-by-one/logic bug: hostname port-delimiter check uses unsigned wraparound when ':' is not found In π€ Prompt for AI agentsfix confidence: π’ 98 high β react π/π to teach the reviewer |
||
|
|
@@ -459,3 +459,4 @@ QueryData genTLSCertificate(QueryContext& context) { | |
| } | ||
| } // namespace tables | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,7 +119,7 @@ Status genArp(const struct rt_msghdr *route, | |
| // The cache will always know the address. | ||
| r["address"] = ipAsString(addr_map[RTAX_DST]); | ||
|
|
||
| auto sdl = (struct sockaddr_dl *)addr_map[RTA_DST]; | ||
| auto sdl = (struct sockaddr_dl *)addr_map[RTAX_DST]; | ||
| if (sdl->sdl_alen > 0) { | ||
| r["mac"] = macAsString(LLADDR(sdl)); | ||
| } else { | ||
|
Comment on lines
119
to
125
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. 𦩠π genArp indexes addr_map with RTA_DST (a bitmask flag) instead of RTAX_DST (an array index) In genArp (osquery/tables/networking/darwin/routes.cpp), changed π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -220,3 +220,4 @@ QueryData genRoutes(QueryContext &context) { | |
| } | ||
| } | ||
| } | ||
|
|
||
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.
𦩠π Missing space in concatenated error message produces "NevaluetsFailed to log 3events"-style output
In
LoggerPlugin::logStringBatch(osquery/core/plugins/logger.h), changed the string literal"events"to" events"in theStatus::failureconcatenation so the resulting message reads "logEventBatch has failed to log N events" with proper spacing.π€ Prompt for AI agents
fix confidence: π’ 95 high β react π/π to teach the reviewer