1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Disable signature checking if key or salt are not provided

This commit is contained in:
DarthSim 2018-09-13 01:14:43 +06:00
parent 017724d20d
commit 945ffb485b
2 changed files with 9 additions and 14 deletions

View File

@ -121,8 +121,8 @@ imgproxy is [Twelve-Factor-App](https://12factor.net/)-ready and can be configur
imgproxy requires all URLs to be signed with a key and salt:
* `IMGPROXY_KEY`(**required**) hex-encoded key;
* `IMGPROXY_SALT`(**required**) hex-encoded salt;
* `IMGPROXY_KEY` — hex-encoded key;
* `IMGPROXY_SALT` — hex-encoded salt;
You can also specify paths to files with a hex-encoded key and salt (useful in a development environment):

View File

@ -118,8 +118,6 @@ type config struct {
MaxSrcDimension int
MaxSrcResolution int
AllowInsecure bool
JpegProgressive bool
PngInterlaced bool
Quality int
@ -128,8 +126,9 @@ type config struct {
EnableWebpDetection bool
EnforceWebp bool
Key []byte
Salt []byte
Key []byte
Salt []byte
AllowInsecure bool
Secret string
@ -190,8 +189,6 @@ func init() {
intEnvConfig(&conf.MaxSrcDimension, "IMGPROXY_MAX_SRC_DIMENSION")
megaIntEnvConfig(&conf.MaxSrcResolution, "IMGPROXY_MAX_SRC_RESOLUTION")
boolEnvConfig(&conf.AllowInsecure, "IMGPROXY_ALLOW_INSECURE")
boolEnvConfig(&conf.JpegProgressive, "IMGPROXY_JPEG_PROGRESSIVE")
boolEnvConfig(&conf.PngInterlaced, "IMGPROXY_PNG_INTERLACED")
intEnvConfig(&conf.Quality, "IMGPROXY_QUALITY")
@ -223,10 +220,12 @@ func init() {
presetFileConfig(conf.Presets, *presetsPath)
if len(conf.Key) == 0 {
log.Fatalln("Key is not defined")
warning("Key is not defined, so signature checking is disabled")
conf.AllowInsecure = true
}
if len(conf.Salt) == 0 {
log.Fatalln("Salt is not defined")
warning("Salt is not defined, so signature checking is disabled")
conf.AllowInsecure = true
}
if len(conf.Bind) == 0 {
@ -265,10 +264,6 @@ func init() {
log.Fatalf("Max src resolution should be greater than 0, now - %d\n", conf.MaxSrcResolution)
}
if conf.AllowInsecure {
warning("Token validation is disabled. Hope you know what you're doing")
}
if conf.Quality <= 0 {
log.Fatalf("Quality should be greater than 0, now - %d\n", conf.Quality)
} else if conf.Quality > 100 {