-
Notifications
You must be signed in to change notification settings - Fork 174
chore(userspace/libsinsp): escape equals ast values #2324
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
Conversation
If a condition expression contains a value with a = character, when the condition expression is printed as a string using libsinsp::filter::ast::as_string, the value is not escaped. This causes problems if you try to parse the condition expression string again. For example, a condition of ... and not (proc.cmdline contains "--coreutils-prog-shebang=") and not ... gets printed as ... and not (proc.cmdline contains --coreutils-prog-shebang=) and not ... which results in an error when trying to parse it again. The fix is to detect when a value contains a `=` character and escape the value when found. Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
This test verifies that a condition expression with a value containing an `=` character can be printed and parsed again without errors. Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2324 +/- ##
=======================================
Coverage 77.16% 77.17%
=======================================
Files 226 226
Lines 30161 30169 +8
Branches 4611 4611
=======================================
+ Hits 23274 23282 +8
Misses 6887 6887
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Perf diff from master - unit tests
Heap diff from master - unit tests
Heap diff from master - scap file
Benchmarks diff from master
|
/milestone 0.21.0 |
LGTM label has been added. Git tree hash: 0c516c6673679566efb06f6dd2111123a254ebfa
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, mstemm The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area libsinsp
Does this PR require a change in the driver versions?
No.
What this PR does / why we need it:
Properly escape
=
characters in condition expressions when printing the condition as a string.Which issue(s) this PR fixes:
Fixes #2323
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
no