Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigPathFromArgs ¶ added in v1.17.0
ConfigPathFromArgs pre-scans argv for --config so main can pin the config path before config.Load() runs. Parse() happens after Load(), and Load() keeps whatever it read first, so the flag cannot be honoured any later. Deliberately forgiving: an unparseable argv is Parse()'s problem to report, not this helper's.
Types ¶
type Config ¶
type Config struct {
Command string // "", "install", "uninstall", "send-telemetry", "identity", "configure", "configure show", "hooks install", "hooks uninstall"
OutputFormat string // "pretty", "json", "html"
OutputFormatSet bool // true if --pretty/--json/--html was explicitly passed (not persisted)
HTMLOutputFile string // set by --html (not persisted)
ColorMode string // "auto", "always", "never"
Verbose bool // --verbose (shortcut for --log-level=debug)
LogLevel string // "" = unset; one of "error", "warn", "info", "debug"
InstallDir string // --install-dir=DIR base install directory; all non-bootstrap files (logs, hook errors, binary placement) live under this dir. "" w/ InstallDirSet=true means "explicitly disabled" (no file logging).
InstallDirSet bool // true if --install-dir was passed (empty value = disable file logging for this run)
EnableNPMScan *bool // nil=auto, true/false=explicit
UseLegacyNodeScan *bool // nil=auto (disk scan); true=command path, false=disk path
EnableBrewScan *bool // nil=auto, true/false=explicit
EnablePythonScan *bool // nil=auto, true/false=explicit
EnableRuntimeScan *bool // nil=auto (on), true/false=explicit
UseLegacyPythonScan *bool // nil=auto (disk scan); true=pip path, false=disk path
IncludeBundledPlugins bool // --include-bundled-plugins: include bundled/platform plugins in output
// IncludeTCCProtected is tristate: nil or false = skip the macOS
// TCC-protected dirs (Documents, Downloads, ~/Library/Mail, ...)
// so the agent never triggers permission prompts; true = scan them.
// Customers who have granted the agent Full Disk Access (e.g., via
// an MDM-pushed PPPC profile) flip this to true to opt back into
// full scan coverage. See docs/macos-tcc-permissions.md.
IncludeTCCProtected *bool
// IncludeNetworkVolumes is tristate with the OPPOSITE default to
// IncludeTCCProtected: nil or true = walk macOS network volumes
// (container-runtime mounts — OrbStack, Docker Desktop, Colima — are
// Network Volumes to macOS), false = skip them. Walking them is what
// inventories packages inside dev containers, at the cost of a one-time
// TCC prompt on machines with no PPPC pre-approval. Fleets that can't
// pre-approve set this to false. See docs/macos-tcc-permissions.md.
IncludeNetworkVolumes *bool
NPMRCOnly bool // --npmrc: run only the npmrc audit and render verbose pretty output
PipConfigOnly bool // --pipconfig: run only the pip config audit and render verbose pretty output
PnpmRCOnly bool // --pnpmrc: run only the pnpm config audit and render verbose pretty output
BunfigOnly bool // --bunfig: run only the bun config audit and render verbose pretty output
YarnRCOnly bool // --yarnrc: run only the yarn config audit (both flavors) and render verbose pretty output
SearchDirs []string // defaults to ["$HOME"]
// GateProceedReason is populated at runtime (not a CLI flag) by the run
// gate when it lets a run proceed, so telemetry.Run can echo the gate
// decision into the captured execution log (what "Download logs" shows).
// The gate itself runs before log capture starts, so its live lines never
// reach the downloadable log without this.
GateProceedReason string
// CredentialScanningDisabled is populated at runtime (not a CLI flag) by
// the run gate from this invocation's dashboard check-in. True means
// telemetry.Run must not build, probe with, or run the credential detector.
// The zero value scans, so a caller that never consulted the gate, or one
// whose check-in failed, behaves as before.
CredentialScanningDisabled bool
// DeltaScanEnabled is set by run-config, never by a CLI flag.
DeltaScanEnabled bool
// WSLScanEnabled and WSLScanReason are populated at runtime (not CLI flags)
// from the run-config check-in's wsl_directive. They gate scanning INSIDE
// WSL distros — a tenant-wide switch with no per-device granularity. Both
// stay zero on every path that never reached a backend answer, so distro
// scanning fails closed; host-side WSL detection does not consult them.
WSLScanEnabled bool
WSLScanReason string
// WSLHostSerial and WSLDistroID identify this run as happening INSIDE a WSL
// distribution, and are passed by the Windows host that triggered it
// (--wsl-host-serial, --wsl-distro-id). A distro cannot discover either for
// itself. When both are set the agent derives a stable device id from them,
// because a distro's own identity is unusable: it inherits the host's
// hostname, and a minimal or WSL1 distro has no machine-id.
WSLHostSerial string
WSLDistroID string
// ConfigFile is --config: the exact config.json to read. Applied by a
// pre-scan of argv before config.Load(), so this field is informational
// once parsing is done.
ConfigFile string
// HooksAgent is the --agent value on `hooks install` / `hooks uninstall`;
// "" means "every detected agent".
HooksAgent string
// Non-interactive `configure` inputs. Used by MSI/SCCM and other
// orchestrators that can't drive a stdin prompt loop. NonInteractive
// is implied when any flag saves a config value, and main.go routes
// accordingly.
NonInteractive bool
ConfigFromFile string // --from-file: read full config JSON from path
// ConfigValues holds the config.json keys this invocation's flags set
// (flagSpec.saves), for `configure` to persist. Scan runs ignore it.
ConfigValues map[string]any
SearchDirsSet bool `json:"-"` // a --search-dirs replaced the $HOME default
// UninstallRetire / UninstallNoRetire are `uninstall --retire` and
// `uninstall --no-retire`: force or suppress the backend retire call that
// config.json retire_on_uninstall otherwise decides. Mutually exclusive.
UninstallRetire bool
UninstallNoRetire bool
// ImageBuilder is `configure --image-builder[=BOOL]`: nil leaves the
// master-image switch unchanged (the MSI passes an unset property as an
// empty value), true writes the machine-bound marker that keeps scans off
// on the imaging machine, false removes it. Not a config.json key: a
// bootstrap file is copied into every clone, the switch must not be.
ImageBuilder *bool
// IgnoreTelemetryError opts the `install` subcommand into treating an
// initial-telemetry POST failure as a warning rather than a fatal exit.
// Default behavior (flag absent) preserves dev-workflow ergonomics —
// a failed first telemetry surfaces misconfigurations immediately. MSI
// custom actions and other unattended orchestrators set this so a
// transient network hiccup doesn't roll back the whole install.
IgnoreTelemetryError bool
// OverrideGate disables feature gating for this invocation, letting
// every capability run regardless of the featuregate allowlist.
// Internal — not advertised in --help. Equivalent env var:
// STEPSECURITY_OVERRIDE_GATE=1.
OverrideGate bool
// ForceScan bypasses the server-driven run gate for this invocation: the
// scan proceeds even when the backend's run-directive says "skip". The
// documented debug/support escape — manual runs are otherwise gated
// exactly like scheduler-fired ones (an MDM-launched run detects as
// one_time too, so invocation method deliberately can't exempt manual
// use). Equivalent env var: STEPSEC_FORCE_SCAN=1.
// The check-in itself still happens (bounded by its own timeout), because
// it also carries the tenant's credential-scanning setting, which a forced
// run must honour.
ForceScan bool
// RulesFile makes the malicious-file detection engine load its RuleSet
// from a local JSON file instead of fetching it from the backend.
// Dev-only — not advertised in --help. Equivalent env var:
// STEPSECURITY_RULES_FILE=PATH. Lets the engine be exercised offline
// (rules live only in the backend, so an offline run would otherwise scan
// nothing). Zero production impact when unset.
RulesFile string
// TelemetryOutFile makes an enterprise run write the assembled telemetry
// Payload to a local JSON file and skip the S3 upload + run-status notify.
// Dev-only — not advertised in --help. Equivalent env var:
// STEPSECURITY_TELEMETRY_OUT=PATH. The dumped file is exactly what the
// backend's process-uploaded sees after gunzip, so it doubles as a backend
// ingestion fixture. Zero production impact when unset.
TelemetryOutFile string
}
Config holds all parsed CLI flags.
The hidden `_hook` runtime is intentionally NOT represented here. Agents invoke `_hook` on every event and any non-zero exit is treated as a hook failure, so the hot path bypasses cli.Parse entirely — see main.go's early-return and internal/aiagents/cli.RunHook.