Title: Add CWE-295 query for C# (accepting any TLS certificate) by Copilot · Pull Request #22019 · github/codeql · GitHub
Open Graph Title: Add CWE-295 query for C# (accepting any TLS certificate) by Copilot · Pull Request #22019 · github/codeql
X Title: Add CWE-295 query for C# (accepting any TLS certificate) by Copilot · Pull Request #22019 · github/codeql
Description: C# lacked a CWE-295 (Improper Certificate Validation) query that other languages already ship. This adds one detecting TLS/SSL certificate validation callbacks that trust every certificate, enabling machine-in-the-middle attacks. Query New cs/accept-any-certificate (Security Features/CWE-295/AcceptAnyCertificate.ql), a path-problem dataflow query. Source: a callback that always returns true — a lambda/anonymous method, a method-group reference to a method that always returns true, or HttpClientHandler.DangerousAcceptAnyServerCertificateValidator. Sink: a value used as a certificate validation callback — assigned to, or passed as an argument of, a delegate type returning bool with a System.Net.Security.SslPolicyErrors parameter. Covers RemoteCertificateValidationCallback (ServicePointManager, HttpWebRequest, SslStream) and HttpClientHandler.ServerCertificateCustomValidationCallback. Acceptance is determined structurally: every returned value is the constant true, so callbacks that inspect SslPolicyErrors are not flagged. Supporting files .qhelp with good/bad samples, and a newQuery change note. Query test under query-tests/Security Features/CWE-295/ covering inline lambdas, block bodies, method groups, SslStream, variable indirection, and the built-in dangerous validator, plus negative cases that perform real validation. // Flagged: trusts any certificate handler.ServerCertificateCustomValidationCallback = (request, certificate, chain, errors) => true; // Not flagged: only trusts when validation succeeds handler.ServerCertificateCustomValidationCallback = (request, certificate, chain, errors) => errors == SslPolicyErrors.None; The query resolves into the default csharp-code-scanning suite via its metadata.
Open Graph Description: C# lacked a CWE-295 (Improper Certificate Validation) query that other languages already ship. This adds one detecting TLS/SSL certificate validation callbacks that trust every certificate, enablin...
X Description: C# lacked a CWE-295 (Improper Certificate Validation) query that other languages already ship. This adds one detecting TLS/SSL certificate validation callbacks that trust every certificate, enablin...
Opengraph URL: https://github.com/github/codeql/pull/22019
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c13d69fb-98bd-39b4-27ac-dcce6454490c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9720:34ED9:794536:B1F33B:6A4E151F |
| html-safe-nonce | 14cde12c213b49f840abff89b3097b44abf747947ad0d9d74798bdc34d035ae9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzIwOjM0RUQ5Ojc5NDUzNjpCMUYzM0I6NkE0RTE1MUYiLCJ2aXNpdG9yX2lkIjoiMjE0NDQzNzU1MTYwMjk5NjUxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7a9726ccd9c7b518dcef9e68ad597e6421932fdf837715413d69a03f140275db |
| hovercard-subject-tag | pull_request:3899264685 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/github/codeql/pull/22019/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | C# lacked a CWE-295 (Improper Certificate Validation) query that other languages already ship. This adds one detecting TLS/SSL certificate validation callbacks that trust every certificate, enablin... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/github/codeql git https://github.com/github/codeql.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 143040428 |
| octolytics-dimension-repository_nwo | github/codeql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143040428 |
| octolytics-dimension-repository_network_root_nwo | github/codeql |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ea9187571e3edc5f2780f750631138669441ca50 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width