class

Analyzer::Clojure::Cli

Inherits CliEndpointSupport < Analyzer < FileHelper < Reference < Object

Surfaces the command-line attack surface of Clojure programs as cli:// endpoints: clojure.tools.cli option specs, cli-matic config, babashka.cli spec/dispatch tables, environ.core env lookups, and command-line-args / (System/getenv). Line-scan, merged by URL.

Constants

BB_CMDS = /:cmds\s+\[([^\]]*)\]/

Whole :cmds [...] vector (may hold several segments, e.g. ["docker" "start"]).

ENVIRON_ENV = /\(\s*env\s+:([A-Za-z][\w-]*)/
ENVIRON_REFER_ENV = /environ\.core\s*:refer\s*\[[^\]]*\benv\b/

env bound bare from environ.core: (:require [environ.core :refer [env]]). Never trust an alias (:as environ) or an unrelated local/param named env.

GET_ENV = /\(\s*System\/getenv\s+"([^"]+)"/
MARKERS = /clojure\.tools\.cli\b|\(\s*(?:[\w.-]+\/)?parse-opts\b|\bcli-matic\b|\*command-line-args\*|\bbabashka\.cli\b/

NOTE: environ.core is intentionally absent here. It's a generic 12-factor config-reading library used by web apps/workers/services just as much as CLIs (same category as bare System/getenv, below) — it must never gate CLI detection on its own. It only annotates params on a cli:// endpoint some OTHER marker below already established.

MATIC_COMMAND = /:command\s+"([^"]+)"/
MATIC_OPTION = /:option\s+"([A-Za-z0-9][\w-]*)"/
NTH_ARGS = /\(\s*nth\s+(?:\*command-line-args\*|args)\s+(\d+)/
TOOLS_CLI_LONG = /"--([A-Za-z0-9][\w-]*)/
TOOLS_CLI_SPEC = /\[\s*(?:(?:"-[A-Za-z0-9]"|nil)\s+)?"--/
WEB_RE = /\b(?:compojure|ring\.adapter|reitit|io\.pedestal|httpkit|aleph)\b/

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

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.

Source