mirror of
https://github.com/alireza0/s-ui.git
synced 2026-11-16 21:17:17 +00:00
Two UnmarshalJSON implementations asserted raw["tag"] directly while every sibling type in the same package uses the comma-ok form: database/model/outbounds.go: o.Tag = raw["tag"].(string) database/model/endpoints.go: o.Tag = raw["tag"].(string) A saved outbound/endpoint whose tag is missing or not a string -- hand-written API call, import script, third-party client; the panel UI always sends one -- panicked the api/save and apiv2/save handlers (gin's Recovery turns it into a 500 and a stack trace in the log). Same class as #1296. service/warp.go trusted the Cloudflare client API's response shape the same way, in the WARP registration flow an admin runs from the endpoints page: - rspData["id"] / ["token"] bare assertions - rspData["account"] asserted before the license lookup, so a missing account panicked before the existing ok check ran - warpConfig["peers"][0] indexed without a length check, so a response with no peers panicked - the error path in SetWarpLicense indexed response["errors"][0] bare, so a failed response with an empty or missing errors array panicked instead of returning the error it exists for All of them now use comma-ok assertions and return a warp error, like the license check already did. Regression tests cover the two UnmarshalJSON cases (missing, numeric, null and object tags, plus the normal string case); the WARP paths need the live Cloudflare API, so they are covered by inspection and go vet. Prepared by muse ai |
||
|---|---|---|
| .. | ||
| model | ||
| backup.go | ||
| backup_test.go | ||
| db.go | ||
| schema.go | ||