Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error at offset #143

Open
ctdfo opened this issue Apr 19, 2024 · 2 comments
Open

Syntax error at offset #143

ctdfo opened this issue Apr 19, 2024 · 2 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@ctdfo
Copy link

ctdfo commented Apr 19, 2024

Describe the bug
We are getting the error Syntax error at offset in our logs. The occurs when any special character of ,.<>{}[]"':;!@#$%^&*()+=~ is added to the Search bar of the Events section in the UI.

How to reproduce it
Install the Falco Helm chart with Falcosidekick (using version 4.3.0, which corresponds to app version 0.37.1) and search for an event (with any of the following special character: ,.<>{}[]"':;!@#$%^&*()+=~) in the Search bar of the Events section.

Expected behaviour
No Syntax error at offset when special characters ,.<>{}[]"':;!@#$%^&*()+=~ is added to the Search bar of the Events section in the UI.

Screenshots
When I search for the event time 06:47:14:398, that has the special character :, I get the error:
image
image

But then when I properly escape the : using \ (i.e., 06\:47\:14\:398), I don't get the error:
image

Environment

  • Falco version:
    0.37.1
  • System info:
    Linux version 5.15.148.2-2.cm2 (root@CBL-Mariner) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) UI updates #1 SMP Fri Feb 23 23:44:30 UTC 2024
  • Kernel:
    Linux falco-falcosidekick-ui-5f89b8bc9d-zn869 5.15.148.2-2.cm2 UI updates #1 SMP Fri Feb 23 23:44:30 UTC 2024 x86_64 Linux
  • Installation method:
    Kubernetes

Additional context
I believe the issue occurs with the API call /api/v1/events/count/:groupby that calls the CountBy function, then the CountKeyBy function, then the newQuery function that calls the erroneous Escape function that doesn’t escape all punctuation correctly (see screenshot below). The function correctly escapes hyphens (with the use of a single backslash), but then incorrectly escapes forward slashes and periods by using two backslashes (and omits all other special characters). This is why when we put one of those characters in the search field, we get the error.
image

In Redis, when you query for tags that contain punctuation, you must escape that punctuation with a backslash character (). If not, then you’ll get the error we are seeing (see: https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/ and https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/escaping/).

@ctdfo ctdfo added the kind/bug Something isn't working label Apr 19, 2024
@Issif
Copy link
Member

Issif commented Apr 24, 2024

Thanks for this very detailed report, I'll replace the escape function to handle more characters. FYI, I didn't use the Redis TAGS for the values.

Issif added a commit that referenced this issue Apr 26, 2024
…character and conversion error for the groupby

Signed-off-by: Thomas Labarussias <issif+github@gadz.org>
poiana pushed a commit that referenced this issue Apr 30, 2024
…character and conversion error for the groupby

Signed-off-by: Thomas Labarussias <issif+github@gadz.org>
@Issif Issif self-assigned this Apr 30, 2024
@Issif
Copy link
Member

Issif commented Apr 30, 2024

The PR #145 fixes that issue, it will be included in the next release. The ETA is before summer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants