Skip to content

Fix sensor_download sample crashing on platforms other than windows, mac and linux - #1523

Merged
jshcodes merged 1 commit into
CrowdStrike:samplesfrom
arxhr007:fix/1361-sensor-download-platforms
Nov 13, 2026
Merged

jshcodes merged 1 commit into
CrowdStrike:samplesfrom
arxhr007:fix/1361-sensor-download-platforms

Conversation

@arxhr007

Copy link
Copy Markdown

Fix the sensor_download sample crashing on sensors whose platform is not windows, mac or linux.

  • Bug fixes
  • Code sample

Unit test coverage

Not applicable. Samples are not covered by the unit test suite (the pylint workflow only lints them),
and the change touches no file under src/. I checked the function directly instead, see "Other" below.

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: 0

Added features and functionality

  • None. The sample no longer raises a KeyError when the sensor list contains a platform it did not know about, such as VMware.

Issues resolved

Other

  • Not a breaking change. The change is one line in get_version_map: version_map.get(plat, {}) became version_map.setdefault(plat, {}). The three existing platforms are handled exactly as before.
  • get_version_map starts from {"windows": {}, "mac": {}, "linux": {}}, so a sensor with any other platform reached version_map[plat][...] = ... and raised KeyError. The download command indexes the returned map by the same platform, so it needs the entry too.
  • I do not have a Falcon tenant, so I did not run the script against the API. I called get_version_map from the file before and after the change with a made-up sensor list that has Windows, Debian and VMware entries (the vmware platform name is my assumption). Before: KeyError: 'vmware'. After: vmware is returned with current, previous and oldest entries, and windows and linux are unchanged.
  • pylint (127 columns, --disable=R0801) reports the same messages as before the change, and bandit reports no issues. flake8 only reports lines that were already there.

…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
jshcodes force-pushed the fix/1361-sensor-download-platforms branch from 4a4d605 to 1122648 Compare November 13, 2026 18:08

@jshcodes jshcodes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging to samples for additional testing and confirmation.

Thank you for your contribution! 🙇

@jshcodes
jshcodes merged commit 66795f8 into CrowdStrike:samples Nov 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants