org.sonar.l10n.py.rules.python.S4823.html Maven / Gradle / Ivy
This rule is deprecated, and will eventually be removed.
Using command line arguments is security-sensitive. It has led in the past to the following vulnerabilities:
Command line arguments can be dangerous just like any other user input. They should never be used without being first validated and sanitized.
Remember also that any user can retrieve the list of processes running on a system, which makes the arguments provided to them visible. Thus
passing sensitive information via command line arguments should be considered as insecure.
This rule raises an issue on every reference to sys.argv
, call to optparse.OptionParser()
or a call to
argparse.ArgumentParser()
. The goal is to guide security code reviews.
Ask Yourself Whether
- any of the command line arguments are used without being sanitized first.
- your application accepts sensitive information via command line arguments.
If you answered yes to any of these questions you are at risk.
Recommended Secure Coding Practices
Sanitize all command line arguments before using them.
Any user or application can list running processes and see the command line arguments they were started with. There are safer ways of providing
sensitive information to an application than exposing them in the command line. It is common to write them on the process' standard input, or give the
path to a file containing the information.
See