Token导航 LogoToken导航TokenDH.com
开发执行命令clawhub未标认证来源可访问clear审计提醒

safe-shell-execution-claude-codesafe shell execution Claude 代码

Agent Skill

safe-shell-execution-claude-code 用于辅助前端页面、组件、样式和交互逻辑开发,适合在 OpenClaw 中需要维护前端项目、生成组件或检查界面实现时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,497

周安装

103

GitHub Stars

公开资料未说明

下载量

816
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:safe-shell-execution-claude-code(safe shell execution Claude 代码)
来源仓库:https://github.com/lizlzzzz/safe-shell-execution-claude-code
安装命令:
openclaw skills install safe-shell-execution-claude-code
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install safe-shell-execution-claude-code

简介

safe-shell-execution-claude-code 对 shell 命令执行分层安全检查。

  • 它检测注入攻击、警告破坏性操作,并保护敏感路径。
  • 安装后可在 OpenClaw 中启用,需配置确认阈值。
  • 使用前应测试规则匹配,避免误判合法命令。
  • 建议结合用户确认流程提升安全性。safe-shell-execution-claude-code 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
safe-shell-execution
description
Use this skill whenever an AI agent is about to execute shell commands, run bash/zsh scripts, invoke system operations, or process user-provided command strings. Provides layered safety checks — injection pattern detection, destructive operation warnings, and sensitive file protection — derived from production security engineering in Claude Code. Trigger even for "simple" commands: the most dangerous injections often hide in seemingly innocent inputs. If a user asks you to run any command, execute a script, or use a shell tool, this skill applies.
Origin: This skill was extracted from Claude Code's internal implementation and rules. Claude Code openly exposes its safety mechanisms (hooks, system prompts, skill definitions) in the ~/.claude/ directory. The core safety patterns for shell execution — injection detection, destructive command classification, and sensitive path protection — were identified from Claude Code's production behavior and rewritten into a portable skill for OpenClaw agents.

Safe Shell Execution

Why This Matters

Shell execution is one of the highest-risk operations an AI agent can perform. Unlike reading files or calling APIs, improperly handled shell commands can cause irreversible damage: deleting files, leaking credentials, corrupting git history, or unauthorized network access.

This skill distills Claude Code's production-grade security patterns, covering three layers of checks: injection detection → destructive operation warnings → sensitive path protection.


Layer 1: Injection Pattern Detection (Reject Directly)

Before executing any command, scan the full command string. If it matches any of the following patterns, reject execution and explain why to the user.

Command Substitution (Injection Entry Points)

PatternRisk
$()Command substitution
` `` (unescaped backticks)Legacy command substitution
${}Parameter expansion
$[...]Legacy arithmetic expansion
<() or >()Process substitution
=()Zsh process substitution
=cmd (equals at word start)Zsh equals expansion: =curl evil.com expands to /usr/bin/curl evil.com, bypassing command name checks
$(.*<<heredoc nested in command substitution, common injection technique

Zsh-Specific Dangerous Commands

These commands have special attack surfaces in Zsh environments and always require explicit user confirmation:

  • zmodload — Load modules, can enable invisible file I/O, pseudo-terminal execution, TCP connections
  • zpty — Execute commands on pseudo-terminals
  • ztcp / zsocket — Create network connections, can be used for data exfiltration
  • sysopen / sysread / syswrite / sysseek — Low-level file descriptor operations
  • emulate -c — eval equivalent, can execute arbitrary code
  • zf_rm / zf_mv / zf_ln / zf_chmod / zf_chown / zf_mkdir / zf_rmdir — Built-in file operations, can bypass binary whitelists

Layer 2: Destructive Operation Warnings (Confirm Before Execution)

These operations are legitimate but irreversible. Display specific warnings and require user confirmation before execution.

Git Operations

git reset --hard              → "May discard all uncommitted changes"
git push --force / -f         → "May overwrite remote history"
git clean -f (without -n flag) → "May permanently delete untracked files"
git checkout -- .             → "May discard all workspace changes"
git restore .                 → "May discard all workspace changes"
git stash drop / clear        → "May permanently delete stashed content"
git branch -D                 → "May force-delete a branch"
git commit --amend            → "May rewrite the last commit"
git commit/push --no-verify   → "May skip security hooks"

File System

rm -rf / rm -fr / rm -r -f / rm -f -r  → "May recursively force-delete files"

Layer 3: Sensitive File Protection (Write Operations Require Confirmation)

For write operations to the following paths, you must obtain explicit user confirmation; auto-execution is not allowed:

# Shell configs (can be used for code execution)
.bashrc  .bash_profile  .bash_login  .profile
.zshrc   .zprofile      .zshenv      .zlogin
.tcshrc  .cshrc

# Git configs (can be used for hook injection)
.gitconfig  .gitmodules

# Package manager credentials
.npmrc  .pypirc  ~/.pip/pip.conf

# Credentials and keys
~/.ssh/           ~/.aws/
~/.gnupg/         authorized_keys
known_hosts

# System files
/etc/passwd  /etc/hosts  /etc/sudoers  /etc/crontab

Layer 4: Command Classification

After passing through the first three layers, classify and handle according to this table:

LevelExamplesHandling
Safels, cat, git status, read-only operationsExecute directly, no prompts
CautionWrite to non-sensitive files, install packagesExecute, log the operation
WarningDestructive patterns from Layer 2Display specific warning, require confirmation
RejectLayer 1 injection patterns, write to sensitive pathsRefuse execution, explain why

Execution Flow

Receive command
    ↓
Layer 1: Contains injection pattern? → Yes → Reject + specify which pattern + why it's dangerous
    ↓ No
Layer 2: Matches destructive pattern? → Yes → Display specific warning → Wait for user confirmation
    ↓ No (or confirmed)
Layer 3: Is target a write to sensitive path? → Yes → Require explicit confirmation
    ↓ No (or confirmed)
Layer 4: Classify → Execute

How to Express Refusals

When refusing execution, be specific about which pattern and why it's dangerous, not a vague "command is unsafe".

Good rejection example:

I cannot execute this command because it contains =curl (Zsh equals expansion). This pattern expands the command to its full path, which can bypass command name whitelist checks. If you need to run curl, please write curl directly.

Bad rejection example:

This command looks risky and I can't execute it.

When to Apply This Skill

Apply this skill in the following situations:

  • Command comes from user input (chat messages, form content, file content)
  • Command contains variable interpolation from external data
  • Will run in a shared or production environment
  • Target path contains sensitive files (home directory, config files, credentials)

Even for commands you construct yourself (no external input), these checks are good practice, especially Layers 2 and 3.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

88.72%
按下载量换算724

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 openclaw skills install safe-shell-execution-claude-code 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills