Implement classification redesign

This commit is contained in:
Lars Nolden
2026-09-11 22:46:17 +02:00
parent cc43a2f9a7
commit 87f052a3ea
23 changed files with 1602 additions and 296 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ func TestOriginAndHostGuardProtectNoLoginService(t *testing.T) {
}{{"rebound host", "attacker.example", "", "application/json", 403}, {"cross origin", "localhost:8080", "https://attacker.example", "application/json", 403}, {"simple form CSRF", "localhost:8080", "", "text/plain", 415}, {"valid local mutation", "localhost:8080", "http://localhost:8080", "application/json", 200}}
for _, tt := range cases {
t.Run(tt.name, func(t *testing.T) {
r := httptest.NewRequest(http.MethodPost, "http://localhost:8080/api/settings", strings.NewReader(`{"model":"example/model","include_amount":false}`))
r := httptest.NewRequest(http.MethodPost, "http://localhost:8080/api/settings", strings.NewReader(`{"model":"example/model"}`))
r.Host = tt.host
r.Header.Set("Content-Type", tt.content)
r.Header.Set("Origin", tt.origin)
@@ -117,7 +117,7 @@ func TestOpenRouterKeyIsWriteOnlyAndRequiresExplicitRemoval(t *testing.T) {
configured(check("POST", endpoint, keyJSON, origin, http.StatusOK), true)
configured(check("GET", "/api/state", "", origin, http.StatusOK), true)
// Ordinary preference updates must not implicitly erase credentials.
configured(check("POST", "/api/settings", `{"model":"example/model","include_amount":false}`, origin, http.StatusOK), true)
configured(check("POST", "/api/settings", `{"model":"example/model"}`, origin, http.StatusOK), true)
for _, body := range []string{
`{}`,
`{"api_key":null}`,