env.disposition took its default as a string, and the call passed the literal "allow", so the default was the one disposition parameter still untyped. It now takes a wafprotocol.Disposition, as bytesCounted, coreRuleSetMode and lookupSource take their types, and the call passes wafprotocol.DispositionAllow. Model: opus-5-5
This commit is contained in:
1 parent
de78a12801
commit
345de824ef
1 file changed
+3
-3
@@ -96,7 +96,7 @@ func RProxyFromEnvironment(v *viper.Viper) (*RProxy, error) {
|
|||||||
),
|
),
|
||||||
WAFBackendNoAnswerDisposition: env.disposition(
|
WAFBackendNoAnswerDisposition: env.disposition(
|
||||||
"SWW_RPROXY_WAF_BACKEND_NO_ANSWER_DISPOSITION",
|
"SWW_RPROXY_WAF_BACKEND_NO_ANSWER_DISPOSITION",
|
||||||
"allow",
|
wafprotocol.DispositionAllow,
|
||||||
),
|
),
|
||||||
MaxRequestSize: env.size("SWW_RPROXY_MAX_REQUEST_SIZE", "100M"),
|
MaxRequestSize: env.size("SWW_RPROXY_MAX_REQUEST_SIZE", "100M"),
|
||||||
MaxResponseSize: env.size("SWW_RPROXY_MAX_RESPONSE_SIZE", "1G"),
|
MaxResponseSize: env.size("SWW_RPROXY_MAX_RESPONSE_SIZE", "1G"),
|
||||||
@@ -169,9 +169,9 @@ func (e *environment) wafBackend(name string) *url.URL {
|
|||||||
// cannot be connected to, does not answer at all, or does not answer in time:
|
// cannot be connected to, does not answer at all, or does not answer in time:
|
||||||
// allow or deny.
|
// allow or deny.
|
||||||
func (e *environment) disposition(
|
func (e *environment) disposition(
|
||||||
name, defaultValue string,
|
name string, defaultValue wafprotocol.Disposition,
|
||||||
) wafprotocol.Disposition {
|
) wafprotocol.Disposition {
|
||||||
value := wafprotocol.Disposition(e.value(name, defaultValue))
|
value := wafprotocol.Disposition(e.value(name, string(defaultValue)))
|
||||||
if value != wafprotocol.DispositionAllow &&
|
if value != wafprotocol.DispositionAllow &&
|
||||||
value != wafprotocol.DispositionDeny {
|
value != wafprotocol.DispositionDeny {
|
||||||
e.check(name, fmt.Errorf("%q %w", value, errNotDisposition))
|
e.check(name, fmt.Errorf("%q %w", value, errNotDisposition))
|
||||||
|
|||||||
Reference in new issue
Block a user