Skip to main content
98 votes
Accepted

Is it a security vulnerability to declare class members as public?

Access modifiers like public/private/protected are not intended as a security boundary. And since C++ is not a memory-safe language, this cannot be a security boundary. The laziest “attack” to access ...
amon's user avatar
  • 135k
14 votes

Is it a security vulnerability to declare class members as public?

Using public and private correctly (and following good practices in general) helps you write better code with fewer bugs, and code with fewer bugs is typically harder for an attacker to exploit. ...
forest's user avatar
  • 414
8 votes

Is it a security vulnerability to declare class members as public?

Private and protected do not provide any security at all. Why? Because they are in your source code. They only affect code written by someone with access to your source code. If I have access to your ...
gnasher729's user avatar
  • 45.9k
7 votes

Is it a security vulnerability to declare class members as public?

I have always wondered whether public, protected, and private has security implications post compilation. Since you're asking about C++, I'd say the answer is "not per se" (unless this ...
Zoë Sparks's user avatar
4 votes
Accepted

How do projects manage security with so many dependencies in open source projects?

This is a reason why there are a number of tools to audit open source libraries in your dependencies. In fact if you search for "open source auditing tools" you will find a list of several companies ...
Berin Loritsch's user avatar
3 votes

Is it a security vulnerability to declare class members as public?

No Reason: Once compiled, private, protected and public are gone. In C++, you can think about these keywords as nothing more or less than directives to tell the compiler that certain member accesses ...
cmaster - reinstate monica's user avatar
2 votes

Is it a security vulnerability to declare class members as public?

For public/protected/private to be making a difference, you would have to be allowing someone to compile and link their C++ code against your headers & binary. If someone already has that much ...
Ben's user avatar
  • 1,027
1 vote

Is it a security vulnerability to declare class members as public?

Security implies that you wish to protect something. Anyone with the right tools can disassemble the binary, look at what is being done, and, with enough time and experience, can reasonably infer the ...
Fabian Sievert's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible