Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
365e1a3e01 |
No files matched your search
@@ -780,8 +780,8 @@ On a hostname that gets gitea's fixes, an app other than gitea must check these
|
|||||||
fields and cookies itself. Listing each hostname's own apps in `SWW_APPS` keeps
|
fields and cookies itself. Listing each hostname's own apps in `SWW_APPS` keeps
|
||||||
the full check for the others.
|
the full check for the others.
|
||||||
|
|
||||||
The parameter names in these changes and fixes are matched without regard to
|
The parameter and cookie names in these changes and fixes are matched without
|
||||||
case, and the cookie names exactly.
|
regard to case, as Coraza matches them.
|
||||||
|
|
||||||
### Ban lengths, response and scope
|
### Ban lengths, response and scope
|
||||||
|
|
||||||
|
|||||||
@@ -792,18 +792,15 @@ func (e *environment) pathPrefixes(name, defaultValue string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apps reads the setting that is the apps each hostname serves. It is nil
|
// apps reads the setting that is the apps each hostname serves. It is nil
|
||||||
// while the setting is unset, and logged as null, unlike a setting set
|
// while the setting is unset.
|
||||||
// empty.
|
|
||||||
func (e *environment) apps(name string) map[string][]string {
|
func (e *environment) apps(name string) map[string][]string {
|
||||||
value, set := e.lookup(name)
|
value, set := e.lookup(name)
|
||||||
if !set {
|
e.settings = append(e.settings, slog.String(name, value))
|
||||||
e.settings = append(e.settings, slog.Any(name, nil))
|
|
||||||
|
|
||||||
|
if !set {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
e.settings = append(e.settings, slog.String(name, value))
|
|
||||||
|
|
||||||
apps, err := parseApps(value)
|
apps, err := parseApps(value)
|
||||||
e.check(name, err)
|
e.check(name, err)
|
||||||
|
|
||||||
|
|||||||
@@ -600,28 +600,6 @@ func TestApps(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unset and set empty, SWW_APPS has opposite effects, so it logs differently.
|
|
||||||
func TestUnsetAndEmptyAppsAreLoggedDifferently(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
for _, tc := range []struct {
|
|
||||||
env environment
|
|
||||||
want string
|
|
||||||
}{
|
|
||||||
{environment{}, `"` + apps + `":null`},
|
|
||||||
{environment{apps: ""}, `"` + apps + `":""`},
|
|
||||||
} {
|
|
||||||
var out bytes.Buffer
|
|
||||||
|
|
||||||
slog.New(slog.NewJSONHandler(&out, nil)).
|
|
||||||
Info("starting", "settings", fromEnvironment(t, tc.env))
|
|
||||||
|
|
||||||
if !strings.Contains(out.String(), tc.want) {
|
|
||||||
t.Errorf("%v logged %s, want %s in it", tc.env, out.String(), tc.want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestInvalidAppsStopsTheStart(t *testing.T) {
|
func TestInvalidAppsStopsTheStart(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -2419,7 +2397,7 @@ func TestLogsEachSettingWithItsValue(t *testing.T) {
|
|||||||
wafExemptPaths: "",
|
wafExemptPaths: "",
|
||||||
wafBodyLimit: off,
|
wafBodyLimit: off,
|
||||||
exclusionsFile: "",
|
exclusionsFile: "",
|
||||||
apps: "", // logged as null, which decodes as ""
|
apps: "",
|
||||||
trapPaths: "",
|
trapPaths: "",
|
||||||
errorBurstThreshold: "30",
|
errorBurstThreshold: "30",
|
||||||
logRemoteURL: "",
|
logRemoteURL: "",
|
||||||
|
|||||||
Reference in new issue
Block a user