Skip to content

Commit 3abb114

Browse files
Merge branch 'main' into main
2 parents 70b25d4 + 815d267 commit 3abb114

File tree

130 files changed

+1242
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1242
-1088
lines changed

.github/ISSUE_TEMPLATE/bug-report.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Bug Report
22
description: Found something you weren't expecting? Report it here!
3-
labels: kind/bug
3+
labels: ["kind/bug"]
44
body:
55
- type: markdown
66
attributes:
@@ -15,11 +15,8 @@ body:
1515
3. Make sure you are using the latest release and
1616
take a moment to check that your issue hasn't been reported before.
1717
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
18-
5. Please give all relevant information below for bug reports, because
18+
5. It's really important to provide pertinent details and logs (https://docs.gitea.com/help/support),
1919
incomplete details will be handled as an invalid report.
20-
6. In particular it's really important to provide pertinent logs. You must give us DEBUG level logs.
21-
Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help
22-
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
2320
- type: textarea
2421
id: description
2522
attributes:
@@ -89,6 +86,6 @@ body:
8986
description: What database system are you running?
9087
options:
9188
- PostgreSQL
92-
- MySQL
89+
- MySQL/MariaDB
9390
- MSSQL
9491
- SQLite

.github/workflows/files-changed.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
- "go.mod"
4444
- "go.sum"
4545
- "Makefile"
46+
- ".golangci.yml"
47+
- ".editorconfig"
4648
4749
frontend:
4850
- "**/*.js"
@@ -51,16 +53,21 @@ jobs:
5153
- "package.json"
5254
- "package-lock.json"
5355
- "Makefile"
56+
- ".eslintrc.yaml"
57+
- ".stylelintrc.yaml"
58+
- ".npmrc"
5459
5560
docs:
5661
- "**/*.md"
5762
- "docs/**"
63+
- ".markdownlint.yaml"
5864
5965
actions:
6066
- ".github/workflows/*"
6167
6268
templates:
6369
- "templates/**/*.tmpl"
70+
- "pyproject.toml"
6471
- "poetry.lock"
6572
6673
docker:
@@ -72,3 +79,6 @@ jobs:
7279
swagger:
7380
- "templates/swagger/v1_json.tmpl"
7481
- "Makefile"
82+
- "package.json"
83+
- "package-lock.json"
84+
- ".spectral.yml"

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ linters:
2929
fast: false
3030

3131
run:
32-
go: "1.20"
32+
go: "1.21"
3333
timeout: 10m
3434
skip-dirs:
3535
- node_modules
@@ -75,7 +75,7 @@ linters-settings:
7575
- name: modifies-value-receiver
7676
gofumpt:
7777
extra-rules: true
78-
lang-version: "1.20"
78+
lang-version: "1.21"
7979
depguard:
8080
rules:
8181
main:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ or if SQLite support is required:
7979

8080
The `build` target is split into two sub-targets:
8181

