fix(billing): validate quantity parameters and harden quota calculations
Bound user-supplied count/duration parameters at request validation, route ratio multipliers through guarded setters, and use saturating int conversions in all quota math paths.
This commit is contained in:
@@ -11,6 +11,10 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// MaxImageN caps the image generation count. Without this bound a huge or
|
||||
// wrapped-negative n overflows quota calculation into a negative charge.
|
||||
const MaxImageN = 128
|
||||
|
||||
type ImageRequest struct {
|
||||
Model string `json:"model"`
|
||||
Prompt string `json:"prompt" binding:"required"`
|
||||
|
||||
Reference in New Issue
Block a user