mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
CPP: Recommendation and example for UseOfDeprecatedHardcodedProtocol.qhelp.
This commit is contained in:
@@ -7,6 +7,17 @@
|
||||
<p>Using a deprecated hardcoded protocol instead of negotiating would lock your application to a protocol that has known vulnerabilities or weaknesses.</p>
|
||||
</overview>
|
||||
|
||||
<recommendation>
|
||||
<p>Only use modern protocols such as TLS 1.2 or TLS 1.3.</p>
|
||||
</recommendation>
|
||||
|
||||
<example>
|
||||
<p>In the following example, the <code>sslv2</code> protocol is specified. This protocol is out-of-date and its use is not recommended.</p>
|
||||
<sample src="UseOfDeprecatedHardcodedProtocolBad.cpp"/>
|
||||
<p>In the corrected example, the <code>tlsv13</code> protocol is used instead.</p>
|
||||
<sample src="UseOfDeprecatedHardcodedProtocolGood.cpp"/>
|
||||
</example>
|
||||
|
||||
<references>
|
||||
<li>
|
||||
<a href="https://www.boost.org/doc/libs/1_71_0/doc/html/boost_asio.html">Boost.Asio documentation</a>.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
void useProtocol_bad()
|
||||
{
|
||||
boost::asio::ssl::context ctx_sslv2(boost::asio::ssl::context::sslv2); // BAD: outdated protocol
|
||||
|
||||
// ...
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
void useProtocol_bad()
|
||||
{
|
||||
boost::asio::ssl::context cxt_tlsv13(boost::asio::ssl::context::tlsv13);
|
||||
|
||||
// ...
|
||||
}
|
||||
Reference in New Issue
Block a user