Analyzer::Cpp::Cli
Inherits CliEndpointSupport < Analyzer < FileHelper < Reference < Object
Surfaces the command-line attack surface of C++ programs as cli://
endpoints: one endpoint per (sub)command with named options
(param_type "flag"), positional arguments ("argument") and consumed
environment variables ("env"). Covers CLI11, getopt/getopt_long, cxxopts,
boost::program_options, gflags, Abseil Flags and p-ranav/argparse, plus
gated getenv reads.
Line-scan analyzer (Go/Ruby/Rust CLI house style) merging endpoints by URL. There is no C++ engine, so it subclasses Analyzer directly.
Constants
Abseil Flags. ABSL_FLAG(type, name, default, help) — the type is
matched with a depth-aware manual scan (see absl_flag_names) rather
than a character-class regex, so a template type with a top-level
comma (e.g. std::map<std::string,int>) doesn't truncate/misparse the
name field.
CLI11. Variable-mapped: an option/flag binds to its receiver variable (app vs a subcommand), so a root option declared after a subcommand isn't mis-attributed to it.
p-ranav/argparse. Declare-then-register style: an ArgumentParser
variable's role (root vs subcommand) is only known once it's observed
either as the receiver of .parse_args(argc, argv) / owner side of
.add_subparser(...), or by elimination when it's the file's only
declared parser. Resolved once per file in resolve_argparse_vars
before options are attributed, so declaration order in the file never
decides which parser is root (a helper-function-local parser can never
be mistaken for the real root).
Whitespace-tolerant substring markers (no trailing "(" on macro-style
entries) so this gate can never diverge from what the extraction
regexes above actually accept, e.g. ABSL_FLAG (int32_t, ...) with a
space before the paren is valid C++ and must not be silently skipped.
Precompiled as a single Regex.union so the per-file evidence gate costs
one PCRE2 match instead of up to ten naive substring scans.
Precompiled union for the per-file test-path skip gate (cpp_test_path?), matched via String#matches? instead of five naive substring scans.
gflags.
getopt_long struct option entries + short spec.
cxxopts / boost::program_options option specs are bare ("name", ...)
grouping/chaining calls — the ( is preceded by ) or whitespace, not
an identifier (which would make it a helper call like default_value(...)).
Class methods
Instance methods
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.