Skip to content

Adopt modern C++ and get rid of C style coding #6495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pjmlp opened this issue Mar 31, 2025 · 3 comments
Open

Adopt modern C++ and get rid of C style coding #6495

pjmlp opened this issue Mar 31, 2025 · 3 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team

Comments

@pjmlp
Copy link

pjmlp commented Mar 31, 2025

In the ongoing discussion of safety in C++ code bases, it is a bit strange that at the light of Microsoft initiatives like Secure Future Initiative and Azure's security initiatives, as mentioned on Microsoft Azure security evolution: Embrace secure multitenancy, Confidential Compute, and Rust, that Azure C++ SDK still exposes several C like code patterns like C style strings and arrays, instead of safer C++ standard types.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 31, 2025
@LarryOsterman
Copy link
Member

Thank you for the suggestions.

We have two cases where we will use C style APIs and arrays. The first case occurs when we interact with libCURL, AMQP, WinHTTP and other C libraries - since we are interacting with C libraries, we have no choice but to use C style constructs.

The other case which is intentionally made involves static constant C style strings are typically safe, and more importantly, if they were converted to C++ style strings, it would require runtime initialization of the strings at process startup. It is not clear that there is any additional safety associated with converting strings from static C style strings to c++ strings (and because we have standardized on C++ 14 we cannot use constexpr std::string variables).

If there are other examples of us using C style strings in our public API surface, or in our C++ only code, we absolutely should fix them.

It would be appreciated if you could help us out by pointing cases where we are using C style strings in our codebase.

@RickWinter RickWinter added needs-author-feedback Workflow: More information is needed from author to address the issue. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Apr 8, 2025
Copy link

github-actions bot commented Apr 8, 2025

Hi @pjmlp. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@pjmlp
Copy link
Author

pjmlp commented Apr 11, 2025

Hi, these was the kind of code that caught my attention,

int32_t Base64Decode(const char* encodedBytes)

std::string Environment::GetVariable(const char* name)

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

3 participants