-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[dev/Wasm] Removing unsupported try catch #2783
base: v3/dev/wasm-experimental
Are you sure you want to change the base?
[dev/Wasm] Removing unsupported try catch #2783
Conversation
Signed-off-by: Matteo Pace <[email protected]>
0ccef89
to
b02f740
Compare
Update: about
As far as I understood, these conversions happen just at loading time, the overhead of ss compared to from_chars should not be so relevant in favor of fewer compiling problems. I also saw that Open to any discussion also about it. |
fyi, the exception support might work with the latest envoy, see the discussion proxy-wasm/proxy-wasm-cpp-sdk#140 |
It helps a lot. Thanks. |
Thank you, Takeshi! I have followed the conversation for a bit, as of now I have not been able to make it work, but it sounds really promising. I tweaked all the code where I saw a feasible alternative, but (for example about memory allocation) I feel that exception support is very much needed to prevent unexpected behaviors. |
Hello @M4tteoP , I'm open to revisiting some of these try/catch usages. Many of the existing usages aren't the highest-value usages of try/catch anyway. On the other hand, if we're saying we would want to never implement additional try-catch blocks in ModSecurity in the future, that might be seen as a nontrivial limitation on development. Another thing to consider is what the replacement code is. So far ModSecurity has not generally incorporated C++17 features. It's useful to maintain compatibility with older compiler versions (within reason), so we'd have to decide if this is the right time for that. |
Hello @martinhsv,
Thank you, if we agree on a proper replacement code that permits maintaining compatibility with older compile versions, I'm open to working on a PR on the main branch. Specifically, do you wish to avoid the usage of
Yes, I totally understand that, it would be awesome just to properly revisit not needed usages and, strictly speaking about Wasm:
|
When testing ModSecurity Wasm plugin, we encountered unexpected "500" or "503" error codes with some simple rules added. I hope some of the issues can be fixed by this PR. Thanks @M4tteoP for working on it. |
Context
Several basic elements from the
modsecurity.conf
file (e.g. rules200002
,200003
,200004
) are leading to aRuntimeError
anticipated by astoi: no conversion error
.As far as I know, the proxy Wasm SDK does not still support the handling of exceptions, therefore, the
stoi
conversion based on catching an exception when the conversion fails leads to this behaviour.Solution
The PR proposes to handle the conversion based on the more recent std::from_chars that handles without exceptions the outcome.
Work in progress, request for tips and discussion
Other
try catch
patterns are still in place inside the code and they may lead to similar errors. Specifically:.cc
and.yy
files? E.g. seclang-parser.cc#L2907-L2915Thanks!
@martinhsv @leyao-daily