ci: expand CI checks and make consumer sync opt-in
- Add Go, npm, Python, and Java validation to CI - Run Go tests against PostgreSQL - Record performance fixes in the report
This commit is contained in:
1 parent
199a5efaef
commit
22887fef03
100 files changed
+9740
-429
No files matched your search
@@ -149,3 +149,26 @@ func TestHandlerAppliesPushedInfo(t *testing.T) {
|
||||
t.Fatal("response echoed the ContentScanner secret")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerRejectsNonHTTPURLsWithoutChangingStore(t *testing.T) {
|
||||
store := NewStore(Info{AuthGuardURL: "http://auth.example.com"})
|
||||
handler := Handler("s3cret", store)
|
||||
for _, bad := range []Info{
|
||||
{AuthGuardURL: "javascript:alert(1)"},
|
||||
{AuthGuardURL: "auth.example.com"},
|
||||
{CarrierNodeURLs: []string{"http://carrier.example.com", "file:///etc/passwd"}},
|
||||
{ContentScannerURL: "http://"},
|
||||
} {
|
||||
body, _ := json.Marshal(bad)
|
||||
req := httptest.NewRequest(http.MethodPut, "/api/core-services/internal", bytes.NewReader(body))
|
||||
req.Header.Set("X-Internal-Auth", "s3cret")
|
||||
rec := httptest.NewRecorder()
|
||||
handler(rec, req)
|
||||
if rec.Code != http.StatusBadRequest {
|
||||
t.Fatalf("status = %d for %+v, want 400", rec.Code, bad)
|
||||
}
|
||||
}
|
||||
if got := store.Get(); got.AuthGuardURL != "http://auth.example.com" || len(got.CarrierNodeURLs) != 0 {
|
||||
t.Fatalf("store changed by a rejected push: %+v", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user