guillaumeaubert / Perl-Critic-Policy-ValuesAndExpressions-PreventSQLInjection

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.
https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::PreventSQLInjection
Other
6 stars 8 forks source link

reset `_sqlsafe` when scanning multiple documents; added tests #22

Open cngarrison opened 5 years ago

cngarrison commented 5 years ago

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.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 97.059% when pulling acf41ec6988413d15bf2cfe25c97dbdc28275b11 on cngarrison:master into 13fa7f035842886ac80ceea1e3904398e7771e9b on guillaumeaubert:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 97.059% when pulling 8941b13e9570d2fb36d1577a81d4645e6fd4d15d on cngarrison:master into 13fa7f035842886ac80ceea1e3904398e7771e9b on guillaumeaubert:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 97.059% when pulling acf41ec6988413d15bf2cfe25c97dbdc28275b11 on cngarrison:master into 13fa7f035842886ac80ceea1e3904398e7771e9b on guillaumeaubert:master.