Skip to content

Commit 5a7bacb

Browse files
authored
Warn that DISABLE_QUERY_AUTH_TOKEN is false only if it's explicitly defined (#28783)
So we don't warn on default behavior - Fixes #28758 - Follows #28390 Signed-off-by: Yarden Shoham <git@yardenshoham.com>
1 parent fa8c3be commit 5a7bacb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/setting/security.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,13 @@ func loadSecurityFrom(rootCfg ConfigProvider) {
159159
}
160160
}
161161

162+
sectionHasDisableQueryAuthToken := sec.HasKey("DISABLE_QUERY_AUTH_TOKEN")
163+
162164
// TODO: default value should be true in future releases
163165
DisableQueryAuthToken = sec.Key("DISABLE_QUERY_AUTH_TOKEN").MustBool(false)
164166

165-
if !DisableQueryAuthToken {
167+
// warn if the setting is set to false explicitly
168+
if sectionHasDisableQueryAuthToken && !DisableQueryAuthToken {
166169
log.Warn("Enabling Query API Auth tokens is not recommended. DISABLE_QUERY_AUTH_TOKEN will default to true in gitea 1.23 and will be removed in gitea 1.24.")
167170
}
168171
}

0 commit comments

Comments
 (0)