Skip to content

Keep boolean keywords passed as False in network location, IDP policy rule and sensor update policy payloads - #1531

Open
ajaykr0905 wants to merge 1 commit into
CrowdStrike:devfrom
ajaykr0905:fix/1530-false-booleans-in-payloads
Open

ajaykr0905 wants to merge 1 commit into
CrowdStrike:devfrom
ajaykr0905:fix/1530-false-booleans-in-payloads

Conversation

@ajaykr0905

@ajaykr0905 ajaykr0905 commented Nov 15, 2026 •

Copy link
Copy Markdown

Keep boolean keywords passed as False in payloads

  • Bug fixes
  • Updated unit tests

network_locations_create_payload, idp_policy_payload and sensor_policy_payload only added a boolean keyword when it was truthy, so passing False built the same body as leaving the keyword out. That dropped enabled=False from FirewallManagement.create_network_locations, upsert_network_locations and update_network_locations, enabled=False and simulation_mode=False / simulationMode=False from IdentityProtection.create_policy_rule, and show_early_adopter_builds=False from the SensorUpdatePolicy create and update methods (v1 and v2).

I changed those keys to an is not None check, the same way firewall_rule_group_payload already handles enabled. An explicit False is now sent, and a keyword that isn't passed (or is None) is still left out, so existing calls build the same bodies as before.

Unit test coverage

I added tests/test_payload_boolean_false.py. It calls the three builders directly, and calls the service class methods with requests.request patched, so nothing goes over the network and no credentials are needed. It checks that False and True are both kept and that the keys stay absent when not passed. All 22 tests pass; before the change, 13 of them failed. Every changed line is covered by these tests. I couldn't run the full util/run-tests.sh coverage report because it needs API credentials.

Bandit analysis

bandit -r src: No issues identified.

flake8, pylint (--max-line-length=127 --disable=R0801) and pydocstyle are clean on the changed files.

Issues resolved

Other

I didn't test this against a live tenant. The tests check the request the SDK builds.

network_locations_create_payload, idp_policy_payload and
sensor_policy_payload only added a boolean keyword when it was truthy,
so enabled=False, simulation_mode=False (or simulationMode=False) and
show_early_adopter_builds=False were dropped from the request body.
These keys are now checked with "is not None", matching
firewall_rule_group_payload. Keywords that are not passed are still
left out.

Adds offline unit tests for the three payload builders and the service
class methods that use them.
@ajaykr0905
ajaykr0905 force-pushed the fix/1530-false-booleans-in-payloads branch from 3332bc7 to 2d17347 Compare November 15, 2026 17:24

This branch has not been deployed

No deployments
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.

1 participant