fix(filter): don't drop memory-safety findings in .hpp/.cxx/.hh C++ files#110
Closed
vidigoat wants to merge 1 commit into
Closed
fix(filter): don't drop memory-safety findings in .hpp/.cxx/.hh C++ files#110vidigoat wants to merge 1 commit into
vidigoat wants to merge 1 commit into
Conversation
…iles
HardExclusionRules.get_exclusion_reason excluded memory-safety findings for
any file whose extension was not in {.c, .cc, .cpp, .h}. That set omits the
common C++ extensions .hpp, .hh, .cxx, .hxx, .c++, .h++ (and template-impl
.ipp/.tpp/.inl). .hpp is the dominant C++ header extension and, holding inline
and template code, is exactly where memory-safety bugs live, so real findings
there were silently dropped. This contradicts the documented intent of
test_memory_safety_not_excluded_cpp_files. Extend the extension set.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
HardExclusionRules.get_exclusion_reason(claudecode/findings_filter.py) excludes memory-safety findings as "not applicable" for any file whose extension is not in this set:That set omits the common C++ extensions
.hpp,.hh,.cxx,.hxx,.c++,.h++and template-implementation extensions (.ipp,.tpp,.inl)..hppis the dominant C++ header extension, and because headers hold inline functions and templates, they are exactly where memory-safety bugs (buffer overflow, use-after-free, OOB) tend to live. So genuine memory-safety findings in real C++ files were being silently dropped before they could be reported.This contradicts the documented intent of the existing test
test_memory_safety_not_excluded_cpp_files("memory safety issues are NOT excluded in C/C++ files").Reproduction
get_exclusion_reasonon a buffer-overflow finding inobject.hppor a use-after-free inengine.cxxreturns"Memory safety finding in non-C/C++ code (not applicable)"instead ofNone(keep). Onmainthe new test fails for exactly these cases.Fix
Extend
c_cpp_extensionsto include the standard C++ header/source and template-impl extensions.Tests
Added
test_memory_safety_not_excluded_cpp_header_and_alt_extensionscovering.hpp,.cxx,.hh,.hxx,.ipp. It fails onmainand passes with the fix; the fullclaudecodesuite (174 tests) stays green, including the existing case-insensitive and non-C/C++ exclusion tests (a.pymemory-safety finding is still correctly excluded).Authored with AI assistance (Claude); bug reproduced, fix written, and the full test suite verified locally before submitting.