-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Swift: Promote the command injection query out of experimental #14701
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
Conversation
QHelp previews: swift/ql/src/queries/Security/CWE-078/CommandInjection.qhelpSystem command built from user-controlled sourcesConstructing a system command with unsanitized user input is dangerous, since a malicious user may be able to craft input that executes arbitrary code. RecommendationIf possible, use hard-coded string literals to specify the command to run. Instead of interpreting user input directly as command names, examine the input and then choose among hard-coded string literals. If this is not possible, then add sanitization code to verify that the user input is safe before using it. ExampleThe following example executes code from user input without sanitizing it first:
If user input is used to construct a command it should be checked first. This ensures that the user cannot insert characters that have special meanings:
References
|
DCA looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, but otherwise this LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 from Docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Promote
swift/command-line-injection
out from experimental. The query was added in #13726 and has evolved a bit while in experimental (in particular #13906, #14357 and #14661 - the latter is yet to be merged but should not conflict with this PR).@maikypedia FYI
TODO: