Repository navigation
Description
Summary
Replace the current band-aid in scripts/security-review.mjs (which skips .copilot/skills/**/*.md) with a proper markdown-aware security scanner inspired by microsoft/waza's ComplianceChecker framework.
Problem
The security review scanner (security-review.mjs) parses all files as JavaScript to detect unsafe patterns (git add ., credential exposure, etc.). When it encounters .md files containing literal git commands as documentation (e.g., SKILL.md files that explain git workflows), it throws SyntaxError because markdown isn't JavaScript.
Current band-aid: Skip .copilot/skills/**/*.md entirely (PR #873). This means skills get zero security scanning — not ideal since skills are executable instructions that agents follow.
Desired Behavior
Skills SHOULD be security-reviewed, but the scanner needs to understand markdown vs code:
| File Type | How to Scan |
|---|---|
.js, .ts, .mjs |
Parse as JavaScript (current behavior) |
.md (skills, instructions) |
Scan as text content — look for patterns in prose, not syntax |
.yml, .yaml |
Scan for script injection patterns |
Waza Patterns to Adopt
microsoft/waza implements exactly this with their ComplianceChecker interface:
1. OverSpecificityChecker (internal/checks/advisory_checks.go)
- Flags hardcoded paths (
/usr/,C:\), IPs, URLs, port numbers in skill body - Returns warnings, not parse errors
- Squad equivalent: Catch credentials, hardcoded secrets, unsafe URLs in SKILL.md
2. SpecSecurityChecker (internal/checks/spec_checks.go)
- Validates frontmatter for XML injection (angle brackets in values)
- Checks reserved name prefixes
- Squad equivalent: Validate skill metadata/frontmatter
3. NegativeDeltaRiskChecker
- Flags conflicting instructions, excessive constraints in skill body
- Squad equivalent: Catch skills that instruct agents to do unsafe things (
git add .,git push --force, expose secrets)
4. Body vs Spec separation
- Different checkers for markdown body vs YAML frontmatter
- Squad equivalent: Don't parse
.mdas JavaScript — treat as text
Implementation Approach
- Add file-type detection to
security-review.mjs - For
.mdfiles: scan content as text using regex patterns (not AST parsing) - Key patterns to detect in markdown:
git add .orgit add -Arecommended (not just mentioned as anti-pattern)- Hardcoded credentials, API keys, connection strings
--forcepush recommendations- Unsafe template expressions in workflow files
- URLs pointing to internal/private endpoints
- Distinguish "warning against X" from "instruction to do X" (context-aware scanning)
- Remove the
.copilot/skills/**/*.mdskip once proper scanning is in place
Acceptance Criteria
-
.mdfiles in.copilot/skills/are scanned (skip removed) - Scanner doesn't throw SyntaxError on markdown files
- Unsafe patterns in skill prose are detected and reported
- Safe documentation about unsafe patterns (e.g., "never do X") is NOT flagged
- Existing JS/TS scanning unchanged
- Tests cover all file types
References
- Band-aid PR: ci: consolidate workflows, path filters, concurrency (PRD #872 Phases 0-2, 4-5) #873 (skip added in
scripts/security-review.mjs) - Original failure: PR feat: PR lifecycle skill + readiness check expansion (9 → 11 checks) #870 CI
- Waza source: https://github.com/microsoft/waza (
internal/checks/) - PRD: PRD: CI/GitHub Actions Performance Optimization — Reduce Runners Per PR Push from 19 to 8-10 #872 (CI optimization)
Activity
feat(security): add markdown-aware skill security scanner (Phase 1)
feat(security): add markdown-aware skill security scanner (Phase 1)
feat(security): add markdown-aware skill security scanner (Phase 1)
feat(security): add markdown-aware skill security scanner (Phase 1) (#…
diberry commentedon Apr 6, 2026
Closed: Superseded by #881 (refined PRD). Implementation shipped in PR #882.
feat(security): add markdown-aware skill security scanner (Phase 1) (#…