Skip to content

Commit e3dfb51

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: modules/setting/security.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,13 @@ func loadSecurityFrom(rootCfg ConfigProvider) {
161161
}
162162
}
163163

164+
sectionHasDisableQueryAuthToken := sec.HasKey("DISABLE_QUERY_AUTH_TOKEN")
165+
164166
// TODO: default value should be true in future releases
165167
DisableQueryAuthToken = sec.Key("DISABLE_QUERY_AUTH_TOKEN").MustBool(false)
166168

167-
if !DisableQueryAuthToken {
169+
// warn if the setting is set to false explicitly
170+
if sectionHasDisableQueryAuthToken && !DisableQueryAuthToken {
168171
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.")
169172
}
170173
}

0 commit comments

Comments
 (0)