Skip to content

Conversation

Copy link

Copilot AI commented Oct 17, 2025

Problem

The code was explicitly pinning the TLS protocol version to 1.2 using:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

This hardcoded setting in the GenerateSnippetsAsync method prevented the application from:

  • Negotiating newer, more secure TLS versions like TLS 1.3
  • Leveraging modern security improvements in the .NET runtime
  • Following current security best practices for .NET applications

Solution

Removed the explicit TLS version pinning from ApiDoctor.Console/Program.cs (line 1957). The application now relies on .NET 8.0's secure default behavior.

Benefits

  1. Enhanced Security: The application can now use TLS 1.3 when available, which provides better security and performance compared to TLS 1.2

  2. System-Managed Security: .NET 8.0 defaults to SecurityProtocolType.SystemDefault, which allows the operating system to automatically select the most secure protocol available

  3. Backward Compatible: TLS 1.2 remains supported for connections to legacy servers, ensuring no breaking changes to existing functionality

  4. Future-Proof: The application will automatically benefit from future TLS protocol improvements without requiring code changes

Technical Details

In modern .NET (Core 2.1+ and .NET 5+), the default SecurityProtocol is SystemDefault, which:

  • Delegates TLS version selection to the operating system
  • Supports TLS 1.2, TLS 1.3, and future protocols
  • Follows Microsoft's recommended security practices
  • Provides the best balance of security and compatibility

Testing

  • ✅ All 62 existing unit tests pass
  • ✅ Build completes successfully with no new warnings or errors
  • ✅ No functional changes to application behavior

Fixes #<issue_number>

Original prompt

This section details on the original issue you should resolve

<issue_title>Remove pinned TLS1.2 version from ServicePointMgr</issue_title>
<issue_description>https://github.com/OneDrive/apidoctor/blob/master/ApiDoctor.Console/Program.cs#L1936

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #306


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Remove pinned TLS1.2 version from ServicePointMgr Remove pinned TLS 1.2 security protocol to enable modern TLS negotiation Oct 17, 2025
Copilot AI requested a review from MIchaelMainer October 17, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove pinned TLS1.2 version from ServicePointMgr

2 participants