Skip to content

Commit 651f575

Browse files
authored
Merge branch 'main' into revert-oidc-linkaccount
2 parents 9a91904 + bc50431 commit 651f575

Some content is hidden

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

82 files changed

+676
-185
lines changed

cmd/web.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func serveInstall(cmd *cli.Command) error {
156156
case <-graceful.GetManager().IsShutdown():
157157
<-graceful.GetManager().Done()
158158
log.Info("PID: %d Gitea Web Finished", os.Getpid())
159-
log.GetManager().Close()
160159
return err
161160
default:
162161
}
@@ -231,7 +230,6 @@ func serveInstalled(c *cli.Command) error {
231230
err := listen(webRoutes, true)
232231
<-graceful.GetManager().Done()
233232
log.Info("PID: %d Gitea Web Finished", os.Getpid())
234-
log.GetManager().Close()
235233
return err
236234
}
237235

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ require (
109109
github.com/ulikunitz/xz v0.5.15
110110
github.com/urfave/cli-docs/v3 v3.0.0-alpha6
111111
github.com/urfave/cli/v3 v3.4.1
112-
github.com/wneessen/go-mail v0.7.1
112+
github.com/wneessen/go-mail v0.7.2
113113
github.com/xeipuuv/gojsonschema v1.2.0
114114
github.com/yohcop/openid-go v1.0.1
115115
github.com/yuin/goldmark v1.7.13

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZ
768768
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
769769
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
770770
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
771-
github.com/wneessen/go-mail v0.7.1 h1:rvy63sp14N06/kdGqCYwW8Na5gDCXjTQM1E7So4PuKk=
772-
github.com/wneessen/go-mail v0.7.1/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k=
771+
github.com/wneessen/go-mail v0.7.2 h1:xxPnhZ6IZLSgxShebmZ6DPKh1b6OJcoHfzy7UjOkzS8=
772+
github.com/wneessen/go-mail v0.7.2/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k=
773773
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
774774
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
775775
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func main() {
4444
}
4545
app := cmd.NewMainApp(cmd.AppVersion{Version: Version, Extra: formatBuiltWith()})
4646
_ = cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
47+
// flush the queued logs before exiting, it is a MUST, otherwise there will be log loss
4748
log.GetManager().Close()
4849
}
4950

models/fixtures/action_run.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,23 @@
139139
updated: 1683636626
140140
need_approval: 0
141141
approved_by: 0
142+
-
143+
id: 804
144+
title: "use a private action"
145+
repo_id: 60
146+
owner_id: 40
147+
workflow_id: "run.yaml"
148+
index: 189
149+
trigger_user_id: 40
150+
ref: "refs/heads/master"
151+
commit_sha: "6e64b26de7ba966d01d90ecfaf5c7f14ef203e86"
152+
event: "push"
153+
trigger_event: "push"
154+
is_fork_pull_request: 0
155+
status: 1
156+
started: 1683636528
157+
stopped: 1683636626
158+
created: 1683636108
159+
updated: 1683636626
160+
need_approval: 0
161+
approved_by: 0

models/fixtures/action_run_job.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,17 @@
129129
status: 5
130130
started: 1683636528
131131
stopped: 1683636626
132+
-
133+
id: 205
134+
run_id: 804
135+
repo_id: 6
136+
owner_id: 10
137+
commit_sha: 6e64b26de7ba966d01d90ecfaf5c7f14ef203e86
138+
is_fork_pull_request: 0
139+
name: job_2
140+
attempt: 1
141+
job_id: job_2
142+
task_id: 48
143+
status: 1
144+
started: 1683636528
145+
stopped: 1683636626

models/fixtures/action_task.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,23 @@
177177
log_length: 0
178178
log_size: 0
179179
log_expired: 0
180+
-
181+
id: 55
182+
job_id: 205
183+
attempt: 1
184+
runner_id: 1
185+
status: 6 # 6 is the status code for "running"
186+
started: 1683636528
187+
stopped: 1683636626
188+
repo_id: 6
189+
owner_id: 10
190+
commit_sha: 6e64b26de7ba966d01d90ecfaf5c7f14ef203e86
191+
is_fork_pull_request: 0
192+
token_hash: b8d3962425466b6709b9ac51446f93260c54afe8e7b6d3686e34f991fb8a8953822b0deed86fe41a103f34bc48dbc478422b
193+
token_salt: ERxJGHvg3I
194+
token_last_eight: 182199eb
195+
log_filename: collaborative-owner-test/1a/49.log
196+
log_in_storage: 1
197+
log_length: 707
198+
log_size: 90179
199+
log_expired: 0

models/fixtures/branch.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,27 @@
225225
is_deleted: false
226226
deleted_by_id: 0
227227
deleted_unix: 0
228+
229+
-
230+
id: 27
231+
repo_id: 1
232+
name: 'DefaultBranch'
233+
commit_id: '90c1019714259b24fb81711d4416ac0f18667dfa'
234+
commit_message: 'add license'
235+
commit_time: 1709345946
236+
pusher_id: 1
237+
is_deleted: false
238+
deleted_by_id: 0
239+
deleted_unix: 0
240+
241+
-
242+
id: 28
243+
repo_id: 1
244+
name: 'sub-home-md-img-check'
245+
commit_id: '4649299398e4d39a5c09eb4f534df6f1e1eb87cc'
246+
commit_message: "Test how READMEs render images when found in a subfolder"
247+
commit_time: 1678403550
248+
pusher_id: 1
249+
is_deleted: false
250+
deleted_by_id: 0
251+
deleted_unix: 0

models/fixtures/repo_unit.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,3 +733,10 @@
733733
type: 3
734734
config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
735735
created_unix: 946684810
736+
737+
-
738+
id: 111
739+
repo_id: 3
740+
type: 10
741+
config: "{}"
742+
created_unix: 946684810

models/perm/access/repo_permission.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,22 @@ func GetActionsUserRepoPermission(ctx context.Context, repo *repo_model.Reposito
264264
if err != nil {
265265
return perm, err
266266
}
267-
if task.RepoID != repo.ID {
268-
// FIXME allow public repo read access if tokenless pull is enabled
269-
return perm, nil
270-
}
271267

272268
var accessMode perm_model.AccessMode
273-
if task.IsForkPullRequest {
269+
if task.RepoID != repo.ID {
270+
taskRepo, exist, err := db.GetByID[repo_model.Repository](ctx, task.RepoID)
271+
if err != nil || !exist {
272+
return perm, err
273+
}
274+
actionsCfg := repo.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
275+
if !actionsCfg.IsCollaborativeOwner(taskRepo.OwnerID) || !taskRepo.IsPrivate {
276+
// The task repo can access the current repo only if the task repo is private and
277+
// the owner of the task repo is a collaborative owner of the current repo.
278+
// FIXME allow public repo read access if tokenless pull is enabled
279+
return perm, nil
280+
}
281+
accessMode = perm_model.AccessModeRead
282+
} else if task.IsForkPullRequest {
274283
accessMode = perm_model.AccessModeRead
275284
} else {
276285
accessMode = perm_model.AccessModeWrite

0 commit comments

Comments
 (0)