/** * R6 — bash/PowerShell command classification (env dumps, expansions, * env-file tokens, cmd /c heads, command substitution). Split out of the * former monolithic envprotect.ts; behavior unchanged. */ import type { EnvProtectMode } from "./patterns.js"; /** * First token + remainder of one segment. Statement noise is peeled off * until stable so the real statement head surfaces: subshell/group * openers and closers (`(env)`, `{ env; }`), escaped commands (`\env`), * and the `time` keyword prefix (`time (env)` needs two passes). Leading * `VAR=value` assignment prefixes are skipped so `FOO=1 env` is still * recognized as an env dump. */ export declare function commandToken(segment: string): { token: string; rest: string; }; /** * Statement-head env dumps. Case matters for `set`: the exact lowercase * bare `set` (no arguments) is the sh builtin that prints every variable, * while PowerShell `Set-*` cmdlets and `set -euo pipefail` style flags are * never variable dumps and must pass. `env`/`printenv` are matched * case-insensitively AND path-agnostically: the basename decides, so the * formerly double-blind path heads are covered too — a bare `/usr/bin/env` * (or `./env`) is the SAME full dump as bare `env`, and `/usr/bin/printenv` * (with or without vars) the same read as bare `printenv`; `env ` * keeps its launcher/dump boundary via envRestIsDump either way * (`/usr/bin/env node app.js` still passes, bare `/usr/bin/env` throws — * the dialog grammar cannot express path heads, so these stay hard). * `declare -p` prints variable definitions in reusable form, and so do its * synonyms `typeset -p` / `export -p` / `local -p` — with the flag allowed * to be split from `-p` by one other option (`declare -x -p FOO`). */ export declare function isEnvDumpStatement(token: string, rest: string): boolean; /** * Classify a bash/PowerShell command string. Returns the pattern category * when the command must be blocked, null when it may pass. `off` is * handled by the caller; user extra-deny rules take precedence. */ export declare function classifyBashCommand(command: string, mode: EnvProtectMode, extra?: RegExp[]): string | null; //# sourceMappingURL=bash-classify.d.ts.map