
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
97 lines
2.4 KiB
Plaintext
97 lines
2.4 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
== Sensitive Code Example
|
|
|
|
These clients from https://commons.apache.org/proper/commons-net/[Apache commons net] libraries are based on unencrypted protocols and are not recommended:
|
|
|
|
[source,kotlin]
|
|
----
|
|
val telnet = TelnetClient(); // Sensitive
|
|
|
|
val ftpClient = FTPClient(); // Sensitive
|
|
|
|
val smtpClient = SMTPClient(); // Sensitive
|
|
----
|
|
|
|
Unencrypted HTTP connections, when using https://square.github.io/okhttp/https/[okhttp] library for instance, should be avoided:
|
|
|
|
[source,kotlin]
|
|
----
|
|
val spec: ConnectionSpec = ConnectionSpec.Builder(ConnectionSpec.CLEARTEXT) // Sensitive
|
|
.build()
|
|
----
|
|
|
|
Android WebView can be configured to allow a secure origin to load content from any other origin, even if that origin is insecure (mixed content):
|
|
|
|
[source,kotlin]
|
|
----
|
|
import android.webkit.WebView
|
|
|
|
val webView: WebView = findViewById(R.id.webview)
|
|
webView.getSettings().setMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW) // Sensitive
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
Use instead these clients from https://commons.apache.org/proper/commons-net/[Apache commons net] and http://www.jcraft.com/jsch/[JSch/ssh] library:
|
|
|
|
[source,kotlin]
|
|
----
|
|
JSch jsch = JSch();
|
|
|
|
if(implicit) {
|
|
// implicit mode is considered deprecated but offer the same security than explicit mode
|
|
val ftpsClient = FTPSClient(true);
|
|
}
|
|
else {
|
|
val ftpsClient = FTPSClient();
|
|
}
|
|
|
|
if(implicit) {
|
|
// implicit mode is considered deprecated but offer the same security than explicit mode
|
|
val smtpsClient = SMTPSClient(true);
|
|
}
|
|
else {
|
|
val smtpsClient = SMTPSClient();
|
|
smtpsClient.connect("127.0.0.1", 25);
|
|
if (smtpsClient.execTLS()) {
|
|
// commands
|
|
}
|
|
}
|
|
----
|
|
|
|
Perform HTTP encrypted connections, with https://square.github.io/okhttp/https/[okhttp] library for instance:
|
|
|
|
[source,kotlin]
|
|
----
|
|
val spec: ConnectionSpec =ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
|
|
.build()
|
|
----
|
|
|
|
The most secure mode for Android WebView is ``++MIXED_CONTENT_NEVER_ALLOW++``:
|
|
[source,kotlin]
|
|
----
|
|
import android.webkit.WebView
|
|
|
|
val webView: WebView = findViewById(R.id.webview)
|
|
webView.getSettings().setMixedContentMode(MIXED_CONTENT_NEVER_ALLOW)
|
|
----
|
|
|
|
include::../exceptions.adoc[]
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|