Skip to content

[Buganizer ID: 548190866] Fix: URL-encode OData $filter parameters for special characters - #1187

Open
pankjsingh-ind wants to merge 1 commit into
chronicle:mainfrom
pankjsingh-ind:fix-tipcommon-odata-special-char-encoding
Open

[Buganizer ID: 548190866] Fix: URL-encode OData $filter parameters for special characters#1187
pankjsingh-ind wants to merge 1 commit into
chronicle:mainfrom
pankjsingh-ind:fix-tipcommon-odata-special-char-encoding

Conversation

@pankjsingh-ind

@pankjsingh-ind pankjsingh-ind commented Aug 27, 2026

Copy link
Copy Markdown

Description

Fixes OData $filter URL parameter construction in OnePlatformSoarApi by applying urllib.parse.quote() to prevent reserved characters like & in custom list categories and environments from splitting query strings and triggering 400 Bad Request errors.

What problem does this PR solve?

When querying 1Platform endpoints with OData $filter expressions (such as in get_traking_list_records_filtered, get_traking_list_record, and get_cases_by_timestamp_filter), parameters containing reserved URI characters (such as & in environment or category names) caused the web server to split the query string at the ampersand delimiter. This resulted in 400 Client Error: Bad Request or 0 records returned.

How does this PR solve the problem?

Applied urllib.parse.quote() to the $filter query string in OnePlatformSoarApi so that reserved characters (&), spaces, and unicode symbols (e.g. umlauts) are safely percent-encoded (e.g. %26), preserving the full query filter intact across all network requests.

Testing & Verification

  • Added dedicated unit tests: test_get_traking_list_records_filtered_url_encoded and test_get_traking_list_record_url_encoded in test_one_platform_soar_api.py.
  • Ran full test suite: 16/16 passed.
  • Tested live reproduction in Chronicle SOAR UI against environment and category containing & and umlauts (Indevis_Test_&_München).

Checklist:

General Checks:

  • I have read and followed the project's contributing.md guide.
  • My code follows the project's coding style guidelines.
  • I have performed a self-review of my own code.
  • My changes do not introduce any new warnings.
  • My changes pass all existing tests.
  • I have added new tests where appropriate to cover my changes.
  • I have updated the documentation where necessary.

Open-Source Specific Checks:

  • My changes do not introduce any Personally Identifiable Information (PII) or sensitive customer data.
  • My changes do not expose any internal-only code examples, configurations, or URLs.
  • All code examples, comments, and messages are generic and suitable for a public repository.
  • I understand that any internal context or sensitive details related to this work are handled separately in internal systems (Buganizer for Google team members).

For Google Team Members and Reviewers Only:

  • I have included the Buganizer ID in the PR title or description (Internal Buganizer ID: 548190866).
  • I have ensured that all internal discussions and PII related to this work remain in Buganizer.
  • I have tagged the PR with one or more labels that reflect the pull request purpose.

@pankjsingh-ind
pankjsingh-ind requested a review from a team as a code owner August 27, 2026 09:09
When constructing 1Platform OData $filter query parameters in
OnePlatformSoarApi (such as in get_traking_list_records_filtered
and get_traking_list_record), parameters containing reserved
characters (such as '&' in environment or category names) caused
the web server to split the query string, resulting in 400 Bad Request
or missing custom list records.

This change applies urllib.parse.quote() to the OData $filter string
so that reserved characters and special symbols are safely percent-encoded
and preserved in the backend API request.

Bug: b/548190866
@pankjsingh-ind
pankjsingh-ind force-pushed the fix-tipcommon-odata-special-char-encoding branch from d42cada to 9cbc0dd Compare August 27, 2026 09:15
@pankjsingh-ind pankjsingh-ind changed the title [TIPCommon] Fix OData filter URL encoding for special characters [Buganizer ID: 548190866] Fix: URL-encode OData $filter parameters for special characters Aug 27, 2026

@patilgp-oss patilgp-oss left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

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