Skip to content

Refuse dot-segment values for path parameters - #1535

Open
giri-kondisetty wants to merge 1 commit into
CrowdStrike:devfrom
giri-kondisetty:fix/dot-segment-path-values
Open

giri-kondisetty wants to merge 1 commit into
CrowdStrike:devfrom
giri-kondisetty:fix/dot-segment-path-values

Conversation

@giri-kondisetty

@giri-kondisetty giri-kondisetty commented Nov 27, 2026 •

Copy link
Copy Markdown

Refuse dot-segment values for path parameters

encode_path_segment() left a value of . or .. unchanged, so the HTTP client removed it together with the preceding segment and the request went to a shorter route. These two values are now refused with a ValueError. Encoding the dots is not an option because requests decodes %2E again before the path is normalized.

  • Bug fixes
  • Updated unit tests

Unit test coverage

I could not run the full suite: most test modules need API credentials. tests/test_path_encoding.py is fully mocked and passes:

$ pytest -q tests/test_path_encoding.py
15 passed in 0.14s

The changed lines in encode_path_segment() are covered by the three new tests.

Bandit analysis

$ bandit -r src/falconpy/_util
No issues identified.
Total lines of code: 1256
Total issues (by severity): Low: 0, Medium: 0, High: 0

flake8, pylint (10.00/10) and pydocstyle are clean for src/falconpy/_util.

Issues resolved

Other

  • A caller that passes . or .. as a path identifier now gets a ValueError where it used to get a request to a different route. I did not tick "Breaking Change" because neither value can be a valid identifier, but say so if you would rather return an error result.
  • Values that only contain dots inside a longer name (v1.2, ...) are unchanged.

encode_path_segment() leaves a value of '.' or '..' unchanged, so the HTTP
client removes it together with the preceding segment and the request goes
to a shorter route. Percent-encoding the dots does not help because requests
decodes them again before the path is normalized, so these values are refused.

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