Skip to content

[ BUG ] Missing comma in _payload/_cspm_registration.py causes implicit string concatenation breaking GCP validation kwargs #1463

@alhumaw

Description

@alhumaw

Describe the bug

The cspm_service_account_validate_payload function in _payload/_cspm_registration.py has a missing comma between "project_id" and "service_account_conditions" in a list literal at lines 220-221. Python silently concatenates adjacent string literals, producing "project_idservice_account_conditions" as a single key instead of two separate keys. This means neither project_id nor service_account_conditions kwargs work for GCP CSPM service account validation operations.

To Reproduce

  1. Create a CSPMRegistration service class instance
  2. Call the GCP service account validation method passing project_id or service_account_conditions as kwargs:
from falconpy import CSPMRegistration

falcon = CSPMRegistration(client_id="ID", client_secret="SECRET")
result = falcon.validate_gcp_service_account(
    project_id="my-gcp-project-123",
    service_account_conditions=[{"feature": "cloud-security"}]
)
  1. Neither project_id nor service_account_conditions appear in the request body sent to the API. The kwargs are silently ignored.

The root cause is a missing comma in src/falconpy/_payload/_cspm_registration.py lines 220-221:

# Current (broken) - implicit string concatenation
keys = ["...", "project_id"
        "service_account_conditions", "..."]

# This produces: [..., "project_idservice_account_conditions", ...]

Expected behavior

Passing project_id or service_account_conditions as keyword arguments should include them in the JSON body sent to the API, consistent with the documented kwargs in the operation docstring.

Environment (please complete the following information):

  • OS: All
  • Python: All supported versions
  • FalconPy: --

Additional context

Workaround: pass a pre-built body dict to bypass the payload builder:

result = falcon.validate_gcp_service_account(body={
    "project_id": "my-gcp-project-123",
    "service_account_conditions": [{"feature": "cloud-security"}]
})

Fix: add the missing comma in src/falconpy/_payload/_cspm_registration.py line 220:

# Before
keys = ["...", "project_id"
        "service_account_conditions", "..."]
# After
keys = ["...", "project_id",
        "service_account_conditions", "..."]

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions