Repository navigation
Fix sensor_download sample crashing on platforms other than windows, mac and linux - #1523
Merged
jshcodes merged 1 commit intoNov 13, 2026
Conversation
arxhr007
requested review from
alhumaw,
crowdstrikedcs and
jshcodes
as code owners
October 30, 2026 06:29
…mac and linux get_version_map started from a fixed dictionary of windows, mac and linux and indexed it with the platform of each sensor. A sensor with any other platform, such as VMware, raised a KeyError when downloading. Add the platform to the dictionary when it is first seen. Fixes #1361
jshcodes
force-pushed
the
fix/1361-sensor-download-platforms
branch
from
November 13, 2026 18:08
4a4d605 to
1122648
Compare
jshcodes
approved these changes
Nov 13, 2026
jshcodes
left a comment
Member
There was a problem hiding this comment.
Merging to samples for additional testing and confirmation.
Thank you for your contribution! 🙇
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the
sensor_downloadsample crashing on sensors whose platform is notwindows,macorlinux.Unit test coverage
Bandit analysis
Test results: No issues identified. Code scanned: Total lines of code: 273 Total lines skipped (#nosec): 0 Run metrics: Total issues (by severity): Undefined: 0 Low: 0 Medium: 0 High: 0Added features and functionality
KeyErrorwhen the sensor list contains a platform it did not know about, such as VMware.Issues resolved
windows,macandlinux.Other
get_version_map:version_map.get(plat, {})becameversion_map.setdefault(plat, {}). The three existing platforms are handled exactly as before.get_version_mapstarts from{"windows": {}, "mac": {}, "linux": {}}, so a sensor with any other platform reachedversion_map[plat][...] = ...and raisedKeyError. Thedownloadcommand indexes the returned map by the same platform, so it needs the entry too.get_version_mapfrom the file before and after the change with a made-up sensor list that has Windows, Debian and VMware entries (thevmwareplatform name is my assumption). Before:KeyError: 'vmware'. After:vmwareis returned withcurrent,previousandoldestentries, andwindowsandlinuxare unchanged.--disable=R0801) reports the same messages as before the change, and bandit reports no issues. flake8 only reports lines that were already there.