-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rule/S4426-add-go
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
include::../summary.adoc[] | ||
|
||
== Why is this an issue? | ||
|
||
include::../rationale.adoc[] | ||
|
||
include::../impact.adoc[] | ||
|
||
// How to fix it section | ||
|
||
== How to fix it | ||
|
||
=== Code examples | ||
|
||
include::../common/fix/code-rationale.adoc[] | ||
|
||
Hostname validation is disabled if ``++InsecureSkipVerify++`` is set to `true` for ``++TLSClientConfig++`` used for the transport class. | ||
|
||
For HTTPS, it is recommended to use high-level interfaces (like ``++http.Get()++``), which perform the certificate validation instead of using ``++http.Client++`` directly. | ||
|
||
==== Noncompliant code example | ||
|
||
[source,go,diff-id=1,diff-type=noncompliant] | ||
---- | ||
client := &http.Client{ | ||
Transport: &http.Transport{ | ||
TLSClientConfig: &tls.Config{ | ||
InsecureSkipVerify: true, // Noncompliant | ||
}, | ||
}, | ||
} | ||
client.Get("https://example.com") | ||
---- | ||
|
||
==== Compliant solution | ||
|
||
Usage of high-level interfaces is recommended: | ||
[source,go,diff-id=1,diff-type=compliant] | ||
---- | ||
http.Get("https://example.com") | ||
---- | ||
|
||
=== How does this work? | ||
|
||
include::../common/fix/validation.adoc[] | ||
|
||
== Resources | ||
|
||
include::../common/resources/standards.adoc[] | ||
|
||
ifdef::env-github,rspecator-view[] | ||
|
||
''' | ||
== Implementation Specification | ||
(visible only on this page) | ||
|
||
include::../message.adoc[] | ||
|
||
''' | ||
== Comments And Links | ||
(visible only on this page) | ||
|
||
include::../comments-and-links.adoc[] | ||
|
||
endif::env-github,rspecator-view[] | ||
|