Update a number of dependencies (incl. CVE fixes) (#4107)

* Update a number of dependencies (incl. CVE fixes)

Includes some dependencies that were upgraded in #4106 as well as a few more dependencies.

Some deps that have been upgraded had CVEs.

Notably, upgrades deprecated dependencies such as:
- `github.com/go-chi/chi` (replaced with `/v5`)
- `github.com/gofrs/uuid` (replaced with `/v5`)
- `github.com/hashicorp/golang-lru` (replaced with `/v2` which uses generics)

* Upgraded a few more deps

* lint

* reverted yaml library to v2

* remove unnecessary mod replace

* Update chromedp

Fixes #3733
This commit is contained in:
its-josh4
2023-10-25 22:24:32 -07:00
committed by GitHub
parent 552f86586a
commit 2b8c2534dd
17 changed files with 211 additions and 504 deletions

View File

@@ -135,7 +135,7 @@ func setCDPCookies(driverOptions scraperDriverOptions) chromedp.Tasks {
// print cookies whose domain is included in the scraper config
func printCDPCookies(driverOptions scraperDriverOptions, msg string) chromedp.Action {
return chromedp.ActionFunc(func(ctx context.Context) error {
chromeCookies, err := network.GetAllCookies().Do(ctx)
chromeCookies, err := network.GetCookies().Do(ctx)
if err != nil {
return err
}

View File

@@ -12,10 +12,11 @@ import (
"time"
"github.com/robertkrimen/otto"
"gopkg.in/yaml.v2"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/sliceutil/stringslice"
"gopkg.in/yaml.v2"
)
type mappedQuery interface {

View File

@@ -14,11 +14,11 @@ import (
"strings"
"github.com/Yamashou/gqlgenc/client"
"github.com/Yamashou/gqlgenc/graphqljson"
"github.com/gofrs/uuid/v5"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/Yamashou/gqlgenc/graphqljson"
"github.com/gofrs/uuid"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/match"
"github.com/stashapp/stash/pkg/models"

View File

@@ -3,7 +3,7 @@ package sqlite
import (
"regexp"
lru "github.com/hashicorp/golang-lru"
lru "github.com/hashicorp/golang-lru/v2"
)
// size of the regex LRU cache in elements.
@@ -14,19 +14,17 @@ import (
// again.
const regexCacheSize = 10
var regexCache *lru.Cache
var regexCache *lru.Cache[string, *regexp.Regexp]
func init() {
regexCache, _ = lru.New(regexCacheSize)
regexCache, _ = lru.New[string, *regexp.Regexp](regexCacheSize)
}
// regexFn is registered as an SQLite function as "regexp"
// It uses an LRU cache to cache recent regex patterns to reduce CPU load over
// identical patterns.
func regexFn(re, s string) (bool, error) {
entry, ok := regexCache.Get(re)
var compiled *regexp.Regexp
compiled, ok := regexCache.Get(re)
if !ok {
var err error
compiled, err = regexp.Compile(re)
@@ -34,8 +32,6 @@ func regexFn(re, s string) (bool, error) {
return false, err
}
regexCache.Add(re, compiled)
} else {
compiled = entry.(*regexp.Regexp)
}
return compiled.MatchString(s), nil