Skip to content

Commit f5bbfa4

Browse files
authored
Merge pull request #1373 from agn-7/fix/security-install-agents-audit
fix(security): audit shared agent skills
2 parents 9595822 + 4722155 commit f5bbfa4

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

scripts/security-install.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ find "$HOME" -type f > "$TMPDIR/created_files.txt" 2>/dev/null || true
4949
# Expected path patterns (relative to HOME):
5050
# .config/*/mcp.json (or .mcp.json variants)
5151
# .claude/skills/*
52+
# .agents/skills/*
5253
# .claude/settings.json
5354
# .continue/config.yaml
5455
# .codeium/config.json
5556
# .local/bin/codebase-memory-mcp
5657
# Various agent config dirs
5758

5859
EXPECTED_PATTERNS=(
60+
".agents/"
5961
".claude/"
6062
".cursor/"
6163
".config/"
@@ -121,10 +123,18 @@ fi
121123
echo ""
122124
echo "--- Auditing skill file content ---"
123125

124-
SKILLS_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills"
125-
if [[ -d "$SKILLS_DIR" ]]; then
126-
SKILL_ISSUES=0
126+
SKILL_DIRS=(
127+
"${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills"
128+
"$HOME/.agents/skills"
129+
)
130+
SKILL_ISSUES=0
131+
SKILL_DIRS_FOUND=0
127132

133+
for SKILLS_DIR in "${SKILL_DIRS[@]}"; do
134+
if [[ ! -d "$SKILLS_DIR" ]]; then
135+
continue
136+
fi
137+
SKILL_DIRS_FOUND=1
128138
while IFS= read -r skill_file; do
129139
basename=$(basename "$skill_file")
130140

@@ -138,24 +148,26 @@ if [[ -d "$SKILLS_DIR" ]]; then
138148
done
139149

140150
# Check for unexpected URLs
141-
if grep -oE 'https?://[^\s"'"'"']+' "$skill_file" 2>/dev/null | grep -v 'github.com/DeusData' | grep -v 'localhost' | grep -v '127.0.0.1' > /tmp/sec_skill_urls 2>/dev/null; then
151+
if grep -oE 'https?://[^\s"'"'"']+' "$skill_file" 2>/dev/null | grep -v 'github.com/DeusData' | grep -v 'localhost' | grep -v '127.0.0.1' > "$TMPDIR/sec_skill_urls" 2>/dev/null; then
142152
while IFS= read -r url; do
143153
echo "REVIEW: Skill '$basename' contains URL: $url"
144-
done < /tmp/sec_skill_urls
145-
rm -f /tmp/sec_skill_urls
154+
done < "$TMPDIR/sec_skill_urls"
155+
rm -f "$TMPDIR/sec_skill_urls"
146156
fi
147157

148158
# Check for encoded strings (base64-like blocks > 50 chars)
149159
if grep -E '[A-Za-z0-9+/]{50,}={0,2}' "$skill_file" > /dev/null 2>&1; then
150160
echo "REVIEW: Skill '$basename' contains potential encoded content"
151161
fi
152162
done < <(find "$SKILLS_DIR" -type f -name '*.md')
163+
done
153164

165+
if [[ $SKILL_DIRS_FOUND -eq 0 ]]; then
166+
echo "SKIP: No skills directory created."
167+
else
154168
if [[ $SKILL_ISSUES -eq 0 ]]; then
155169
echo "OK: Skill files contain no dangerous patterns."
156170
fi
157-
else
158-
echo "SKIP: No skills directory created."
159171
fi
160172

161173
# ── Summary ──────────────────────────────────────────────────────

0 commit comments

Comments
 (0)