mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-18 22:36:43 +09:00
fix(actions): harden log cursor, activity type and actor filter handling (#39721)
Fixes a few Actions bugs where user input or nondeterminism caused failures: - The job log view indexed task steps with the client-supplied cursor step without a bounds check, so an out-of-range value panicked and returned a 500. - Workflow activity type filters (`types:`) were compiled with `glob.MustCompile`, so an invalid pattern in a workflow file panicked during event detection. Invalid patterns now simply don't match. - Listing workflow runs with an unknown `actor` returned a 500; it now returns 404. - The v4 artifact `ListArtifacts` response was built by ranging over a map, so its order changed between calls. It now follows database order. - The error from marshalling a workflow job when inserting run jobs was silently ignored. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
1 parent
321d3ec104
commit
8a9e8c4e8c
13 files changed
+70
-28
No files matched your search
@@ -99,8 +99,8 @@ func (protectBranch *ProtectedBranch) loadGlob() {
|
||||
var err error
|
||||
protectBranch.globRule, err = glob.Compile(protectBranch.RuleName, '/')
|
||||
if err != nil {
|
||||
log.Warn("Invalid glob rule for ProtectedBranch[%d]: %s %v", protectBranch.ID, protectBranch.RuleName, err)
|
||||
protectBranch.globRule = glob.MustCompile(glob.QuoteMeta(protectBranch.RuleName), '/')
|
||||
log.Debug("Invalid glob rule for ProtectedBranch[%d]: %s %v", protectBranch.ID, protectBranch.RuleName, err)
|
||||
protectBranch.globRule, _ = glob.Compile(glob.QuoteMeta(protectBranch.RuleName), '/')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,9 @@ func (protectBranch *ProtectedBranch) Match(branchName string) bool {
|
||||
if protectBranch.isPlainName {
|
||||
return strings.EqualFold(protectBranch.RuleName, branchName)
|
||||
}
|
||||
|
||||
if protectBranch.globRule == nil {
|
||||
return false // in case of invalid glob rule, we don't match anything
|
||||
}
|
||||
return protectBranch.globRule.Match(branchName)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user