360 Secure SkillHub
360 安全技能中心

Skill Policy Enforcer

读取调用方提供的 policy.yaml(缺省用默认保守策略),扫描目标 Skill 文件夹的必需文件、frontmatter 字段、文件体积、敏感路径、危险 shell 模式、网络使用与未完成标记,按规则 id 列出 deny/warn 并给出 PASS、PASS_WITH_WARNINGS 或 FAIL 判定。

debtvc2022
debtvc2022
热度 23.67
最近更新 2026-06-18 17:02:05
分类:安全依赖:代码执行 / 读写文件应用场景:工作流 / DevOps / 报告撰写

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add skill-policy-enforcer
Metadata
name
skill-policy-enforcer
description
Use when checking an agent Skill against a local or enterprise policy before installation, publication, CI approval, marketplace review, or repository merge.

Skill Policy Enforcer

Overview

Enforce a caller-supplied policy over an agent Skill folder. Use it when a team needs repeatable pass/fail checks instead of a one-off security review.

Quick Start

Run with a policy file:

python <this-skill>/scripts/enforce_skill_policy.py <skill-folder> --policy policy.yaml --markdown

Run without --policy to apply the default conservative policy. Use --json for CI.

Policy Workflow

  1. Locate the candidate skill folder and policy file.
  2. Read references/policy-schema.md if the policy shape is unclear.
  3. Run scripts/enforce_skill_policy.py.
  4. Treat deny findings as blocking and warn findings as review items.
  5. Report which policy rule caused each finding.

Policy Scope

The default policy checks:

  • required files and allowed frontmatter fields
  • maximum file size and SKILL.md word count
  • forbidden secret paths such as .env, .ssh, and private keys
  • dangerous shell patterns such as recursive delete, shell pipe install, and encoded execution
  • network use, if disabled by policy
  • unfinished markers and generated template leftovers

Required Behavior

  • Do not override policy because a finding seems inconvenient.
  • Do not invent policy exceptions. Ask for an updated policy file if needed.
  • Quote the exact rule id for every deny or warning.
  • If --json output is available, base final status on the machine result.

Common Mistakes

Mistake Fix
Treating policy as advice Deny findings block install or release.
Auditing only SKILL.md Policy applies to every file under the skill folder.
Hardcoding one company's rules Put local rules in policy.yaml.
Missing hidden files Scan dotfiles and nested resource folders too.

Output Contract

End with one of:

  • PASS: no deny findings.
  • PASS_WITH_WARNINGS: warnings remain.
  • FAIL: at least one deny finding.