Commit ef82617
Python: fix py/insecure-protocol false positive on ssl.create_default_context()
Since Python 3.10, `ssl.create_default_context()` returns a context whose
`minimum_version` defaults to `TLSVersion.TLSv1_2`, so TLS 1.0 and TLS 1.1 are
not allowed. The model previously encoded the pre-3.10 behavior and flagged
these versions as allowed, producing false positives.
Update `SslDefaultContextCreation` to allow only TLSv1_2 and TLSv1_3, refresh
the test expectations, and add a regression test for the common safe case.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>1 parent d86ec1a commit ef82617
4 files changed
Lines changed: 20 additions & 4 deletions
File tree
- python/ql
- src
- Security/CWE-327
- change-notes
- test/query-tests/Security/CWE-327-InsecureProtocol
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
0 commit comments