mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-24 08:12:38 +02:00
Deprecate IMGPROXY_MAX_SRC_DIMENSION
This commit is contained in:
parent
288cdc76fb
commit
917357616e
@ -200,7 +200,6 @@ var conf = config{
|
||||
Concurrency: runtime.NumCPU() * 2,
|
||||
TTL: 3600,
|
||||
IgnoreSslVerification: false,
|
||||
MaxSrcDimension: 8192,
|
||||
MaxSrcResolution: 16800000,
|
||||
AllowInsecure: false,
|
||||
SignatureSize: 32,
|
||||
@ -341,8 +340,10 @@ func init() {
|
||||
log.Fatalf("TTL should be greater than 0, now - %d\n", conf.TTL)
|
||||
}
|
||||
|
||||
if conf.MaxSrcDimension <= 0 {
|
||||
log.Fatalf("Max src dimension should be greater than 0, now - %d\n", conf.MaxSrcDimension)
|
||||
if conf.MaxSrcDimension < 0 {
|
||||
log.Fatalf("Max src dimension should be greater than or equal to 0, now - %d\n", conf.MaxSrcDimension)
|
||||
} else if conf.MaxSrcDimension > 0 {
|
||||
warning("IMGPROXY_MAX_SRC_DIMENSION is deprecated and can be removed in future versions. Use IMGPROXY_MAX_SRC_RESOLUTION")
|
||||
}
|
||||
|
||||
if conf.MaxSrcResolution <= 0 {
|
||||
|
@ -38,9 +38,8 @@ $ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
||||
|
||||
### Security
|
||||
|
||||
imgproxy protects you from so-called image bombs. Here is how you can specify maximum image dimensions and resolution which you consider reasonable:
|
||||
imgproxy protects you from so-called image bombs. Here is how you can specify maximum image resolution which you consider reasonable:
|
||||
|
||||
* `IMGPROXY_MAX_SRC_DIMENSION`: the maximum dimensions of the source image, in pixels, for both width and height. Images with larger actual size will be rejected. Default: `8192`;
|
||||
* `IMGPROXY_MAX_SRC_RESOLUTION`: the maximum resolution of the source image, in megapixels. Images with larger actual size will be rejected. Default: `16.8`;
|
||||
|
||||
You can also specify a secret to enable authorization with the HTTP `Authorization` header for use in production environments:
|
||||
|
@ -64,7 +64,7 @@ func initDownloading() {
|
||||
}
|
||||
|
||||
func checkDimensions(width, height int) error {
|
||||
if width > conf.MaxSrcDimension || height > conf.MaxSrcDimension {
|
||||
if conf.MaxSrcDimension > 0 && (width > conf.MaxSrcDimension || height > conf.MaxSrcDimension) {
|
||||
return errSourceDimensionsTooBig
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user