diff --git a/bible-local/01-overview.md b/bible-local/01-overview.md index 43e0f6a..9916f05 100644 --- a/bible-local/01-overview.md +++ b/bible-local/01-overview.md @@ -68,3 +68,14 @@ bible/ shared engineering rules bible-local/ project-specific architecture releases/ release artifacts and notes ``` + +## Local HTTP trust boundary + +Loopback binding does not make a browser client trusted. Both setup and normal +routers reject non-loopback Host, Origin and Referer values, opaque origins and +cross-site Fetch Metadata requests before any handler runs. CLI clients may omit +browser headers. API requests carrying a body require application/json, except +the project vendor-import endpoint, which also accepts multipart/form-data. +Setup retains HTML forms; an empty password reuses the saved credential only +when host, port and user are unchanged. Changing the destination requires an +explicit password. diff --git a/cmd/qfs/main.go b/cmd/qfs/main.go index 54711a7..f718d2b 100644 --- a/cmd/qfs/main.go +++ b/cmd/qfs/main.go @@ -565,6 +565,7 @@ func runSetupMode(local *localdb.LocalDB) { gin.SetMode(gin.ReleaseMode) router := gin.New() router.Use(gin.Recovery()) + router.Use(middleware.CORS()) if staticFS, err := qfassets.StaticFS(); err == nil { router.StaticFS("/static", http.FS(staticFS)) diff --git a/cmd/qfs/versioning_api_test.go b/cmd/qfs/versioning_api_test.go index 891e473..430f648 100644 --- a/cmd/qfs/versioning_api_test.go +++ b/cmd/qfs/versioning_api_test.go @@ -45,7 +45,7 @@ func TestConfigurationVersioningAPI(t *testing.T) { } // list versions happy path - listReq := httptest.NewRequest(http.MethodGet, "/api/configs/"+created.UUID+"/versions?limit=10&offset=0", nil) + listReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/versions?limit=10&offset=0", nil) listRec := httptest.NewRecorder() router.ServeHTTP(listRec, listReq) if listRec.Code != http.StatusOK { @@ -53,7 +53,7 @@ func TestConfigurationVersioningAPI(t *testing.T) { } // get version happy path - getReq := httptest.NewRequest(http.MethodGet, "/api/configs/"+created.UUID+"/versions/1", nil) + getReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/versions/1", nil) getRec := httptest.NewRecorder() router.ServeHTTP(getRec, getReq) if getRec.Code != http.StatusOK { @@ -62,7 +62,7 @@ func TestConfigurationVersioningAPI(t *testing.T) { // rollback happy path body := []byte(`{"target_version":1,"note":"api rollback"}`) - rbReq := httptest.NewRequest(http.MethodPost, "/api/configs/"+created.UUID+"/rollback", bytes.NewReader(body)) + rbReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/rollback", bytes.NewReader(body)) rbReq.Header.Set("Content-Type", "application/json") rbRec := httptest.NewRecorder() router.ServeHTTP(rbRec, rbReq) @@ -84,7 +84,7 @@ func TestConfigurationVersioningAPI(t *testing.T) { } // 404: version missing - notFoundReq := httptest.NewRequest(http.MethodGet, "/api/configs/"+created.UUID+"/versions/999", nil) + notFoundReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/versions/999", nil) notFoundRec := httptest.NewRecorder() router.ServeHTTP(notFoundRec, notFoundReq) if notFoundRec.Code != http.StatusNotFound { @@ -92,7 +92,7 @@ func TestConfigurationVersioningAPI(t *testing.T) { } // 400: invalid version number - invalidReq := httptest.NewRequest(http.MethodGet, "/api/configs/"+created.UUID+"/versions/abc", nil) + invalidReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/versions/abc", nil) invalidRec := httptest.NewRecorder() router.ServeHTTP(invalidRec, invalidReq) if invalidRec.Code != http.StatusBadRequest { @@ -100,7 +100,7 @@ func TestConfigurationVersioningAPI(t *testing.T) { } // 400: rollback invalid target_version - badRollbackReq := httptest.NewRequest(http.MethodPost, "/api/configs/"+created.UUID+"/rollback", bytes.NewReader([]byte(`{"target_version":0}`))) + badRollbackReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/rollback", bytes.NewReader([]byte(`{"target_version":0}`))) badRollbackReq.Header.Set("Content-Type", "application/json") badRollbackRec := httptest.NewRecorder() router.ServeHTTP(badRollbackRec, badRollbackReq) @@ -109,28 +109,28 @@ func TestConfigurationVersioningAPI(t *testing.T) { } // archive + reactivate flow - delReq := httptest.NewRequest(http.MethodDelete, "/api/configs/"+created.UUID, nil) + delReq := httptest.NewRequest(http.MethodDelete, "http://127.0.0.1:8080/api/configs/"+created.UUID, nil) delRec := httptest.NewRecorder() router.ServeHTTP(delRec, delReq) if delRec.Code != http.StatusOK { t.Fatalf("archive status=%d body=%s", delRec.Code, delRec.Body.String()) } - archivedListReq := httptest.NewRequest(http.MethodGet, "/api/configs?status=archived&page=1&per_page=20", nil) + archivedListReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs?status=archived&page=1&per_page=20", nil) archivedListRec := httptest.NewRecorder() router.ServeHTTP(archivedListRec, archivedListReq) if archivedListRec.Code != http.StatusOK { t.Fatalf("archived list status=%d body=%s", archivedListRec.Code, archivedListRec.Body.String()) } - reactivateReq := httptest.NewRequest(http.MethodPost, "/api/configs/"+created.UUID+"/reactivate", nil) + reactivateReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/reactivate", nil) reactivateRec := httptest.NewRecorder() router.ServeHTTP(reactivateRec, reactivateReq) if reactivateRec.Code != http.StatusOK { t.Fatalf("reactivate status=%d body=%s", reactivateRec.Code, reactivateRec.Body.String()) } - activeListReq := httptest.NewRequest(http.MethodGet, "/api/configs?status=active&page=1&per_page=20", nil) + activeListReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs?status=active&page=1&per_page=20", nil) activeListRec := httptest.NewRecorder() router.ServeHTTP(activeListRec, activeListReq) if activeListRec.Code != http.StatusOK { @@ -151,7 +151,7 @@ func TestProjectArchiveHidesConfigsAndCloneIntoProject(t *testing.T) { t.Fatalf("setup router: %v", err) } - createProjectReq := httptest.NewRequest(http.MethodPost, "/api/projects", bytes.NewReader([]byte(`{"name":"P1","code":"P1"}`))) + createProjectReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects", bytes.NewReader([]byte(`{"name":"P1","code":"P1"}`))) createProjectReq.Header.Set("Content-Type", "application/json") createProjectRec := httptest.NewRecorder() router.ServeHTTP(createProjectRec, createProjectReq) @@ -164,7 +164,7 @@ func TestProjectArchiveHidesConfigsAndCloneIntoProject(t *testing.T) { } createCfgBody := []byte(`{"name":"Cfg A","items":[{"lot_name":"CPU","quantity":1,"unit_price":100}],"server_count":1}`) - createCfgReq := httptest.NewRequest(http.MethodPost, "/api/projects/"+project.UUID+"/configs", bytes.NewReader(createCfgBody)) + createCfgReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects/"+project.UUID+"/configs", bytes.NewReader(createCfgBody)) createCfgReq.Header.Set("Content-Type", "application/json") createCfgRec := httptest.NewRecorder() router.ServeHTTP(createCfgRec, createCfgReq) @@ -179,7 +179,7 @@ func TestProjectArchiveHidesConfigsAndCloneIntoProject(t *testing.T) { t.Fatalf("expected config project_uuid=%s got=%v", project.UUID, createdCfg.ProjectUUID) } - cloneReq := httptest.NewRequest(http.MethodPost, "/api/projects/"+project.UUID+"/configs/"+createdCfg.UUID+"/clone", bytes.NewReader([]byte(`{"name":"Cfg A Clone"}`))) + cloneReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects/"+project.UUID+"/configs/"+createdCfg.UUID+"/clone", bytes.NewReader([]byte(`{"name":"Cfg A Clone"}`))) cloneReq.Header.Set("Content-Type", "application/json") cloneRec := httptest.NewRecorder() router.ServeHTTP(cloneRec, cloneReq) @@ -194,7 +194,7 @@ func TestProjectArchiveHidesConfigsAndCloneIntoProject(t *testing.T) { t.Fatalf("expected clone project_uuid=%s got=%v", project.UUID, cloneCfg.ProjectUUID) } - projectConfigsReq := httptest.NewRequest(http.MethodGet, "/api/projects/"+project.UUID+"/configs", nil) + projectConfigsReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/projects/"+project.UUID+"/configs", nil) projectConfigsRec := httptest.NewRecorder() router.ServeHTTP(projectConfigsRec, projectConfigsReq) if projectConfigsRec.Code != http.StatusOK { @@ -210,14 +210,14 @@ func TestProjectArchiveHidesConfigsAndCloneIntoProject(t *testing.T) { t.Fatalf("expected 2 project configs after clone, got %d", len(projectConfigsResp.Configurations)) } - archiveReq := httptest.NewRequest(http.MethodPost, "/api/projects/"+project.UUID+"/archive", nil) + archiveReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects/"+project.UUID+"/archive", nil) archiveRec := httptest.NewRecorder() router.ServeHTTP(archiveRec, archiveReq) if archiveRec.Code != http.StatusOK { t.Fatalf("archive project status=%d body=%s", archiveRec.Code, archiveRec.Body.String()) } - activeReq := httptest.NewRequest(http.MethodGet, "/api/configs?status=active&page=1&per_page=20", nil) + activeReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs?status=active&page=1&per_page=20", nil) activeRec := httptest.NewRecorder() router.ServeHTTP(activeRec, activeReq) if activeRec.Code != http.StatusOK { @@ -245,7 +245,7 @@ func TestConfigMoveToProjectEndpoint(t *testing.T) { t.Fatalf("setup router: %v", err) } - createProjectReq := httptest.NewRequest(http.MethodPost, "/api/projects", bytes.NewReader([]byte(`{"name":"Move Project","code":"MOVE"}`))) + createProjectReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects", bytes.NewReader([]byte(`{"name":"Move Project","code":"MOVE"}`))) createProjectReq.Header.Set("Content-Type", "application/json") createProjectRec := httptest.NewRecorder() router.ServeHTTP(createProjectRec, createProjectReq) @@ -257,7 +257,7 @@ func TestConfigMoveToProjectEndpoint(t *testing.T) { t.Fatalf("unmarshal project: %v", err) } - createConfigReq := httptest.NewRequest(http.MethodPost, "/api/configs", bytes.NewReader([]byte(`{"name":"Move Me","items":[],"notes":"","server_count":1}`))) + createConfigReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/configs", bytes.NewReader([]byte(`{"name":"Move Me","items":[],"notes":"","server_count":1}`))) createConfigReq.Header.Set("Content-Type", "application/json") createConfigRec := httptest.NewRecorder() router.ServeHTTP(createConfigRec, createConfigReq) @@ -269,7 +269,7 @@ func TestConfigMoveToProjectEndpoint(t *testing.T) { t.Fatalf("unmarshal config: %v", err) } - moveReq := httptest.NewRequest(http.MethodPatch, "/api/configs/"+created.UUID+"/project", bytes.NewReader([]byte(`{"project_uuid":"`+project.UUID+`"}`))) + moveReq := httptest.NewRequest(http.MethodPatch, "http://127.0.0.1:8080/api/configs/"+created.UUID+"/project", bytes.NewReader([]byte(`{"project_uuid":"`+project.UUID+`"}`))) moveReq.Header.Set("Content-Type", "application/json") moveRec := httptest.NewRecorder() router.ServeHTTP(moveRec, moveReq) @@ -277,7 +277,7 @@ func TestConfigMoveToProjectEndpoint(t *testing.T) { t.Fatalf("move config status=%d body=%s", moveRec.Code, moveRec.Body.String()) } - getReq := httptest.NewRequest(http.MethodGet, "/api/configs/"+created.UUID, nil) + getReq := httptest.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/configs/"+created.UUID, nil) getRec := httptest.NewRecorder() router.ServeHTTP(getRec, getReq) if getRec.Code != http.StatusOK { @@ -307,7 +307,7 @@ func TestVendorImportRejectsOversizedUpload(t *testing.T) { t.Fatalf("setup router: %v", err) } - createProjectReq := httptest.NewRequest(http.MethodPost, "/api/projects", bytes.NewReader([]byte(`{"name":"Import Project","code":"IMP"}`))) + createProjectReq := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects", bytes.NewReader([]byte(`{"name":"Import Project","code":"IMP"}`))) createProjectReq.Header.Set("Content-Type", "application/json") createProjectRec := httptest.NewRecorder() router.ServeHTTP(createProjectRec, createProjectReq) @@ -334,7 +334,7 @@ func TestVendorImportRejectsOversizedUpload(t *testing.T) { t.Fatalf("close multipart writer: %v", err) } - req := httptest.NewRequest(http.MethodPost, "/api/projects/"+project.UUID+"/vendor-import", &body) + req := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/projects/"+project.UUID+"/vendor-import", &body) req.Header.Set("Content-Type", writer.FormDataContentType()) rec := httptest.NewRecorder() router.ServeHTTP(rec, req) @@ -358,7 +358,7 @@ func TestCreateConfigMalformedJSONReturnsGenericError(t *testing.T) { t.Fatalf("setup router: %v", err) } - req := httptest.NewRequest(http.MethodPost, "/api/configs", bytes.NewReader([]byte(`{"name":`))) + req := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/configs", bytes.NewReader([]byte(`{"name":`))) req.Header.Set("Content-Type", "application/json") rec := httptest.NewRecorder() router.ServeHTTP(rec, req) diff --git a/internal/handlers/setup.go b/internal/handlers/setup.go index dec1f4a..567b268 100644 --- a/internal/handlers/setup.go +++ b/internal/handlers/setup.go @@ -82,11 +82,16 @@ func (h *SetupHandler) TestConnection(c *gin.Context) { port = p } - // If password is empty, try to use saved password - if password == "" { - if settings, err := h.localDB.GetSettings(); err == nil && settings != nil { - password = settings.PasswordEncrypted // GetSettings returns decrypted password in this field - } + settings, err := h.localDB.GetSettings() + if err != nil { + _ = c.Error(err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to read settings"}) + return + } + password, err = setupPassword(settings, host, port, user, password) + if err != nil { + c.JSON(http.StatusUnprocessableEntity, gin.H{"error": err.Error()}) + return } dsn := buildMySQLDSN(host, port, database, user, password, 5*time.Second) @@ -123,11 +128,10 @@ func (h *SetupHandler) SaveConnection(c *gin.Context) { port = p } - // If password is empty, use saved password - if password == "" { - if settings, err := h.localDB.GetSettings(); err == nil && settings != nil { - password = settings.PasswordEncrypted // GetSettings returns decrypted password in this field - } + password, err := setupPassword(existingSettings, host, port, user, password) + if err != nil { + c.JSON(http.StatusUnprocessableEntity, gin.H{"error": err.Error()}) + return } // Test connection first @@ -210,3 +214,14 @@ func buildMySQLDSN(host string, port int, database, user, password string, timeo } return cfg.FormatDSN() } + +// setupPassword reuses a credential only for its saved destination and account. +func setupPassword(saved *localdb.ConnectionSettings, host string, port int, user, password string) (string, error) { + if password != "" || saved == nil { + return password, nil + } + if saved.Host != host || saved.Port != port || saved.User != user { + return "", fmt.Errorf("Password is required when changing host, port or user") + } + return saved.PasswordEncrypted, nil +} diff --git a/internal/handlers/setup_password_test.go b/internal/handlers/setup_password_test.go new file mode 100644 index 0000000..50ebdbf --- /dev/null +++ b/internal/handlers/setup_password_test.go @@ -0,0 +1,31 @@ +package handlers + +import ( + "git.mchus.pro/mchus/quoteforge/internal/localdb" + "testing" +) + +func TestSetupPassword(t *testing.T) { + saved := &localdb.ConnectionSettings{Host: "db.example", Port: 3306, User: "example", PasswordEncrypted: "example"} + for _, tt := range []struct { + name, host, user, password string + port int + wantError bool + }{ + {"same destination", "db.example", "example", "", 3306, false}, + {"changed host", "other.example", "example", "", 3306, true}, + {"changed port", "db.example", "example", "", 3307, true}, + {"changed user", "db.example", "other", "", 3306, true}, + {"explicit password", "other.example", "other", "example", 3307, false}, + } { + t.Run(tt.name, func(t *testing.T) { + got, err := setupPassword(saved, tt.host, tt.port, tt.user, tt.password) + if (err != nil) != tt.wantError { + t.Fatalf("unexpected error: %v", err) + } + if !tt.wantError && got != "example" { + t.Fatal("credential not preserved") + } + }) + } +} diff --git a/internal/middleware/cors.go b/internal/middleware/cors.go index 85311dc..251e122 100644 --- a/internal/middleware/cors.go +++ b/internal/middleware/cors.go @@ -1,6 +1,7 @@ package middleware import ( + "mime" "net" "net/http" "net/url" @@ -11,6 +12,19 @@ import ( func CORS() gin.HandlerFunc { return func(c *gin.Context) { + hostURL, hostErr := url.Parse("http://" + c.Request.Host) + if hostErr != nil || hostURL.Host != c.Request.Host || hostURL.Path != "" || hostURL.RawQuery != "" || !isLoopbackOrigin("http://"+c.Request.Host) { + c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"error": "Invalid request host"}) + return + } + if c.GetHeader("Sec-Fetch-Site") == "cross-site" { + c.AbortWithStatus(http.StatusForbidden) + return + } + if referer := c.GetHeader("Referer"); referer != "" && !isLoopbackOrigin(referer) { + c.AbortWithStatus(http.StatusForbidden) + return + } origin := strings.TrimSpace(c.GetHeader("Origin")) if origin != "" { if isLoopbackOrigin(origin) { @@ -20,7 +34,7 @@ func CORS() gin.HandlerFunc { c.Header("Access-Control-Allow-Headers", "Origin, Content-Type, Accept, Authorization") c.Header("Access-Control-Expose-Headers", "Content-Length, Content-Disposition") c.Header("Access-Control-Max-Age", "86400") - } else if c.Request.Method == http.MethodOptions { + } else { c.AbortWithStatus(http.StatusForbidden) return } @@ -30,6 +44,15 @@ func CORS() gin.HandlerFunc { c.AbortWithStatus(http.StatusNoContent) return } + if c.Request.Method != http.MethodGet && c.Request.Method != http.MethodHead && + strings.HasPrefix(c.Request.URL.Path, "/api/") && c.Request.ContentLength != 0 { + mediaType, _, err := mime.ParseMediaType(c.GetHeader("Content-Type")) + isUpload := strings.HasPrefix(c.FullPath(), "/api/projects/") && strings.HasSuffix(c.FullPath(), "/vendor-import") + if err != nil || (mediaType != "application/json" && !(isUpload && mediaType == "multipart/form-data")) { + c.AbortWithStatusJSON(http.StatusUnsupportedMediaType, gin.H{"error": "Unsupported content type"}) + return + } + } c.Next() } @@ -43,6 +66,9 @@ func isLoopbackOrigin(origin string) bool { if u.Scheme != "http" && u.Scheme != "https" { return false } + if u.User != nil || u.Opaque != "" { + return false + } host := strings.TrimSpace(u.Hostname()) if host == "" { return false diff --git a/internal/middleware/cors_test.go b/internal/middleware/cors_test.go new file mode 100644 index 0000000..6e8983e --- /dev/null +++ b/internal/middleware/cors_test.go @@ -0,0 +1,66 @@ +package middleware + +import ( + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/gin-gonic/gin" +) + +func TestLocalRequestBoundary(t *testing.T) { + gin.SetMode(gin.TestMode) + tests := []struct { + name, method, path, host, origin, referer, fetchSite, contentType, body string + want int + }{ + {name: "CLI JSON", method: "POST", contentType: "application/json", body: "{}", want: 200}, + {name: "local browser", method: "POST", origin: "http://localhost:8080", contentType: "application/json; charset=utf-8", body: "{}", want: 200}, + {name: "foreign form", method: "POST", path: "/setup", origin: "https://attacker.example", contentType: "application/x-www-form-urlencoded", body: "host=example", want: 403}, + {name: "foreign JSON", method: "POST", origin: "https://attacker.example", contentType: "text/plain", body: "{}", want: 403}, + {name: "rebind read", method: "GET", host: "attacker.example:8080", want: 403}, + {name: "null origin", method: "POST", origin: "null", want: 403}, + {name: "foreign referer", method: "POST", referer: "https://attacker.example/page", want: 403}, + {name: "cross site", method: "POST", fetchSite: "cross-site", want: 403}, + {name: "plain JSON", method: "POST", contentType: "text/plain", body: "{}", want: 415}, + {name: "API form", method: "POST", contentType: "application/x-www-form-urlencoded", body: "x=y", want: 415}, + {name: "setup form", method: "POST", path: "/setup", origin: "http://127.0.0.1:8080", contentType: "application/x-www-form-urlencoded", body: "host=example", want: 200}, + {name: "upload", method: "POST", path: "/api/projects/id/vendor-import", contentType: "multipart/form-data; boundary=example", body: "example", want: 200}, + {name: "multipart JSON route", method: "POST", contentType: "multipart/form-data; boundary=example", body: "example", want: 415}, + {name: "bodyless action", method: "POST", want: 200}, + {name: "local preflight", method: "OPTIONS", origin: "http://localhost:8080", want: 204}, + {name: "foreign preflight", method: "OPTIONS", origin: "https://attacker.example", want: 403}, + {name: "IPv6", method: "GET", host: "[::1]:8080", want: 200}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + router := gin.New() + router.Use(CORS()) + called := false + handler := func(c *gin.Context) { called = true; c.Status(200) } + router.Any("/api/configs", handler) + router.Any("/setup", handler) + router.POST("/api/projects/:uuid/vendor-import", handler) + path := tt.path + if path == "" { + path = "/api/configs" + } + req := httptest.NewRequest(tt.method, path, strings.NewReader(tt.body)) + req.Host = tt.host + if req.Host == "" { + req.Host = "127.0.0.1:8080" + } + for key, value := range map[string]string{"Origin": tt.origin, "Referer": tt.referer, "Sec-Fetch-Site": tt.fetchSite, "Content-Type": tt.contentType} { + if value != "" { + req.Header.Set(key, value) + } + } + w := httptest.NewRecorder() + router.ServeHTTP(w, req) + if w.Code != tt.want || called != (tt.want == http.StatusOK) { + t.Fatalf("status=%d called=%v, want %d", w.Code, called, tt.want) + } + }) + } +}