fix: safe type assertions across OAuth, model Scan, relay, and middleware
- OAuth: safe type assertions for session state and affiliate code (oauth.go, github.go, discord.go, linuxdo.go, oidc.go) - Model: Scan() methods handle string values from DB drivers, not just []byte (channel.go ChannelInfo, task.go Properties/TaskPrivateData) - Model: safe type assertion in CleanupChannelPollingLocks sync.Map iteration - Relay: safe type assertions in audio_handler, AWS InvokeModel, ollama ConvertClaudeRequest, claude stop sequences, zhipu token cache - Service: fix slice bounds panic in Gemini->OpenAI stop sequences conversion - Service: safe type assertion in CleanupFileSources middleware - Middleware: add missing c.Abort() in turnstile session save failure - Middleware: safe type assertion in distributor channelId - Middleware: safe int comparison in auth helper Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,8 @@ func authHelper(c *gin.Context, minRole int) {
|
||||
return
|
||||
|
||||
}
|
||||
if id != apiUserId {
|
||||
idVal, _ := id.(int)
|
||||
if idVal != apiUserId {
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"success": false,
|
||||
"message": common.TranslateMessage(c, i18n.MsgAuthUserIdMismatch),
|
||||
|
||||
Reference in New Issue
Block a user