Skip to content

Make Curl CA path ownership safe#1464

Open
bmehta001 wants to merge 7 commits into
microsoft:mainfrom
bmehta001:bhamehta/curl-ca-path-ownership
Open

Make Curl CA path ownership safe#1464
bmehta001 wants to merge 7 commits into
microsoft:mainfrom
bmehta001:bhamehta/curl-ca-path-ownership

Conversation

@bmehta001
Copy link
Copy Markdown
Contributor

This is split out of #1416 to keep the review surface small and focused.

Changes:

  • Store Curl CA path strings with stable ownership.
  • Avoid keeping pointers to transient or externally-owned string data in Curl option storage.

Validation performed locally:

  • git diff --check

Split the Curl CA path fix into a smaller review slice. Store CA path strings with stable ownership so Curl options do not keep pointers to transient or externally-owned string data.

Files changed: lib/http/HttpClient_Curl.hpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 requested a review from a team as a code owner June 5, 2026 03:14
@bmehta001 bmehta001 requested a review from Copilot June 5, 2026 03:19
@bmehta001 bmehta001 self-assigned this Jun 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the safety of libcurl option configuration by ensuring the CA bundle path passed to CURLOPT_CAINFO has stable ownership for the lifetime of a CurlHttpOperation.

Changes:

  • Persist the sslCaInfo string inside CurlHttpOperation (m_sslCaInfo) instead of relying on a potentially transient caller-owned string.
  • Update CURLOPT_CAINFO setup to use the owned m_sslCaInfo buffer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/http/HttpClient_Curl.hpp
@bmehta001 bmehta001 force-pushed the bhamehta/curl-ca-path-ownership branch from ec189ee to 1367e82 Compare June 5, 2026 15:33
Explain why CurlHttpOperation owns the CA path string but intentionally does not copy the request body. The SDK upload path keeps the request alive until Send completes, and copying the body would duplicate every upload payload.

Files changed: lib/http/HttpClient_Curl.hpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bmehta001 and others added 3 commits June 5, 2026 10:50
Explain that request headers are copied into the owned curl_slist during construction, so CurlHttpOperation does not need to keep the original header map alive for the operation lifetime.

Files changed: lib/http/HttpClient_Curl.hpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread lib/http/HttpClient_Curl.hpp Outdated
Comment thread lib/http/HttpClient_Curl.hpp Outdated
bmehta001 and others added 2 commits June 5, 2026 15:26
Co-authored-by: Baiju Meswani <baijumeswani@gmail.com>
Apply the reviewed header-loop cleanup and modernize a few local internals in HttpClient_Curl.hpp without changing behavior. This preserves the existing request-body lifetime model while reducing unnecessary casts/null usage and avoiding loss of the old response buffer if realloc fails.

Files changed: lib/http/HttpClient_Curl.hpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants