MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / testTemplate3001

Function testTemplate3001

internal/waf/template_test.go:205–218  ·  view source on GitHub ↗
(a *assert.Assertion, t *testing.T, template *waf.WAF)

Source from the content-addressed store, hash-verified

203}
204
205func testTemplate3001(a *assert.Assertion, t *testing.T, template *waf.WAF) {
206 req, err := http.NewRequest(http.MethodPost, "http://example.com/index.php?exec1+(", bytes.NewReader([]byte("exec('rm -rf /hello');")))
207 if err != nil {
208 t.Fatal(err)
209 }
210 result, err := template.MatchRequest(requests.NewTestRequest(req), nil, firewallconfigs.ServerCaptchaTypeNone)
211 if err != nil {
212 t.Fatal(err)
213 }
214 a.IsNotNil(result.Set)
215 if result.Set != nil {
216 a.IsTrue(result.Set.Code == "3001")
217 }
218}
219
220func testTemplate4001(a *assert.Assertion, t *testing.T, template *waf.WAF) {
221 req, err := http.NewRequest(http.MethodPost, "http://example.com/index.php?whoami", nil)

Callers 1

Test_TemplateFunction · 0.85

Calls 2

NewTestRequestFunction · 0.92
MatchRequestMethod · 0.45

Tested by

no test coverage detected