Skip to content

fixed #12517 - added initial safety guide [skip ci] - #7995

Open
firewave wants to merge 1 commit into
cppcheck-opensource:mainfrom
firewave:safety-md
Open

fixed #12517 - added initial safety guide [skip ci]#7995
firewave wants to merge 1 commit into
cppcheck-opensource:mainfrom
firewave:safety-md

Conversation

@firewave

Copy link
Copy Markdown
Collaborator

No description provided.

@sonarqubecloud

Copy link
Copy Markdown

@firewave
firewave force-pushed the safety-md branch 2 times, most recently from 31eec5f to b8c2036 Compare January 10, 2026 03:15
@firewave
firewave marked this pull request as ready for review January 10, 2026 03:15
Comment thread SAFETY.md Outdated
Comment thread SAFETY.md Outdated
Comment thread SAFETY.md Outdated
Comment thread SAFETY.md Outdated
@firewave

Copy link
Copy Markdown
Collaborator Author

As a side note - I am considering making the tree read-only in the CI before invoking the selfchecks. Clearing PATH and explicitly specifying the Python executable is also something to consider. Will file a ticket later.

There's possibly a few more tickets which can come out of this guide.

@firewave
firewave force-pushed the safety-md branch 2 times, most recently from ad65789 to 044fb3c Compare January 11, 2026 12:32
@firewave

Copy link
Copy Markdown
Collaborator Author

As a side note - I am considering making the tree read-only in the CI before invoking the selfchecks. Clearing PATH and explicitly specifying the Python executable is also something to consider. Will file a ticket later.

I filed https://trac.cppcheck.net/ticket/14382#ticket and https://trac.cppcheck.net/ticket/14383 about this.

Comment thread SAFETY.md Outdated
Comment thread SAFETY.md Outdated
Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

Please retry analysis of this Pull-Request directly on SonarQube Cloud

Comment thread SAFETY.md
Comment thread SAFETY.md
@danmar

danmar commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

I don't understand the exact purpose of this document. Is it for developers or for certain users or both?

@danmar

danmar commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

from the ticket:

  • the processes which will be invoked (python, clang, clang-tidy, etc.)
  • required permissions and controlling them (e.g. #14237)
  • what files will be written and controlling where they will be written

these would be interesting to a security department when determining if Cppcheck is allowed.. is this a purpose? If we use processes or threads does not seem interesting to them right? but others could be interested in that.

@danmar

danmar commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

these would be interesting to a security department when determining if Cppcheck is allowed

for the security department it would be interesting to know what network connections we use.. but that info might be out of scope for "safety" I guess.

@firewave

firewave commented Jan 15, 2026

Copy link
Copy Markdown
Collaborator Author

these would be interesting to a security department when determining if Cppcheck is allowed.. is this a purpose?

The purpose is to document how to harden the environment in which Cppcheck is run. It is unlikely that somebody will leverage a memory error in Cppcheck to execute an exploit. But the job could be compromised in another way and it makes sense to be able to minimize the attack vector.

I plan to use this information (along with other best practices) to write a reference GitHub action (maintained externally so it doesn't fall under the GPL).

If we use processes or threads does not seem interesting to them right? but others could be interested in that.

That is a technical detail. The important part is that the main process will be intact and you will get a result. And that is what the section should say. I will try to re-phrase that in a more common way

these would be interesting to a security department when determining if Cppcheck is allowed

for the security department it would be interesting to know what network connections we use.. but that info might be out of scope for "safety" I guess.

Good point. I only wrote it from the view of the CLI. The GUI has the update check if I recall correctly.

@danmar

danmar commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Good point. I only wrote it from the view of the CLI. The GUI has the update check if I recall correctly.

ok I have the feeling that the GUI does not use any network connections but please feel free to check. I know cppcheclipse does have an update check.

@firewave

Copy link
Copy Markdown
Collaborator Author

ok I have the feeling that the GUI does not use any network connections but please feel free to check. I know cppcheclipse does have an update check.

The GUI contains an online version check - you added it yourself in 94c3108.

Comment thread SAFETY.md

### Providing Process Stability

The leniency means that code which is invalid will not be rejected outright. So it is possible to trigger an assertion or crash within Cppcheck causing the process to exit prematurely.

@danmar danmar Feb 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be worth talking about what happens if the analysis of a file is aborted (when there is some kind of critical error). In CI I would say that --safety could be a good idea. In IDEs where analysis happens during editing I think that --safety is not a good idea.

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.

2 participants