-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPCS_SecurityAudit is too strict #37
Comments
I tried a few things here and there. I tried setting |
phpcs-security-audit main author here. I can confirm that by design if you want to block commit you should be only looking at errors, not warning. The tool is designed to report warnings for manual review required, and errors when it's pretty sure it's a vulnerability. You should be able to change the severity inside the Note that Last but not least, there is still a way for you to block commits on all error or warning. You have to change the way you suppress the finding. Instead of changing the rule itself, you should consider inline annotation in the code that is generating the issue. This is very useful on high importance code base as you want to ensure a warning is raised on new code that is at risk, but not raising the same warning over and over on the same line of code that you previously manually identified as safe. See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file. |
While I understand the need for static security scanners, it can be quite confusing to see those warnings that block your commit. There's no good documentation which also stated in the package issue queue FloeDesignTechnologies/phpcs-security-audit#44 You have to google and dig into the code to understand what is going on. All in all you get smarter if you're up for it but it can easily lead to frustration or skipping validation the default action.
Some of the examples and answers that I've found
On php.net it says "Warning: For now, this function is not available on non-POSIX compliant systems except Windows." As I understand it does not concern us as we are not using non-POSIX systems. https://en.wikipedia.org/wiki/POSIX#POSIX-certified macOS os certififed POSIX. Linux is in the https://en.wikipedia.org/wiki/POSIX#Mostly_POSIX-compliant but obviously it works. So good to know but why is it blocking the commit, one might ask
From code I found link and all the other callback functions in PHP:
So the link goes to http://stackoverflow.com/questions/3115559/exploitable-php-functions and there it says
So all in all you have to be careful and there's another comment on the issue:
At the moment we are banning them if commit does not go through.
Would it be possible to allow warning to go through? I think in the configuration it's possible to change the rule from warning to error and vice versa. It could mean lot of custom configuration though.
Or should we disable the security thing by default?
Should we create documentation in the security package wiki for example?
The text was updated successfully, but these errors were encountered: