MCPcopy Create free account
hub / github.com/devploit/nomore403 / TestDoubleEncodingSendsEncodedPaths

Function TestDoubleEncodingSendsEncodedPaths

cmd/bypass_test.go:286–325  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

284}
285
286func TestDoubleEncodingSendsEncodedPaths(t *testing.T) {
287 resetTestState()
288
289 ts, getRequests := testServer(t, nil)
290 defer ts.Close()
291
292 opts := RequestOptions{
293 uri: ts.URL + "/admin",
294 headers: []header{{"User-Agent", "test"}},
295 method: "GET",
296 proxy: &url.URL{},
297 timeout: 5000,
298 rateLimit: false,
299 redirect: false,
300 verbose: true,
301 }
302
303 requestDoubleEncoding(opts)
304
305 reqs := getRequests()
306 if len(reqs) == 0 {
307 t.Fatal("expected double-encoding requests to be sent, got 0")
308 }
309
310 // Double-encoded paths should contain percent-encoded characters
311 foundEncoded := false
312 for _, r := range reqs {
313 raw := r.URL.RawPath
314 if raw == "" {
315 raw = r.URL.Path
316 }
317 if strings.Contains(raw, "%25") || strings.Contains(raw, "%") {
318 foundEncoded = true
319 break
320 }
321 }
322 if !foundEncoded {
323 t.Error("expected at least one request with double-encoded path characters")
324 }
325}
326
327func TestPathCaseSwitchingSendsVariations(t *testing.T) {
328 resetTestState()

Callers

nothing calls this directly

Calls 3

resetTestStateFunction · 0.85
testServerFunction · 0.85
requestDoubleEncodingFunction · 0.85

Tested by

no test coverage detected