mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-25 17:30:56 +08:00
Duplicate and lower-case nonce headers are stripped without bypassing, the registry is single-use and rejects multi-valued fields, a forged caller header cannot steer either mode, concurrent bypass and apply replays do not share state, SSE streams bypass by default, a cancelled replay leaves no nonce or marker, and the route rejects a non-boolean apply_rules.
22 lines
576 B
Go
22 lines
576 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
// apply_rules is a boolean in the API contract: a string or a number is a 400,
|
|
// not a silent false or true.
|
|
func TestAdversarialReplayRouteRejectsNonBoolApplyRules(t *testing.T) {
|
|
_, replay := replayServer(t, true, false)
|
|
for _, body := range []string{
|
|
`{"method":"GET","url":"http://example.com/","apply_rules":"yes"}`,
|
|
`{"method":"GET","url":"http://example.com/","apply_rules":1}`,
|
|
} {
|
|
w := replay(body)
|
|
if w.Code != http.StatusBadRequest {
|
|
t.Fatalf("%s = %d %s, want 400", body, w.Code, w.Body)
|
|
}
|
|
}
|
|
}
|