You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Whitelist lines ending in # nosec #108
So both detect-secrets and Bandit have the concept of whitelisting a line by putting a comment at the end, similar to how you've probably seen people do # noqa: F401 or whatever, with pylint.
Let us steal once again, from Bandit, since they are most similar to us, here are the relevant lines, but we shall change lineno + 1 for to enumerate(lines, start=1) because it is more pythonic.
They also have the --ignore-nosec do not skip lines with # nosec comments command line optionso we shall pass in the set of lines to the 2 calls tofind_vulnerabilities` in __main__,
This may be the preference of a security team, as the code may change in the future, and it's more dangerous to have the sink be whitelisted, because there may be multiple vuln chains.
I forgot to say this before, but after passing the set of lines to find_vulnerabilities we can ignore both sources and sinks in the same function, find_triggers, something like if node.lineno not in nosec_lines:
Activity
KevinHock commentedon Apr 14, 2018
While I initially thought we would just give the option to add
# nosecto the sinks, e.g.We can, without writing any more lines of code, give the option to add
# nosecto the sources, e.g.This may be the preference of a security team, as the code may change in the future, and it's more dangerous to have the sink be whitelisted, because there may be multiple vuln chains.
KevinHock commentedon Apr 14, 2018
Would you like to take this one, @omergunal?
omergunal commentedon Apr 14, 2018
sure
KevinHock commentedon Apr 14, 2018
I forgot to say this before, but after passing the set of lines to
find_vulnerabilitieswe can ignore both sources and sinks in the same function, find_triggers, something likeif node.lineno not in nosec_lines:KevinHock commentedon Apr 14, 2018
Also for some reason I cannot 'Assign' you the issue in GitHub, maybe you can assign yourself.
omergunal commentedon Apr 14, 2018
I couldnt do
nosec_lines for python-security#108's issue
KevinHock commentedon Apr 28, 2018
Woohoo 👍