Skip to content

Commit 68f009f

Browse files
author
Loïc Dachary
committed
Merge remote-tracking branch 'forgejo/v1.18/forgejo-development' into v1.18/forgejo
2 parents 17d62fa + 1a5a50c commit 68f009f

File tree

8 files changed

+19
-7
lines changed

8 files changed

+19
-7
lines changed

custom/conf/app.example.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ INTERNAL_TOKEN=
439439
;;Classes include "lower,upper,digit,spec"
440440
;PASSWORD_COMPLEXITY = off
441441
;;
442-
;; Password Hash algorithm, either "argon2", "pbkdf2", "scrypt" or "bcrypt"
443-
;PASSWORD_HASH_ALGO = pbkdf2
442+
;; Password Hash algorithm, either "argon2", "pbkdf2"/"pbkdf2_v2", "pbkdf2_hi", "scrypt" or "bcrypt"
443+
;PASSWORD_HASH_ALGO = pbkdf2_hi
444444
;;
445445
;; Set false to allow JavaScript to read CSRF cookie
446446
;CSRF_COOKIE_HTTP_ONLY = true

modules/auth/password/hash/setting.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

44
package hash
55

6-
const DefaultHashAlgorithmName = "pbkdf2"
6+
// DefaultHashAlgorithmName represents the default value of PASSWORD_HASH_ALGO
7+
// configured in app.ini.
8+
//
9+
// It is NOT the same and does NOT map to the defaultEmptyHashAlgorithmSpecification.
10+
//
11+
// It will be dealiased as per aliasAlgorithmNames whereas
12+
// defaultEmptyHashAlgorithmSpecification does not undergo dealiasing.
13+
const DefaultHashAlgorithmName = "pbkdf2_hi"
714

815
var DefaultHashAlgorithm *PasswordHashAlgorithm
916

modules/auth/password/hash/setting_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ func TestCheckSettingPasswordHashAlgorithm(t *testing.T) {
2828
})
2929
}
3030

31-
t.Run("pbkdf2_v2 is the default when default password hash algorithm is empty", func(t *testing.T) {
31+
t.Run("pbkdf2_hi is the default when default password hash algorithm is empty", func(t *testing.T) {
3232
emptyConfig, emptyAlgo := SetDefaultPasswordHashAlgorithm("")
33-
pbkdf2v2Config, pbkdf2v2Algo := SetDefaultPasswordHashAlgorithm("pbkdf2_v2")
33+
pbkdf2hiConfig, pbkdf2hiAlgo := SetDefaultPasswordHashAlgorithm("pbkdf2_hi")
3434

35-
assert.Equal(t, pbkdf2v2Config, emptyConfig)
36-
assert.Equal(t, pbkdf2v2Algo.Name, emptyAlgo.Name)
35+
assert.Equal(t, pbkdf2hiConfig, emptyConfig)
36+
assert.Equal(t, pbkdf2hiAlgo.Name, emptyAlgo.Name)
3737
})
3838
}

tests/mssql.ini.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ COLORIZE = true
9898
LEVEL = Debug
9999

100100
[security]
101+
PASSWORD_HASH_ALGO = argon2
101102
DISABLE_GIT_HOOKS = false
102103
INSTALL_LOCK = true
103104
SECRET_KEY = 9pCviYTWSb

tests/mysql.ini.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ COLORIZE = true
117117
LEVEL = Debug
118118

119119
[security]
120+
PASSWORD_HASH_ALGO = argon2
120121
DISABLE_GIT_HOOKS = false
121122
INSTALL_LOCK = true
122123
SECRET_KEY = 9pCviYTWSb

tests/mysql8.ini.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ COLORIZE = true
9595
LEVEL = Debug
9696

9797
[security]
98+
PASSWORD_HASH_ALGO = argon2
9899
DISABLE_GIT_HOOKS = false
99100
INSTALL_LOCK = true
100101
SECRET_KEY = 9pCviYTWSb

tests/pgsql.ini.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ COLORIZE = true
9999
LEVEL = Debug
100100

101101
[security]
102+
PASSWORD_HASH_ALGO = argon2
102103
DISABLE_GIT_HOOKS = false
103104
INSTALL_LOCK = true
104105
SECRET_KEY = 9pCviYTWSb

tests/sqlite.ini.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ COLORIZE = true
9494
LEVEL = Debug
9595

9696
[security]
97+
PASSWORD_HASH_ALGO = argon2
9798
DISABLE_GIT_HOOKS = false
9899
INSTALL_LOCK = true
99100
SECRET_KEY = 9pCviYTWSb

0 commit comments

Comments
 (0)