82-
- `make backend` which requires [Go Stable](https://go.dev/dl/), required version is defined in [go.mod](/go.mod).
83-
- `make frontend` which requires [Node.js LTS](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
82+
- `make backend` which requires [Go Stable](https://go.dev/dl/), the required version is defined in [go.mod](/go.mod).
83+
- `make frontend` which requires [Node.js LTS](https://nodejs.org/en/download/) or greater.
8484

85-
When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js and Internet connectivity.
85+
Internet connectivity is required to download the go and npm modules. When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js.
8686

8787
Parallelism (`make -j <num>`) is not supported.
8888

cmd/cert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
4343
},
4444
&cli.IntFlag{
4545
Name: "rsa-bits",
46-
Value: 2048,
46+
Value: 3072,
4747
Usage: "Size of RSA key to generate. Ignored if --ecdsa-curve is set",
4848
},
4949
&cli.StringFlag{

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ LEVEL = Info
13391339
;; Define allowed algorithms and their minimum key length (use -1 to disable a type)
13401340
;ED25519 = 256
13411341
;ECDSA = 256
1342-
;RSA = 2047 ; we allow 2047 here because an otherwise valid 2048 bit RSA key can be reported as having 2047 bit length
1342+
;RSA = 3071 ; we allow 3071 here because an otherwise valid 3072 bit RSA key can be reported as having 3071 bit length
13431343
;DSA = -1 ; set to 1024 to switch on
13441344

13451345
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docker/root/etc/s6/openssh/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111

1212
if [ ! -f /data/ssh/ssh_host_rsa_key ]; then
1313
echo "Generating /data/ssh/ssh_host_rsa_key..."
14-
ssh-keygen -t rsa -b 2048 -f /data/ssh/ssh_host_rsa_key -N "" > /dev/null
14+
ssh-keygen -t rsa -b 3072 -f /data/ssh/ssh_host_rsa_key -N "" > /dev/null
1515
fi
1616

1717
if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then

docs/content/administration/command-line.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ directory and will overwrite any existing files.
313313
- `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options
314314
are P224, P256, P384, P521.
315315
- `--rsa-bits value`: Size of RSA key to generate. Optional. Ignored if --ecdsa-curve is
316-
set. (default: 2048).
316+
set. (default: 3072).
317317
- `--start-date value`: Creation date. Optional. (format: `Jan 1 15:04:05 2011`).
318318
- `--duration value`: Duration which the certificate is valid for. Optional. (default: 8760h0m0s)
319319
- `--ca`: If provided, this cert generates it's own certificate authority. Optional.

docs/content/administration/command-line.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ menu:
295295
- 选项:
296296
- `--host value`:逗号分隔的主机名和IP地址列表,此证书适用于这些主机。支持使用通配符。必填。
297297
- `--ecdsa-curve value`:用于生成密钥的ECDSA曲线。可选。有效选项为P224、P256、P384、P521。
298-
- `--rsa-bits value`:要生成的RSA密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:2048)。
298+
- `--rsa-bits value`:要生成的RSA密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:3072)。
299299
- `--start-date value`:证书的创建日期。可选。(格式:`Jan 1 15:04:05 2011`)。
300300
- `--duration value`:证书有效期。可选。(默认值:8760h0m0s)
301301
- `--ca`:如果提供此选项,则证书将生成自己的证书颁发机构。可选。

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
681681

682682
- `ED25519`: **256**
683683
- `ECDSA`: **256**
684-
- `RSA`: **2047**: We set 2047 here because an otherwise valid 2048 RSA key can be reported as 2047 length.
684+
- `RSA`: **3071**: We set 3071 here because an otherwise valid 3072 RSA key can be reported as 3071 length.
685685
- `DSA`: **-1**: DSA is now disabled by default. Set to **1024** to re-enable but ensure you may need to reconfigure your SSHD provider
686686

687687
## Webhook (`webhook`)

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ Gitea 创建以下非唯一队列:
648648

649649
- `ED25519`**256**
650650
- `ECDSA`**256**
651-
- `RSA`**2047**:我们在这里设置为2047,因为一个其他方面有效的2048 RSA密钥可能被报告为2047长度
651+
- `RSA`**3071**:我们在这里设置为2047,因为一个其他方面有效的3072 RSA密钥可能被报告为3071长度
652652
- `DSA`**-1**:默认情况下禁用DSA。设置为**1024**以重新启用,但请注意可能需要重新配置您的SSHD提供者
653653

654654
## Webhook (`webhook`)

docs/content/help/support.en-us.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,57 @@ menu:
2222
- [Discourse Forum](https://discourse.gitea.io/)
2323
- [Matrix](https://matrix.to/#/#gitea-space:matrix.org)
2424
- NOTE: Most of the Matrix channels are bridged with their counterpart in Discord and may experience some degree of flakiness with the bridge process.
25+
- Chinese Support
26+
- [Discourse Chinese Category](https://discourse.gitea.io/c/5-category/5)
27+
- QQ Group 328432459
28+
29+
# Bug Report
30+
31+
If you found a bug, please [create an issue on GitHub](https://github.com/go-gitea/gitea/issues).
2532

2633
**NOTE:** When asking for support, it may be a good idea to have the following available so that the person helping has all the info they need:
2734

2835
1. Your `app.ini` (with any sensitive data scrubbed as necessary).
29-
2. The Gitea logs, and any other appropriate log files for the situation.
30-
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
31-
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
32-
- By default, the logs are outputted to console. If you need to collect logs from files,
33-
you could copy the following config into your `app.ini` (remove all other `[log]` sections),
34-
then you can find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).
35-
36-
```ini
37-
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
38-
[log]
39-
LEVEL=debug
40-
MODE=console,file
41-
```
42-
43-
3. Any error messages you are seeing.
44-
4. When possible, try to replicate the issue on [try.gitea.io](https://try.gitea.io) and include steps so that others can reproduce the issue.
45-
- This will greatly improve the chance that the root of the issue can be quickly discovered and resolved.
46-
5. If you encounter slow/hanging/deadlock problems, please report the stack trace when the problem occurs.
36+
2. Any error messages you are seeing.
37+
3. The Gitea logs, and all other related logs for the situation.
38+
- It's more useful to collect `trace` / `debug` level logs (see the next section).
39+
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
40+
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
41+
4. Reproducible steps so that others could reproduce and understand the problem more quickly and easily.
42+
- [try.gitea.io](https://try.gitea.io) could be used to reproduce the problem.
43+
5. If you encounter slow/hanging/deadlock problems, please report the stacktrace when the problem occurs.
4744
Go to the "Site Admin" -> "Monitoring" -> "Stacktrace" -> "Download diagnosis report".
4845

49-
## Bugs
46+
# Advanced Bug Report Tips
47+
48+
## More Config Options for Logs
49+
50+
By default, the logs are outputted to console with `info` level.
51+
If you need to set log level and/or collect logs from files,
52+
you could just copy the following config into your `app.ini` (remove all other `[log]` sections),
53+
then you will find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).
54+
55+
```ini
56+
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
57+
[log]
58+
LEVEL=debug
59+
MODE=console,file
60+
```
5061

51-
If you found a bug, please create an [issue on GitHub](https://github.com/go-gitea/gitea/issues).
62+
## Collecting Stacktrace by Command Line
63+
64+
Gitea could use Golang's pprof handler and toolchain to collect stacktrace and other runtime information.
65+
66+
If the web UI stops working, you could try to collect the stacktrace by command line:
67+
68+
1. Set `app.ini`:
69+
70+
```
71+
[server]
72+
ENABLE_PPROF = true
73+
```
5274
53-
## Chinese Support
75+
2. Restart Gitea
5476
55-
Support for the Chinese language is provided at [Our discourse](https://discourse.gitea.io/c/5-category/5) or QQ Group 328432459.
77+
3. Try to trigger the bug, when the requests get stuck for a while,
78+
use `curl` or browser to visit: `http://127.0.0.1:6060/debug/pprof/goroutine?debug=1` to get the stacktrace.

models/fixtures/email_address.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,12 @@
276276
277277
lower_email: [email protected]
278278
is_activated: false
279-
is_primary: false
279+
is_primary: false
280+
281+
-
282+
id: 36
283+
uid: 36
284+
285+
lower_email: [email protected]
286+
is_activated: true
287+
is_primary: false

models/fixtures/gpg_key.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
[] # empty
1+
-
2+
id: 5
3+
owner_id: 36
4+
key_id: B15431642629B826
5+
primary_key_id:
6+
content: xsDNBGTrY3UBDAC2HLBqmMplAV15qSnC7g1c4dV406f5EHNhFr95Nup2My6b2eafTlvedv77s8PT/I7F3fy4apOZs5A7w2SsPlLMcQ3ev4uGOsxRtkq5RLy1Yb6SNueX0Da2UVKR5KTC5Q6BWaqxwS0IjKOLZ/xz0Pbe/ClV3bZSKBEY2omkVo3Z0HZ771vB2clPRvGJ/IdeKOsZ3ZytSFXfyiJBdARmeSPmydXLil8+Ibq5iLAeow5PK8hK1TCOnKHzLWNqcNq70tyjoHvcGi70iGjoVEEUgPCLLuU8WmzTJwlvA3BuDzjtaO7TLo/jdE6iqkHtMSS8x+43sAH6hcFRCWAVh/0Uq7n36uGDfNxGnX3YrmX3LR9x5IsBES1rGGWbpxio4o5GIf/Xd+JgDd9rzJCqRuZ3/sW/TxK38htWaVNZV0kMkHUCTc1ctzWpCm635hbFCHBhPYIp+/z206khkAKDbz/CNuU91Wazsh7KO07wrwDtxfDDbInJ8TfHE2TGjzjQzgChfmcAEQEAAQ==
7+
verified: true
8+
can_sign: true
9+
can_encrypt_comms: true
10+
can_encrypt_storage: true
11+
can_certify: true
12+
13+
-
14+
id: 6
15+
owner_id: 36
16+
key_id: EE3AF48454AFD619
17+
primary_key_id: B15431642629B826
18+
content: zsDNBGTrY3UBDADsHrzuOicQaPdUQm0+0UNrs92cESm/j/4yBBUk+sfLZAo6J99c4eh4nAQzzZ7al080rYKB0G+7xoRz1eHcQH6zrVcqB8KYtf/sdY47WaMiMyxM+kTSvzp7tsv7QuSQZ0neUEXRyYMz5ttBfIjWUd+3NDItuHyB+MtNWlS3zXgaUbe5VifqKaNmzN0Ye4yXTKcpypE3AOqPVz+iIFv3c6TmsqLHJaR4VoicCleAqLyF/28WsJO7M9dDW+EM3MZVnsVpycTURyHAJGfSk10waQZAaRwmarCN/q0KEJ+aEAK/SRliUneBZoMO5hY5iBeG432tofwaQqAahPv9uXIb1n2JEMKwnMlMA9UGD1AcDbywfj1m/ZGBBw95i4Ekkfn43RvV3THr7uJU/dRqqP+iic4MwpUrOxqELW/kmeHXlBcNbZZhEEvwRoW7U2/9eeuog4nRleRJ0pi/xOP9wmxkKjaIPIK3phdBtEpVk4w/UTAWNdyIIrFggukeAnZFyGJwlm8AEQEAAQ==
19+
verified: true
20+
can_sign: true
21+
can_encrypt_comms: true
22+
can_encrypt_storage: true
23+
can_certify: true

models/fixtures/user.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@
13011301
lower_name: limited_org36
13021302
name: limited_org36
13031303
full_name: Limited Org 36
1304-
email: limited_org36@example.com
1304+
email: abcde@gitea.com
13051305
keep_email_private: false
13061306
email_notifications_preference: enabled
13071307
passwd: ZogKvWdyEx:password
@@ -1320,7 +1320,7 @@
13201320
allow_create_organization: true
13211321
prohibit_login: false
13221322
avatar: avatar22
1323-
avatar_email: limited_org36@example.com
1323+
avatar_email: abcde@gitea.com
13241324
use_custom_avatar: false
13251325
num_followers: 0
13261326
num_following: 0

models/migrations/v1_16/v210.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package v1_16 //nolint
55

66
import (
7-
"crypto/elliptic"
87
"encoding/base32"
98
"fmt"
109
"strings"
@@ -123,13 +122,17 @@ func RemigrateU2FCredentials(x *xorm.Engine) error {
123122
if err != nil {
124123
continue
125124
}
125+
pubKey, err := parsed.PubKey.ECDH()
126+
if err != nil {
127+
continue
128+
}
126129
remigrated := &webauthnCredential{
127130
ID: reg.ID,
128131
Name: reg.Name,
129132
LowerName: strings.ToLower(reg.Name),
130133
UserID: reg.UserID,
131134
CredentialID: base32.HexEncoding.EncodeToString(parsed.KeyHandle),
132-
PublicKey: elliptic.Marshal(elliptic.P256(), parsed.PubKey.X, parsed.PubKey.Y),
135+
PublicKey: pubKey.Bytes(),
133136
AttestationType: "fido-u2f",
134137
AAGUID: []byte{},
135138
SignCount: reg.Counter,

models/secret/secret.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,31 @@ func DeleteSecret(ctx context.Context, orgID, repoID int64, name string) error {
160160

161161
return nil
162162
}
163+
164+
// CreateOrUpdateSecret creates or updates a secret and returns true if it was created
165+
func CreateOrUpdateSecret(ctx context.Context, orgID, repoID int64, name, data string) (bool, error) {
166+
sc := new(Secret)
167+
name = strings.ToUpper(name)
168+
has, err := db.GetEngine(ctx).
169+
Where("owner_id=?", orgID).
170+
And("repo_id=?", repoID).
171+
And("name=?", name).
172+
Get(sc)
173+
if err != nil {
174+
return false, err
175+
}
176+
177+
if !has {
178+
_, err = InsertEncryptedSecret(ctx, orgID, repoID, name, data)
179+
if err != nil {
180+
return false, err
181+
}
182+
return true, nil
183+
}
184+
185+
if err := UpdateSecret(ctx, orgID, repoID, name, data); err != nil {
186+
return false, err
187+
}
188+
189+
return false, nil
190+
}

modules/activitypub/user_settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"code.gitea.io/gitea/modules/util"
99
)
1010

11-
const rsaBits = 2048
11+
const rsaBits = 3072
1212

1313
// GetKeyPair function returns a user's private and public keys
1414
func GetKeyPair(user *user_model.User) (pub, priv string, err error) {

0 commit comments

Comments
 (0)