Skip to content

Commit 714fcc9

Browse files
authored
Merge branch 'main' into add-owner-parent-docs
Signed-off-by: wxiaoguang <[email protected]>
2 parents 0dec2d1 + 56eccb4 commit 714fcc9

File tree

111 files changed

+1105
-984
lines changed

Some content is hidden

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

111 files changed

+1105
-984
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ module.exports = {
326326
'@typescript-eslint/no-unnecessary-type-arguments': [0],
327327
'@typescript-eslint/no-unnecessary-type-assertion': [2],
328328
'@typescript-eslint/no-unnecessary-type-constraint': [2],
329+
'@typescript-eslint/no-unnecessary-type-conversion': [2],
329330
'@typescript-eslint/no-unsafe-argument': [0],
330331
'@typescript-eslint/no-unsafe-assignment': [0],
331332
'@typescript-eslint/no-unsafe-call': [0],
@@ -645,7 +646,7 @@ module.exports = {
645646
'no-multi-str': [2],
646647
'no-negated-condition': [0],
647648
'no-nested-ternary': [0],
648-
'no-new-func': [2],
649+
'no-new-func': [0], // handled by @typescript-eslint/no-implied-eval
649650
'no-new-native-nonconstructor': [2],
650651
'no-new-object': [2],
651652
'no-new-symbol': [2],

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ be reviewed by two maintainers and must pass the automatic tests.
591591
## Releasing Gitea
592592

593593
- Let $vmaj, $vmin and $vpat be Major, Minor and Patch version numbers, $vpat should be rc1, rc2, 0, 1, ...... $vmaj.$vmin will be kept the same as milestones on github or gitea in future.
594-
- Before releasing, confirm all the version's milestone issues or PRs has been resolved. Then discuss the release on Discord channel #maintainers and get agreed with almost all the owners and mergers. Or you can declare the version and if nobody against in about serval hours.
594+
- Before releasing, confirm all the version's milestone issues or PRs has been resolved. Then discuss the release on Discord channel #maintainers and get agreed with almost all the owners and mergers. Or you can declare the version and if nobody is against it in about several hours.
595595
- If this is a big version first you have to create PR for changelog on branch `main` with PRs with label `changelog` and after it has been merged do following steps:
596596
- Create `-dev` tag as `git tag -s -F release.notes v$vmaj.$vmin.0-dev` and push the tag as `git push origin v$vmaj.$vmin.0-dev`.
597597
- When CI has finished building tag then you have to create a new branch named `release/v$vmaj.$vmin`

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \
3939
/tmp/local/etc/s6/.s6-svscan/* \
4040
/go/src/code.gitea.io/gitea/gitea \
4141
/go/src/code.gitea.io/gitea/environment-to-ini
42-
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
4342

4443
FROM docker.io/library/alpine:3.22
4544
LABEL maintainer="[email protected]"
@@ -83,4 +82,3 @@ CMD ["/usr/bin/s6-svscan", "/etc/s6"]
8382
COPY --from=build-env /tmp/local /
8483
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
8584
COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
86-
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh

Dockerfile.rootless

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
3737
/tmp/local/usr/local/bin/gitea \
3838
/go/src/code.gitea.io/gitea/gitea \
3939
/go/src/code.gitea.io/gitea/environment-to-ini
40-
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
4140

4241
FROM docker.io/library/alpine:3.22
4342
LABEL maintainer="[email protected]"
@@ -72,7 +71,6 @@ RUN chown git:git /var/lib/gitea /etc/gitea
7271
COPY --from=build-env /tmp/local /
7372
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
7473
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
75-
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
7674

7775
# git:git
7876
USER 1000:1000

cmd/admin_auth_oauth.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ func oauthCLIFlags() []cli.Flag {
8787
Value: nil,
8888
Usage: "Scopes to request when to authenticate against this OAuth2 source",
8989
},
90+
&cli.StringFlag{
91+
Name: "ssh-public-key-claim-name",
92+
Usage: "Claim name that provides SSH public keys",
93+
},
94+
&cli.StringFlag{
95+
Name: "full-name-claim-name",
96+
Usage: "Claim name that provides user's full name",
97+
},
9098
&cli.StringFlag{
9199
Name: "required-claim-name",
92100
Value: "",
@@ -177,6 +185,8 @@ func parseOAuth2Config(c *cli.Command) *oauth2.Source {
177185
RestrictedGroup: c.String("restricted-group"),
178186
GroupTeamMap: c.String("group-team-map"),
179187
GroupTeamMapRemoval: c.Bool("group-team-map-removal"),
188+
SSHPublicKeyClaimName: c.String("ssh-public-key-claim-name"),
189+
FullNameClaimName: c.String("full-name-claim-name"),
180190
}
181191
}
182192

@@ -268,6 +278,12 @@ func (a *authService) runUpdateOauth(ctx context.Context, c *cli.Command) error
268278
if c.IsSet("group-team-map-removal") {
269279
oAuth2Config.GroupTeamMapRemoval = c.Bool("group-team-map-removal")
270280
}
281+
if c.IsSet("ssh-public-key-claim-name") {
282+
oAuth2Config.SSHPublicKeyClaimName = c.String("ssh-public-key-claim-name")
283+
}
284+
if c.IsSet("full-name-claim-name") {
285+
oAuth2Config.FullNameClaimName = c.String("full-name-claim-name")
286+
}
271287

272288
// update custom URL mapping
273289
customURLMapping := &oauth2.CustomURLMapping{}

cmd/admin_auth_oauth_test.go

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ func TestAddOauth(t *testing.T) {
8888
"--restricted-group", "restricted",
8989
"--group-team-map", `{"group1": [1,2]}`,
9090
"--group-team-map-removal=true",
91+
"--ssh-public-key-claim-name", "attr_ssh_pub_key",
92+
"--full-name-claim-name", "attr_full_name",
9193
},
9294
source: &auth_model.Source{
9395
Type: auth_model.OAuth2,
@@ -104,15 +106,17 @@ func TestAddOauth(t *testing.T) {
104106
EmailURL: "https://example.com/email",
105107
Tenant: "some_tenant",
106108
},
107-
IconURL: "https://example.com/icon",
108-
Scopes: []string{"scope1", "scope2"},
109-
RequiredClaimName: "claim_name",
110-
RequiredClaimValue: "claim_value",
111-
GroupClaimName: "group_name",
112-
AdminGroup: "admin",
113-
RestrictedGroup: "restricted",
114-
GroupTeamMap: `{"group1": [1,2]}`,
115-
GroupTeamMapRemoval: true,
109+
IconURL: "https://example.com/icon",
110+
Scopes: []string{"scope1", "scope2"},
111+
RequiredClaimName: "claim_name",
112+
RequiredClaimValue: "claim_value",
113+
GroupClaimName: "group_name",
114+
AdminGroup: "admin",
115+
RestrictedGroup: "restricted",
116+
GroupTeamMap: `{"group1": [1,2]}`,
117+
GroupTeamMapRemoval: true,
118+
SSHPublicKeyClaimName: "attr_ssh_pub_key",
119+
FullNameClaimName: "attr_full_name",
116120
},
117121
TwoFactorPolicy: "skip",
118122
},
@@ -223,15 +227,17 @@ func TestUpdateOauth(t *testing.T) {
223227
EmailURL: "https://old.example.com/email",
224228
Tenant: "old_tenant",
225229
},
226-
IconURL: "https://old.example.com/icon",
227-
Scopes: []string{"old_scope1", "old_scope2"},
228-
RequiredClaimName: "old_claim_name",
229-
RequiredClaimValue: "old_claim_value",
230-
GroupClaimName: "old_group_name",
231-
AdminGroup: "old_admin",
232-
RestrictedGroup: "old_restricted",
233-
GroupTeamMap: `{"old_group1": [1,2]}`,
234-
GroupTeamMapRemoval: true,
230+
IconURL: "https://old.example.com/icon",
231+
Scopes: []string{"old_scope1", "old_scope2"},
232+
RequiredClaimName: "old_claim_name",
233+
RequiredClaimValue: "old_claim_value",
234+
GroupClaimName: "old_group_name",
235+
AdminGroup: "old_admin",
236+
RestrictedGroup: "old_restricted",
237+
GroupTeamMap: `{"old_group1": [1,2]}`,
238+
GroupTeamMapRemoval: true,
239+
SSHPublicKeyClaimName: "old_ssh_pub_key",
240+
FullNameClaimName: "old_full_name",
235241
},
236242
TwoFactorPolicy: "",
237243
},
@@ -257,6 +263,8 @@ func TestUpdateOauth(t *testing.T) {
257263
"--restricted-group", "restricted",
258264
"--group-team-map", `{"group1": [1,2]}`,
259265
"--group-team-map-removal=false",
266+
"--ssh-public-key-claim-name", "new_ssh_pub_key",
267+
"--full-name-claim-name", "new_full_name",
260268
},
261269
authSource: &auth_model.Source{
262270
ID: 1,
@@ -274,15 +282,17 @@ func TestUpdateOauth(t *testing.T) {
274282
EmailURL: "https://example.com/email",
275283
Tenant: "new_tenant",
276284
},
277-
IconURL: "https://example.com/icon",
278-
Scopes: []string{"scope1", "scope2"},
279-
RequiredClaimName: "claim_name",
280-
RequiredClaimValue: "claim_value",
281-
GroupClaimName: "group_name",
282-
AdminGroup: "admin",
283-
RestrictedGroup: "restricted",
284-
GroupTeamMap: `{"group1": [1,2]}`,
285-
GroupTeamMapRemoval: false,
285+
IconURL: "https://example.com/icon",
286+
Scopes: []string{"scope1", "scope2"},
287+
RequiredClaimName: "claim_name",
288+
RequiredClaimValue: "claim_value",
289+
GroupClaimName: "group_name",
290+
AdminGroup: "admin",
291+
RestrictedGroup: "restricted",
292+
GroupTeamMap: `{"group1": [1,2]}`,
293+
GroupTeamMapRemoval: false,
294+
SSHPublicKeyClaimName: "new_ssh_pub_key",
295+
FullNameClaimName: "new_full_name",
286296
},
287297
TwoFactorPolicy: "skip",
288298
},

cmd/hook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var (
3232
CmdHook = &cli.Command{
3333
Name: "hook",
3434
Usage: "(internal) Should only be called by Git",
35+
Hidden: true, // internal commands shouldn't be visible
3536
Description: "Delegate commands to corresponding Git hooks",
3637
Before: PrepareConsoleLoggerLevel(log.FATAL),
3738
Commands: []*cli.Command{

cmd/keys.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
var CmdKeys = &cli.Command{
2020
Name: "keys",
2121
Usage: "(internal) Should only be called by SSH server",
22+
Hidden: true, // internal commands shouldn't not be visible
2223
Description: "Queries the Gitea database to get the authorized command for a given ssh key fingerprint",
2324
Before: PrepareConsoleLoggerLevel(log.FATAL),
2425
Action: runKeys,

0 commit comments

Comments
 (0)