Heim  >  Artikel  >  Backend-Entwicklung  >  Golang: Umgang mit der veralteten Abhängigkeit von google.golang.org/api von golang.org/x/net

Golang: Umgang mit der veralteten Abhängigkeit von google.golang.org/api von golang.org/x/net

WBOY
WBOYnach vorne
2024-02-06 08:09:11826Durchsuche

Golang:如何处理 google.golang.org/api 对 golang.org/x/net 的过时依赖项

Frageninhalt

Kürzlich hat sich Dependabot von github.com darüber beschwert, dass einige Abhängigkeiten in meinem Projekt anfällig für DOS-Angriffe sind, „kaputte oder riskante Verschlüsselungsalgorithmen“ haben und den Fehler „unkontrollierter Ressourcenverbrauch“ haben.

Konkret wurde ich vor CVE-2022-27664 für das Modul golang.org/x/net, CVE-2022-27191 und CVE-2022-32149 für andere Module gewarnt.

Ich habe „go get -u“ auf allen verwendeten Modulen ausgeführt. Offensichtlich hat dies das Problem nicht gelöst. Dann begann ich, „go graph“ zu verwenden, um Modulabhängigkeiten zu finden. Es hat eine Weile gedauert und ich habe folgende Reihenfolge der Abhängigkeiten gefunden:

google.golang.org/[email protected] =>
[email protected] =>
google.golang.org/[email protected] =>
github.com/envoyproxy/[email protected] =>
google.golang.org/[email protected] =>
golang.org/x/[email protected] =>
google.golang.org/[email protected] =>
golang.org/x/[email protected]

Dies bedeutet die modernsten und aktuellsten google.golang.org/api 软件包会导致对 2018 年起的 golang.org/x/net Abhängigkeiten mit Stand vom 17. März 2023.

Ich habe festgestellt, dass andere Google-Pakete viele Abhängigkeiten vom alten Netzwerkmodul haben:

cloud.google.com/go/[email protected] golang.org/x/[email protected]
github.com/googleapis/gax-go/[email protected] golang.org/x/[email protected]
[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
golang.org/x/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]

Ich habe das Repository github.com/googleapis/google-api-go-client überprüft und dieses Problem gefunden: https://github.com/googleapis/google-api-go-client/issues/1048 Ich hatte das gleiche Problem, aber dann zeigte der Benutzerbefehl hashier 说,由于 go list -m all die neueste Version an, also war das nicht das Problem.

Die Hauptfrage lautet also: Ist das ein Problem und warum?

Ich weiß einfach nicht, was hier behoben werden soll, Github Dependentabot Check oder Google-API-Go-Client-Modulabhängigkeit.


Richtige Antwort


Es ist Zeit, diese Frage zu beantworten.

Wenn ich versuche, go mod graph 在单独的草稿存储库中一一检查项目中的所有包时,这些易受攻击的依赖项来自另一个存储库:github.com/go-gorm/postgres zu verwenden.

Also habe ich fälschlicherweise erkannt, woher die gefährdete Abhängigkeit kam. Anscheinend liegt das an dem riesigen Abhängigkeitsdiagramm:

[0] $ go mod graph | wc
    667    1334   56113

Wenn jemand nach einer Möglichkeit sucht, Projektabhängigkeiten zu visualisieren, ist er hier:

go mod graph | modgv | dot -Tsvg -o graph.svg

Zurück zur ursprünglichen Frage. Dies liegt daran, dass github.com/go-gorm/postgres 使用旧版本的 go 造成的。据我了解,修复它的唯一方法是将 go 版本升级到 1.18。如果版本较低,go mod graph viele anfällige Pakete anzeigt.

Das obige ist der detaillierte Inhalt vonGolang: Umgang mit der veralteten Abhängigkeit von google.golang.org/api von golang.org/x/net. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:stackoverflow.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen