Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 384cf4b

Browse files
committed
CPP: Recommendation and example for UseOfDeprecatedHardcodedProtocol.qhelp.
1 parent 8fc59eb commit 384cf4b

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

cpp/ql/src/Likely Bugs/Protocols/UseOfDeprecatedHardcodedProtocol.qhelp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
<p>Using a deprecated hardcoded protocol instead of negotiating would lock your application to a protocol that has known vulnerabilities or weaknesses.</p>
88
</overview>
99

10+
<recommendation>
11+
<p>Only use modern protocols such as TLS 1.2 or TLS 1.3.</p>
12+
</recommendation>
13+
14+
<example>
15+
<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>
16+
<sample src="UseOfDeprecatedHardcodedProtocolBad.cpp"/>
17+
<p>In the corrected example, the <code>tlsv13</code> protocol is used instead.</p>
18+
<sample src="UseOfDeprecatedHardcodedProtocolGood.cpp"/>
19+
</example>
20+
1021
<references>
1122
<li>
1223
<a href="https://www.boost.org/doc/libs/1_71_0/doc/html/boost_asio.html">Boost.Asio documentation</a>.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
void useProtocol_bad()
3+
{
4+
boost::asio::ssl::context ctx_sslv2(boost::asio::ssl::context::sslv2); // BAD: outdated protocol
5+
6+
// ...
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
void useProtocol_bad()
3+
{
4+
boost::asio::ssl::context cxt_tlsv13(boost::asio::ssl::context::tlsv13);
5+
6+
// ...
7+
}

0 commit comments

Comments
 (0)