diff --git a/phpmon/Common/Helpers/Application.swift b/phpmon/Common/Helpers/Application.swift index 950d0c99..d94a53e3 100644 --- a/phpmon/Common/Helpers/Application.swift +++ b/phpmon/Common/Helpers/Application.swift @@ -32,10 +32,13 @@ class Application { /// The full path to the application bundle (if found) var path: String? + /// Characters that are unsafe for shell interpolation inside double quotes. + private static let unsafeCharacters: Set = ["\"", "\\", "`", "$", ";", "|", "&", "!", "#"] + /// Initializer. Used to detect a specific app of a specific type. init(_ container: Container, _ name: String, _ type: AppType) { self.container = container - self.name = name + self.name = String(name.filter { !Application.unsafeCharacters.contains($0) }) self.type = type self.path = determinePath() }