>
>
PVS-Studio 7.13: SQL injections, Blame …

Andrey Karpov
Articles: 671

PVS-Studio 7.13: SQL injections, Blame Notifier, .NET 5

The newest PVS-Studio static analyzer version will please you with these features: tainted data analysis, .NET 5 support. The Blame Notifier utility can now sort warnings by commit date.

Note that the PVS-Studio product's website now has a new address and design. Check it out here: https://pvs-studio.com. If you notice any errors on the website, we will be glad if you inform us about them.

Tainted data analysis, SQL injections

PVS-Studio for C++ has long had mechanisms for finding code fragments that use unchecked source data. Sergey Vasiliev wrote an article "Shoot yourself in the foot when handling input data" on this topic back in 2018. Now Sergey is the head of C# department. He has applied his knowledge and experience to develop the tainted data analysis in the C# analyzer's core.

The first rule from the OWASP ASVS standard appeared in the PVS-Studio C# analyzer. This diagnostic detects errors related to tainted data. It is the V5608 diagnostic rule that searches for potential SQL injections. This class of errors still leads in the OWASP Top 10 chart. In future PVS-Studio versions, we plan to add diagnostic rules to detect many other types of potential tainted data vulnerabilities.

.NET 5

PVS-Studio now fully supports the analysis of projects that focus on .NET 5 and use C# 9 capabilities. In addition, C# analyzer under Linux and macOS also uses the .NET 5 platform for its work. Therefore, the above systems will require a .NET 5 SDK package installed. The analyzer Windows version uses .NET Framework 4.7.2 as before.

Find out details in the article "Finally! PVS-Studio Supports .NET 5 Projects".

Blame Notifier

The Blame Notifier utility allows you to automatically distribute warnings based on blame information from the version control system. From now on, the utility can sort warnings by commit number and date. This lets you see warnings that appeared during a certain day.

Previously, similar function was only available when using PVS-Studio with SonarQube. Not all of our users want to use SonarQube, but most of them need to sort warnings by date. Now we have more options and scenarios. Read more: New capabilities of PVS-Studio to notify developers of errors found.

Note. Speaking about reports, we'd like to point out a new third-party utility. Now Blame Notifier is not the only option how you can automatically publish reports. Our user wrote a lightweight analog of this utility. It does not require .NET to work. Try it on GitHub (Blame Notifier Script ).

16 new diagnostics

  • V832. It's better to use '= default;' syntax instead of empty body.
  • V1070. Signed value is converted to an unsigned one with subsequent expansion to a larger type in ternary operator.
  • V1071. Consider inspecting the 'foo' function. The return value is not always used.
  • V1072. The buffer is securely cleared not on all execution paths.
  • V1073. Consider checking for misprints. Check the following code block after the 'if' statement.
  • V2577. MISRA. The function argument corresponding to a parameter declared to have an array type should have an appropriate number of elements.
  • V2578. MISRA. An identifier with array type passed as a function argument should not decay to a pointer.
  • V2579. MISRA. Macro should not be defined with the same name as a keyword.
  • V2580. MISRA. The 'restrict' specifier should not be used.
  • V2581. MISRA. Single-line comments should not end with a continuation token.
  • V2582. MISRA. Block of memory should only be freed if it was allocated by a Standard Library function.
  • V3170. Both operands of the '??' operator are identical.
  • V3171. Potentially negative value is used as the size of an array.
  • V3551. AUTOSAR. An identifier with array type passed as a function argument should not decay to a pointer.
  • V5013. OWASP. Storing credentials inside source code can lead to security issues.
  • V5608. OWASP. Possible SQL injection. Potentially tainted data is used to create SQL command.

Other features

  • The C++ analyzer provides enhanced support of Ninja projects on Windows using JSON Compilation Database (compile_commands.json).
  • The C++ PVS-Studio analyzer spends 10% less time checking source files with the use of the Clang compiler.
  • The PVS-Studio plugin for JetBrains Rider now works with the Rider 2021.1 version.
  • To check C++ and C# Visual Studio PVS-Studio_Cmd.exe projects, you can pass the suppression file directly. Before this, you could add suppressed warnings only at the projects and solution level.

Articles posted after the previous release