New rule S6640: Allowing unsafe code is security-sensitive #7290
Labels
Area: C#
C# rules related issues.
Area: Security
Related to Vulnerability and Security Hotspot rules
Type: New Rule
Implementation for a rule that HAS been specified.
Milestone
Why
C# allows for unsafe code blocks, where it is possible to define pointer types, fixed buffers, to use manual memory allocation,... The CLR cannot verify the safety of this code, therefore it can in some circumstances lead to unexpected behavior and security risks.
Detection logic
All unsafe code blocks should be detected. This can either be a keyword in a method header, or a keyword for a block expression. Examples and more information can be found in the language reference.
Examples
Sensitive
Compliant
RSPEC
The relevant RSPEC PR can be found here. It also contains additional information regarding the issue message and highlighting.
The text was updated successfully, but these errors were encountered: