360 Secure SkillHub
360 安全技能中心

RedHat Command Execution

核心功能:对终端命令进行风险分类,拦截或要求确认高风险操作,优先执行dry-run,执行后校验结果并诊断错误。典型场景:运行测试、构建、代码检查、仓库巡检等可能影响环境的命令。输入需指定命令与用途,可选预期效果、风险等级;输出为包含执行状态、退出码、关键输出及下一步建议的结构化内容,保障安全可审计。

mzfshark
mzfshark
热度 35.15
最近更新 2026-05-11 17:45:37
分类:开发依赖:代码执行应用场景:DevOps / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add axodus-command-execution
Metadata
name
command-execution
description
Execute terminal commands safely with preflight checks and risk gating.
metadata
{"author":"RedHat Dev","version":"1.0.0","owner":"RedHat Dev Agent","category":"execution"}

SKILL: command-execution

Purpose

Execute terminal commands safely with deterministic preflight checks, risk classification, and auditable outputs.

When to Use

  • Running tests, builds, linters, or migrations.
  • Inspecting the repo (search, list files, check versions).
  • Any command execution that could affect the environment.

Inputs

  • command (required, string): exact command to run.
  • purpose (required, string): why this command is needed.
  • expected_effects (optional, string[]): what should happen (files created, tests run).
  • risk_level (optional, enum: low|medium|high): if known.

Steps

  1. Classify command risk:
    • read-only (safe)
    • write (moderate)
    • destructive/network/system (high)
  2. Block/require confirmation for high-risk patterns:
    • recursive deletes (rm -rf, Remove-Item -Recurse -Force)
    • format/disk ops
    • piping remote scripts (curl ... | sh)
  3. If supported, prefer dry-run flags first (e.g., --dry-run, -n, --check).
  4. Execute the command and capture:
    • exit code
    • stdout/stderr
    • elapsed time (if available)
  5. Interpret results against expected_effects.
  6. If command failed:
    • stop
    • summarize error
    • propose next diagnostic steps

Validation

  • Exit code is checked (not ignored).
  • Output is summarized with the relevant error lines.
  • Side effects match expectation (no surprise modifications).

Output

command: "<command>"
purpose: "<purpose>"
result: "success|blocked|failed"
exit_code: <int|null>
highlights: ["<key output lines>"]
next_steps: ["..."]

Safety Rules

  • Never run destructive commands without explicit user confirmation.
  • Never run unknown installers or remote scripts without review.
  • Prefer minimal, scoped commands (avoid global state changes).

Example

Run tests:

  • command: pnpm test
  • purpose: “Validate behavior after refactor”
  • Output: exit code + failing test names + next diagnostic step.