Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Disallow LTR, RTL & co. characters in comments #49257

Closed
maja42 opened this issue Nov 1, 2021 · 3 comments
Closed

Disallow LTR, RTL & co. characters in comments #49257

maja42 opened this issue Nov 1, 2021 · 3 comments

Comments

@maja42
Copy link

maja42 commented Nov 1, 2021

There's a new source code vulnerability (CVE-2021-42574) that also affects go source code, where attackers can manipulate comment strings to change the behaviour of an application in a way a reviewer will not easily recognize.
This is especially true for a statically compiled language like go, where developers are supposed to review their dependencies before they use it.

It's called "Trojan Source" and is explained here: https://trojansource.codes/
The page also links to the paper, showing the affected unicode characters.

POC: https://play.golang.org/p/UhpMaSsCgth

There was already a comment added here recently, but I think this vulnerability deserves it's own issue: #20209 (comment)

I suggest disallowing such characters in comment strings (or anywhere outside string literals), or - if possible - allowing them, as long as they only affect the content within their own scope/comment to continue support for other locales.
The alternative is for developers to depend on their IDEs/editors/review-tools to display such characters as problematic. Maybe the go playground should do the same?

Note that github already marks such files as potentially dangerous: https://github.com/nickboucher/trojan-source/blob/main/Go/commenting-out.go

Does this issue reproduce with the latest release?

yes

@karalabe
Copy link
Contributor

karalabe commented Nov 1, 2021

This report is an exact duplicate of the thread you linked #20209

@seankhliao
Copy link
Member

Duplicate of #20209

@seankhliao seankhliao marked this as a duplicate of #20209 Nov 1, 2021
@komuw
Copy link
Contributor

komuw commented Nov 1, 2021

@golang golang locked and limited conversation to collaborators Nov 1, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

5 participants