PerlCritic policy that attempts to detect the most common sources of SQL injection in manually crafted SQL statements, by detecting the use of variables inside interpolated strings that look like SQL statements.
I was getting false positives for violations marked as safe, when scanning multiple documents.
I have overridden the prepare_to_scan_document method from Perl::Critic::Policy to reset the _sqlsafe attribute. Resetting the attribute for each document fixes the problem.
I also added some tests. Running the test against the current version will fail. The tests pass with the changes in this PR.
Coverage remained the same at 97.059% when pulling acf41ec6988413d15bf2cfe25c97dbdc28275b11 on cngarrison:master into 13fa7f035842886ac80ceea1e3904398e7771e9b on guillaumeaubert:master.
Coverage remained the same at 97.059% when pulling 8941b13e9570d2fb36d1577a81d4645e6fd4d15d on cngarrison:master into 13fa7f035842886ac80ceea1e3904398e7771e9b on guillaumeaubert:master.
Coverage remained the same at 97.059% when pulling acf41ec6988413d15bf2cfe25c97dbdc28275b11 on cngarrison:master into 13fa7f035842886ac80ceea1e3904398e7771e9b on guillaumeaubert:master.
I was getting false positives for violations marked as safe, when scanning multiple documents.
I have overridden the
prepare_to_scan_document
method fromPerl::Critic::Policy
to reset the_sqlsafe
attribute. Resetting the attribute for each document fixes the problem.I also added some tests. Running the test against the current version will fail. The tests pass with the changes in this PR.