File tree 6 files changed +13
-19
lines changed
modules/auth/password/pwn
6 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ require (
16
16
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4
17
17
github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121
18
18
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
19
+ github.com/ProtonMail/go-crypto v1.0.0
19
20
github.com/PuerkitoBio/goquery v1.9.1
20
21
github.com/alecthomas/chroma/v2 v2.13.0
21
22
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
@@ -135,7 +136,6 @@ require (
135
136
github.com/Masterminds/semver/v3 v3.2.1 // indirect
136
137
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
137
138
github.com/Microsoft/go-winio v0.6.1 // indirect
138
- github.com/ProtonMail/go-crypto v1.0.0 // indirect
139
139
github.com/RoaringBitmap/roaring v1.9.0 // indirect
140
140
github.com/andybalholm/brotli v1.1.0 // indirect
141
141
github.com/andybalholm/cascadia v1.3.2 // indirect
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ package user_test
5
5
6
6
import (
7
7
"context"
8
+ "crypto/rand"
8
9
"fmt"
9
- "math/rand"
10
10
"strings"
11
11
"testing"
12
12
"time"
Original file line number Diff line number Diff line change 4
4
package pwn
5
5
6
6
import (
7
- "math/rand"
7
+ "math/rand/v2 "
8
8
"net/http"
9
- "os"
10
9
"strings"
11
10
"testing"
12
11
"time"
@@ -18,11 +17,6 @@ var client = New(WithHTTP(&http.Client{
18
17
Timeout : time .Second * 2 ,
19
18
}))
20
19
21
- func TestMain (m * testing.M ) {
22
- rand .Seed (time .Now ().Unix ())
23
- os .Exit (m .Run ())
24
- }
25
-
26
20
func TestPassword (t * testing.T ) {
27
21
// Check input error
28
22
_ , err := client .CheckPassword ("" , false )
@@ -81,24 +75,24 @@ func testPassword() string {
81
75
82
76
// Set special character
83
77
for i := 0 ; i < 5 ; i ++ {
84
- random := rand .Intn (len (specialCharSet ))
78
+ random := rand .IntN (len (specialCharSet ))
85
79
password .WriteString (string (specialCharSet [random ]))
86
80
}
87
81
88
82
// Set numeric
89
83
for i := 0 ; i < 5 ; i ++ {
90
- random := rand .Intn (len (numberSet ))
84
+ random := rand .IntN (len (numberSet ))
91
85
password .WriteString (string (numberSet [random ]))
92
86
}
93
87
94
88
// Set uppercase
95
89
for i := 0 ; i < 5 ; i ++ {
96
- random := rand .Intn (len (upperCharSet ))
90
+ random := rand .IntN (len (upperCharSet ))
97
91
password .WriteString (string (upperCharSet [random ]))
98
92
}
99
93
100
94
for i := 0 ; i < 5 ; i ++ {
101
- random := rand .Intn (len (allCharSet ))
95
+ random := rand .IntN (len (allCharSet ))
102
96
password .WriteString (string (allCharSet [random ]))
103
97
}
104
98
inRune := []rune (password .String ())
Original file line number Diff line number Diff line change 4
4
package integration
5
5
6
6
import (
7
- "math/rand"
7
+ "math/rand/v2 "
8
8
"net/http"
9
9
"net/url"
10
10
"testing"
@@ -18,7 +18,7 @@ import (
18
18
func StringWithCharset (length int , charset string ) string {
19
19
b := make ([]byte , length )
20
20
for i := range b {
21
- b [i ] = charset [rand .Intn (len (charset ))]
21
+ b [i ] = charset [rand .IntN (len (charset ))]
22
22
}
23
23
return string (b )
24
24
}
@@ -37,7 +37,7 @@ func BenchmarkRepoBranchCommit(b *testing.B) {
37
37
b .ResetTimer ()
38
38
b .Run ("CreateBranch" , func (b * testing.B ) {
39
39
b .StopTimer ()
40
- branchName := StringWithCharset (5 + rand .Intn (10 ), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" )
40
+ branchName := StringWithCharset (5 + rand .IntN (10 ), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" )
41
41
b .StartTimer ()
42
42
for i := 0 ; i < b .N ; i ++ {
43
43
b .Run ("new_" + branchName , func (b * testing.B ) {
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ package integration
5
5
6
6
import (
7
7
"bytes"
8
+ "crypto/rand"
8
9
"encoding/hex"
9
10
"fmt"
10
- "math/rand"
11
11
"net/http"
12
12
"net/url"
13
13
"os"
Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ import (
19
19
"code.gitea.io/gitea/modules/test"
20
20
"code.gitea.io/gitea/tests"
21
21
22
+ "github.com/ProtonMail/go-crypto/openpgp"
23
+ "github.com/ProtonMail/go-crypto/openpgp/armor"
22
24
"github.com/stretchr/testify/assert"
23
- "golang.org/x/crypto/openpgp"
24
- "golang.org/x/crypto/openpgp/armor"
25
25
)
26
26
27
27
func TestGPGGit (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments