Repository navigation
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
Conversation
ajaykr0905
requested review from
alhumaw,
crowdstrikedcs and
jshcodes
as code owners
November 15, 2026 06:40
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
force-pushed
the
fix/1530-false-booleans-in-payloads
branch
from
November 15, 2026 17:24
3332bc7 to
2d17347
Compare
This branch has not been deployed
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.
Keep boolean keywords passed as False in payloads
network_locations_create_payload,idp_policy_payloadandsensor_policy_payloadonly added a boolean keyword when it was truthy, so passingFalsebuilt the same body as leaving the keyword out. That droppedenabled=FalsefromFirewallManagement.create_network_locations,upsert_network_locationsandupdate_network_locations,enabled=Falseandsimulation_mode=False/simulationMode=FalsefromIdentityProtection.create_policy_rule, andshow_early_adopter_builds=Falsefrom theSensorUpdatePolicycreate and update methods (v1 and v2).I changed those keys to an
is not Nonecheck, the same wayfirewall_rule_group_payloadalready handlesenabled. An explicitFalseis now sent, and a keyword that isn't passed (or isNone) 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 withrequests.requestpatched, so nothing goes over the network and no credentials are needed. It checks thatFalseandTrueare 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 fullutil/run-tests.shcoverage 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
enabled,simulation_mode/simulationModeandshow_early_adopter_buildswithis not Nonein their payload builders.Other
I didn't test this against a live tenant. The tests check the request the SDK builds.