Skip to content

cmd/go: go-import meta tag can redirect to insecure location #78805

Description

@neild

When the go command issues an HTTP request to find the repository URL for a module, it expects to receive a response containing a <meta> tag:

<meta name="go-import" content="root-path vcs repo-url [subdirectory]">

From https://go.dev/ref/mod#vcs-find:

repo-url is the repository’s URL, containing a scheme and not containing a .vcs qualifier. Insecure protocols (like http:// and git://) may only be used if the module path is matched by the GOINSECURE environment variable.

The go command currently does not implement the requirement that the repository URL be either secure (like https://) or matched by the GOINSECURE environment variable.

This was reported to us as a potential vulnerability. Our conclusion is that while this is a bug, we cannot see any plausible path for an attacker to exploit it. The impact of this bug is that an attacker who controls the module path in the <meta> tag can cause the module to be served over an unencrypted transport. This doesn't aid in serving a malicious module, since a malicious module can be served over an encrypted transport.

It's still a bug and we should fix it.

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/go

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions