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
As an engineer, I want to be warned early when my Swift code is trying to shell out for things that Swift libraries already provide, such as:
curl/wget (Can probably use URLRequest)
sed/awk/gawk/nawk (Can use NSRegularExpression)
jq (Can use JSONSerialization)
This rule would encourage more performant applications, remove dependencies on unnecessary software components, reduce attack surfaces, and increase cross-platform support, by avoiding relying on platform-specific shell command syntax.
Example triggers:
Supplying a Process object with a launchPath ending with curl, wget, sed, awk, jq, jq.exe, etc.
Example non-triggers:
Supplying a Process object with an argument of curl, wget, sed, awk, jq, jq.exe, etc.
This rule should contain a limited number of common shell commands, such as those listed above. We can add more over time. Configuration for this rule should be able to customize which of these command patterns is relevant to the user's Swift project.
As a security concern, this rule can reasonably become a default rule, as shelling out introduces additional security risks, including shell injections, compared to sticking to pure Swift code.
I would be happy to see this rule be included in Swift's available suite of checks, and if we find we're happy to apply it in a lot of places, then we can always turn it on by default later.
The text was updated successfully, but these errors were encountered:
New Issue Checklist
New rule request
As an engineer, I want to be warned early when my Swift code is trying to shell out for things that Swift libraries already provide, such as:
curl
/wget
(Can probably useURLRequest
)sed
/awk
/gawk
/nawk
(Can useNSRegularExpression
)jq
(Can useJSONSerialization
)This rule would encourage more performant applications, remove dependencies on unnecessary software components, reduce attack surfaces, and increase cross-platform support, by avoiding relying on platform-specific shell command syntax.
Example triggers:
curl
,wget
,sed
,awk
,jq
,jq.exe
, etc.Example non-triggers:
curl
,wget
,sed
,awk
,jq
,jq.exe
, etc.This rule should contain a limited number of common shell commands, such as those listed above. We can add more over time. Configuration for this rule should be able to customize which of these command patterns is relevant to the user's Swift project.
As a security concern, this rule can reasonably become a default rule, as shelling out introduces additional security risks, including shell injections, compared to sticking to pure Swift code.
I would be happy to see this rule be included in Swift's available suite of checks, and if we find we're happy to apply it in a lot of places, then we can always turn it on by default later.
The text was updated successfully, but these errors were encountered: