T09 · Insecure Skill Coding Practices
- Location
findskills.py:787- Finding
Routine updates unconditionally bypass the P0 security gate
- Content
View full analysis
Vulnerability Details
File Location:
findskills.py:787-832
Vulnerability Type: Security-gate bypass during community Skill updates
Risk Level: HighComplete Code Snippet
python report = security_scan.build_report(skill_root) if report["risk_level"] == "P0" and not force: print(security_scan.render_markdown(report, "zh-CN"), end="") print(f"\n❌ P0 risk detected; {action} blocked.", file=sys.stderr) return 2 if report["risk_level"] == "P1" and not yes: print(security_scan.render_markdown(report, "zh-CN"), end="") print(f"\n⚠️ P1 risk detected. Run again with --yes.", file=sys.stderr) return 1 target.mkdir(parents=True, exist_ok=True) dest = target / slug if dest.exists(): shutil.rmtree(dest) shutil.copytree(skill_root, dest)The update caller unconditionally supplies
Truefor theforceparameter:python def cmd_update(args) -> int: if args.offline: print("Update requires network access.", file=sys.stderr) return 1 local = discover_local() matches = [s for s in local if s["slug"] == args.slug or normalize_key(s["name"]) == normalize_key(args.slug)] if not matches: print("The requested Skill is not locally installed.", file=sys.stderr) return 1 rc = 0 for s in matches: target = Path(s["path"]).parent rc = _fetch_and_install( args.slug, target, True, args.yes, action="update" ) or rc return rcTechnical Analysis
_fetch_and_install()is designed to reject scanner results with aP0risk level unless itsforceargument is true. The normal installation path passes the user-controlledargs.forcevalue, butcmd_update()instead passes the constantTrue.Consequently, the ordinary
update <slug>command behaves as though the user supplied--force, regardless of whether that option was actually selected. The declared update parser includes a--forceoption, but that ...[truncated 1993 chars]- Remediation
View remediation
Remediation Suggestions
- Pass the actual command-line authorization value:
python rc = _fetch_and_install( args.slug, target, args.force, args.yes, action="update", ) or rc - Require an explicit
--forceoption for every P0 installation or update path. - Prefer refusing P0 content entirely. If an override is retained, display the full report and require a separate, unambiguous confirmation mechanism.
- Download, extract, validate, and scan the new version before modifying the existing installation.
- Preserve the old version until all validation succeeds, then use an atomic replacement strategy or recoverable backup.
- Add regression tests covering:
- P0 updates without
--forceare rejected. - P0 updates with
--forcefollow the documented override behavior. - P1 updates require
--yes. - Rejected updates leave the existing installation unchanged.
- P0 updates without
- Pass the actual command-line authorization value:
