Skip to content

Backslashes are not properly escaped in where/choose clause #319

@r-thomson

Description

@r-thomson

build_where_clause() and build_choose_clause() both attempt to escape single quotes in the provided strings. However, they do not handle backslashes, which means it's possible to un-escape the single quote.

>>> build_where_clause(DisplayName=r"Smith's Shop")
"DisplayName = 'Smith\\'s Shop'"
>>> build_where_clause(DisplayName=r"Smith\'s Shop")
"DisplayName = 'Smith\\\\'s Shop'"

This results in an error from the QuickBooks API, and could also be used to inject additional clauses into the search query.

>>> Customer.filter(DisplayName=r"Smith\'s Shop", qb=qb)
quickbooks.exceptions.ValidationException: QB Validation Exception 4000: Error parsing query

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions