search
HomeBackend DevelopmentGolangGolang: How to handle outdated dependency of google.golang.org/api on golang.org/x/net

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

Question content

Recently github.com dependabot complained that some dependencies in my project are vulnerable to DOS attacks and have "corrupt or risky Encryption Algorithm" and there is an "Uncontrolled Resource Consumption" error.

Specifically, it warned me about CVE-2022-27664 for the golang.org/x/net module, CVE-2022-27191 and CVE-2022-32149 for other modules.

What I did was run "go get -u" on all modules used. Obviously, this didn't solve the problem. Then I started using "go graph" to find module dependencies. It took a while and this is the order of dependencies I found:

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]

This means that the most modern and updated google.golang.org/api packages from March 17, 2023 will result in golang.org/x/ from 2018 net dependencies.

I found that other Google packages have a lot of dependencies on the old network module:

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]

I checked the github.com/googleapis/google-api-go-client repository and found this issue https://github.com/googleapis/google-api-go-client/issues/1048 I said the same problem, but then user hashier said that since the go list -m all command shows the latest version, it's not a problem.

So, the main question is: is this a problem and why?

I just don't know what should be fixed here, github dependabot check or google-api-go-client module dependency.


Correct answer


It’s time to answer this question.

When I tried to check all the packages in the project one by one in a separate draft repository using go mod graph, these vulnerable dependencies came from another repository: github .com/go-gorm/postgres.

So, I incorrectly identified where the vulnerable dependency is coming from. Apparently this is due to the huge dependency graph:

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

If anyone is looking for a way to visualize project dependencies, here it is:

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

Back to the original question. This is caused by github.com/go-gorm/postgres using an older version of go. As far as I understand, the only way to fix it is to upgrade the go version to 1.18. If the version is lower, go mod graph will show many vulnerable packages.

The above is the detailed content of Golang: How to handle outdated dependency of google.golang.org/api on golang.org/x/net. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:stackoverflow. If there is any infringement, please contact admin@php.cn delete
How do you use the pprof tool to analyze Go performance?How do you use the pprof tool to analyze Go performance?Mar 21, 2025 pm 06:37 PM

The article explains how to use the pprof tool for analyzing Go performance, including enabling profiling, collecting data, and identifying common bottlenecks like CPU and memory issues.Character count: 159

How do you write unit tests in Go?How do you write unit tests in Go?Mar 21, 2025 pm 06:34 PM

The article discusses writing unit tests in Go, covering best practices, mocking techniques, and tools for efficient test management.

How do I write mock objects and stubs for testing in Go?How do I write mock objects and stubs for testing in Go?Mar 10, 2025 pm 05:38 PM

This article demonstrates creating mocks and stubs in Go for unit testing. It emphasizes using interfaces, provides examples of mock implementations, and discusses best practices like keeping mocks focused and using assertion libraries. The articl

How can I define custom type constraints for generics in Go?How can I define custom type constraints for generics in Go?Mar 10, 2025 pm 03:20 PM

This article explores Go's custom type constraints for generics. It details how interfaces define minimum type requirements for generic functions, improving type safety and code reusability. The article also discusses limitations and best practices

Explain the purpose of Go's reflect package. When would you use reflection? What are the performance implications?Explain the purpose of Go's reflect package. When would you use reflection? What are the performance implications?Mar 25, 2025 am 11:17 AM

The article discusses Go's reflect package, used for runtime manipulation of code, beneficial for serialization, generic programming, and more. It warns of performance costs like slower execution and higher memory use, advising judicious use and best

How do you use table-driven tests in Go?How do you use table-driven tests in Go?Mar 21, 2025 pm 06:35 PM

The article discusses using table-driven tests in Go, a method that uses a table of test cases to test functions with multiple inputs and outcomes. It highlights benefits like improved readability, reduced duplication, scalability, consistency, and a

What are the vulnerabilities of Debian OpenSSLWhat are the vulnerabilities of Debian OpenSSLApr 02, 2025 am 07:30 AM

OpenSSL, as an open source library widely used in secure communications, provides encryption algorithms, keys and certificate management functions. However, there are some known security vulnerabilities in its historical version, some of which are extremely harmful. This article will focus on common vulnerabilities and response measures for OpenSSL in Debian systems. DebianOpenSSL known vulnerabilities: OpenSSL has experienced several serious vulnerabilities, such as: Heart Bleeding Vulnerability (CVE-2014-0160): This vulnerability affects OpenSSL 1.0.1 to 1.0.1f and 1.0.2 to 1.0.2 beta versions. An attacker can use this vulnerability to unauthorized read sensitive information on the server, including encryption keys, etc.

How can I use tracing tools to understand the execution flow of my Go applications?How can I use tracing tools to understand the execution flow of my Go applications?Mar 10, 2025 pm 05:36 PM

This article explores using tracing tools to analyze Go application execution flow. It discusses manual and automatic instrumentation techniques, comparing tools like Jaeger, Zipkin, and OpenTelemetry, and highlighting effective data visualization

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool