Skip to content

Harden the HTTPS authority host check to explicitly check for https and disallow everything else #37236

Description

@ahsonkhan

The Java check needs to be hardened. Unlike the other language SDKs, which check that the scheme string is exactly HTTPS and fails otherwise, the Java check only confirms that it is "not HTTP" (and assumes anything else is "HTTPS"). That, along with the fact that the setter doesn't do any checking, there could be a way for a malformed authority host url to get through.

Comparing to other languages, this check:

if ("http".equals(context.getHttpRequest().getUrl().getProtocol())) {
return Mono.error(new RuntimeException("token credentials require a URL using the HTTPS protocol scheme"));
}

Should be something like the following (unless we have other non-HTTP supported schemes beyond HTTPS in Java): if (!context.getHttpRequest().getUrl().getProtocol().equals("https")

Introduced in this PR (the intent of which I gather is to only allow HTTPS): #6543

cc @joshfree, @billwert

Metadata

Metadata

Assignees

Labels

Azure.Coreazure-coreClientThis issue points to a problem in the data-plane of the library.

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions