-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
exposing more methods in the types.Transaction
interface ?
#799
Comments
I have some reluctancies about this, adding a method Given the nature of this, not being able to check the correctness of the ruleset before runtime is desirable, adding this method invalids this assumption. |
Ping @buixor |
Hello, If I understand correctly, you're concerned it would be used during the request processing while the associated phase has already been evaluated. (I do believe it's something that might be detected at runtime, but that's another topic). I do understand it's not suitable in all situations. That's why I'm going to open a PR to add it as an experimental package. In our situation, those |
Related: libcoraza also needs to add/remove methods dynamically corazawaf/libcoraza#23 cc @potats0 |
copy that |
@jcchavezs what about implementing experimental interfaces to add access to internal functions? type TransactionFlowControl interface {
RemoveRuleById(int)
Skip(int)
...
} |
It could be a function that accepts a transaction and returns an interface after validating the methods can be applied given the phase of the transaction. |
Hello,
As per the discussion below and our slack chat, I open an issue to track this topic,
What we want to do
We are looking to integrate Coraza within the crowdsec project. Concretely, it means that the existing web bouncers can forward their requests to crowdsec, which will evaluate their requests with Coraza. We want to evaluate rules both in-band and out-of-band.
However, (hence the issue) we want to avoid exposing the user(s) to SecLang/SecRule, as the users can rely on the existing hub mechanism of crowdsec to get, update etc. their rules. One of the points we'd like to address is to allow the user to disable/modify some rules at runtime (here runtime means before the requests start to be evaluated, but once the engine has already been loaded and the transaction possibly created) based on some conditions, using the existing
expr
language that exists in crowdsec:However, it seems that the
types.Transaction
interface only exposes a small subset of the methods of the underlying internal object. Would it be possible to expose more methods in thetypes.Transaction
interface,RemoveRuleByID
would be very useful for example. This would allow us (within crowdsec) to let the user manipulate the rules without touching coraza's configuration or the rules themselves.Please let me know if you believe there are better ways to achieve this. While I do understand that this is something that is
achievable with SecLang, it's not desirable for us because:
Looking forward to hearing from you 😃
Discussed in #784
Originally posted by buixor May 4, 2023
Hello,
First of all, thanks for the cool project. I have a few questions!
While playing around with coraza (v3), I found the need to be able to use, for example,
RemoveRuleByID
at runtime.However, it seems that the
types.Transaction
object that you get from theNewTransaction
method doesn't offer much "runtime configuration" methods, that do exist in the underlying internalTransaction
object. For now, I have forked coraza to expose theRemoveRuleByID
method intypes.Transaction
and it didn't seem to implode.Q: Am I missing something, is it intentional, or is it already planned?
The text was updated successfully, but these errors were encountered: