-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CVE-2020-14040: v0.3.3 golang.org/x/text #1293
Conversation
Hey, thank you for opening your first Pull Request ! |
The patch looks good to me. Can you please sign the commit? |
What differs a diff --git a/go.mod b/go.mod
index 6a9bc93..eb68638 100644
--- a/go.mod
+++ b/go.mod
@@ -58,6 +58,7 @@ require (
github.com/ultraware/whitespace v0.0.4
github.com/uudashr/gocognit v1.0.1
github.com/valyala/quicktemplate v1.6.0
+ golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305
gopkg.in/yaml.v2 v2.3.0
honnef.co/go/tools v0.0.1-2020.1.5
diff --git a/go.sum b/go.sum
index db3c095..f7d517a 100644
--- a/go.sum
+++ b/go.sum
@@ -494,6 +494,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Do |
@denis-tingajkin I'm waiting on my company to approve the CLA so I can sign it 😄
@bombsimon yes, replace directives will affect all dependencies. https://golang.org/ref/mod#go.mod-replace |
Thanks! I guess I could've/should've opened the docs before asking but at least I'm extra sure how it's working now. 😃 |
AFAIK replace directives can't affect dependencies, that's why we had to fork our dependencies in thee past, so I'm not sure this will bump any dependency. Also I can't see v0.3.3 in go.sum, which is suspicious and looks like such replace is no-op. Probably the right way is to
|
@ernado Do you have any evidence of this behaviour? it's very common practice to use replace statements exactly for this practice. Also see changes after running |
Now I see changes in go.sum. |
But still if it's possible, direct dependency is the best case :) |
@sayboras I'm intrigued I have never come across this and I use them in packages that are pure libraries, so I'm interested what problems you have encountered? |
Please see golang/go#30354 |
Just curious that we have one GA dependency check with nancy, seems like the vulnerbility db was not up to date :). Keen to see if it will fail in next few day. |
I checked their OSS index and did not find anything about CVE-2020-14040, I don't know how they update the index DB, but the CVE is pretty old and it should be in their DB. |
I opened an issue for OSS Index: OSSIndex/vulns#115 |
According to the documentation:
And since they didn't change a major version, we can use direct dependency instead of replace directive. go get golang.org/x/text
rm go.sum
go mod tidy gives this diff: diff --git a/go.mod b/go.mod
index 6a9bc93..eb68638 100644
--- a/go.mod
+++ b/go.mod
@@ -58,6 +58,7 @@ require (
github.com/ultraware/whitespace v0.0.4
github.com/uudashr/gocognit v1.0.1
github.com/valyala/quicktemplate v1.6.0
+ golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305
gopkg.in/yaml.v2 v2.3.0
honnef.co/go/tools v0.0.1-2020.1.5
diff --git a/go.sum b/go.sum
index db3c095..b87256f 100644
--- a/go.sum
+++ b/go.sum
@@ -492,8 +492,9 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
And one more, the dependabot does not update the dependencies in replace, so we will need to manually track the updates. |
Here is the answer:
So in such cases like we have, if Nancy does not fail, feel free to report the issues here: https://github.com/OSSIndex/vulns/issues |
@henryleduc any update on this? Feel free to shout out if you need any help. |
mark this one as draft |
* Delete go.sum * go mod tidy
@sayboras Apologies for the delay on this, it's been super busy lately so haven't had time to have a look at this. I've addressed all the comments, please let me know if there is anything else. Seems like a couple indirect or unused dependencies were removed in the |
yes, it's kind of expected behavior with go.sum. I occasionally remove go.sum and re-generate it with The changes look good to me, I checked manually if 0.3.4 is used as part of the build, seems like it it.
|
Hey, @henryleduc — we just merged your PR to
By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests. Thanks again! |
CVE-2020-14040
The x/text package before 0.3.3 for Go has a vulnerability in encoding/unicode that could lead to the UTF-16 decoder entering an infinite loop, causing the program to crash or run out of memory. An attacker could provide a single byte to a UTF16 decoder instantiated with UseBOM or ExpectBOM to trigger an infinite loop if the String function on the Decoder is called, or the Decoder is passed to golang.org/x/text/transform.String.
Source: https://nvd.nist.gov/vuln/detail/CVE-2020-14040