-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
SecGeoLookupDb directive support #170
Conversation
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.
We should review waf.GeoIPDB and if the numeric operators supports floats
@@ -34,11 +34,11 @@ func (o *eq) Init(data string) error { | |||
} | |||
|
|||
func (o *eq) Evaluate(tx *coraza.Transaction, value string) bool { | |||
d1, err := strconv.Atoi(o.data.Expand(tx)) | |||
d1, err := strconv.ParseFloat(o.data.Expand(tx), 64) |
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.
Are you sure ge, eq, lt, etc... support floats instead of ints?
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.
Yeah! Using float64 can support the comparison of positive and negative numbers, and the memory occupied on 64 bit machines is the same as that of int type(most machines should be 64 bit)
Kudos, SonarCloud Quality Gate passed! |
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.
Looks good!
Do we need to push the testdata to this repo? Can't we do this in the Github Actions PIpeline? I'm worried about making this repo too heavy...
Also, looks like there are some conflicts in the go.mod file 🤔 |
Can we transform this into a plugin until we find how to manage the databases? It will be an official plugin with official support. I think we must keep it simple, in the meantime we can use the waf.Config.Get("geoip") interface to store the database for each engine (one plugin per engine) I have created this as a sample: https://github.com/corazawaf/coraza-geoip |
Sure! Thank you very much! |
Note: that go.mod and go.sum can only be modified for tested dependency updates or justified new features.
Make sure that you've checked the boxes below before you submit PR:
Thanks for your PR ❤️