-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add URIs to schema #19
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Felipe Zipitria <[email protected]>
Does this PR break the axiom that 1 test = 1 request? Or has that already been broken? What is the goal with this change? To reduce duplication? How useful would this be in practice? E.g. do we have lots of tests that would then become 1 single test? I may be misunderstanding this change, but it looks like a very significant change. |
Sorry, forgot to add the reference to coreruleset/go-ftw#256. This makes sense mostly for exclusion rules in plugins, where we need to test many URLs are not matching certain rules. |
Signed-off-by: Felipe Zipitria <[email protected]>
@@ -203,9 +203,18 @@ type Input struct { | |||
// URI allows you to declare the URI the test should use as part of the request line. | |||
// examples: | |||
// - name: URI | |||
// value: "\"/get?hello=world\"" | |||
// value: '/get?hello=world" |
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.
// value: '/get?hello=world" | |
// value: '/get?hello=world' |
URI *string `yaml:"uri,omitempty" json:"uri,omitempty" koanf:"uri,omitempty"` | ||
|
||
// description: | | ||
// URIs is a list of URIs that the test should use as part of the request line. | ||
// If URIs is set, URI will be ignored. URIs is useful for tests that need to send multiple requests. |
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.
// If URIs is set, URI will be ignored. URIs is useful for tests that need to send multiple requests. | |
// If URIs is set, URI will be ignored. URIs is useful for running the same test against multiple URIs, e.g., when | |
// matching on URI paths. |
That was never the case, technically, since even the old framework supported "stages".
Yes, mainly. For example, when testing rule exclusions, you often need to test multiple URI paths, while all other test data remains the same.
Yes, most notably in plugins.
No, it should be straight forward and is backwards compatible. |
While poring over the unix RCE FPs, I had a thought. Instead of making # ...
templates:
- key: uri
values:
- /get
- /get?foo=bar
- key: command
values:
- php
- php%20foo
# ...
input:
uri: "{{ uri }}"
method: POST
data: "cmd={{ command }}" The set of tests would be the cross product of all combinations. We could maybe distinguish these "template tests" from existing tests by introducing a new "template test" type. What do you think? |
You are getting nearer a vision I had this retreat about how the future will look like for writing a rule. It definitely implies adding templating. Also, 99% of our tests only need one template. We tend to repeat 90% of the text we do in tests. I plan to write a blog post about this, but will take me some time to process when heading back tomorrow. Another good source of inspiration could be... nuclei templates. |
what
URIs
as a new fieldwhy