class
Analyzer::Swift::Cli
- Analyzer::Swift::Cli
- Analyzer
- Reference
- Object
Overview
Surfaces the command-line attack surface of Swift programs as cli://
endpoints: one endpoint per (sub)command with named options
(param_type "flag"), positional arguments ("argument") and consumed
environment variables ("env"). Covers swift-argument-parser plus builtin
CommandLine.arguments / ProcessInfo.environment / getenv.
Line-scan analyzer (Go/Ruby/Rust CLI house style) merging endpoints by URL. Subclasses Analyzer directly (SwiftEngine#analyze_file is abstract) and reuses SwiftEngine.swift_test_path? to skip tests.
Defined in:
analyzer/analyzers/swift/cli.crConstant Summary
-
ARGS_IDX =
/\bCommandLine\.arguments\s*\[\s*(\d+)\s*\]/ -
ARGUMENT_WRAP =
/@Argument\b/ -
COMMAND_NAME =
/\bcommandName:\s*"([^"]+)"/ -
CUSTOM_LONG =
/name:\s*\.(?:customLong|long)\s*\(\s*"([^"]+)"/ -
GETENV =
/\bgetenv\s*\(\s*"([^"]+)"/ -
OPTION_FLAG =
/@(?:Option|Flag)\b/ -
PARSABLE_STRUCT =
/\b(?:struct|enum|class)\s+(\w+)\s*:\s*[^\{]*\b(?:Async)?ParsableCommand\b/ -
PROC_ENV =
/ProcessInfo(?:\.processInfo|\(\))?\.environment\s*\[\s*"([^"]+)"\s*\]/ -
SUBCOMMANDS_KEY =
/\bsubcommands:/ -
VAR_DECL =
/\bvar\s+(\w+)/ -
WEB_FRAMEWORK_RE =
/\bimport\s+(?:Vapor|Hummingbird\w*|Kitura\w*)\b|\bapp\.environment\b/