T09 · Insecure Skill Coding Practices
- Location
scripts/baidu-memory-tools.sh:38- Finding
Arbitrary Python Code Execution Through Unsafely Interpolated Memory Input
- Content
View full analysis
80 else res['content'] print(f' {i}. 相似度: {similarity:.3f} - {content_preview}') else: print('未找到相关记忆') except Exception as e: print(f'搜索失败: {str(e)}') " ``` `scripts/triple-integration.sh:44-61`: ```bash python3 -c " import sys sys.path.append('$SKILL_DIR/skills/memory-baidu-embedding-db') from memory_baidu_embedding_db import MemoryBaiduEmbeddingDB try: db = MemoryBaiduEmbeddingDB() result = db.add_memory( content='$TEXT', tags=['$TAGS', 'semantic'], metadata={'importance': '$IMPORTANCE', 'source': 'triple-memory'} ) print(' ...[truncated 2422 chars]- Remediation
View remediation
&2; exit 1 ;; esac if [ "$LIMIT" -lt 1 ] || [ "$LIMIT" -gt 100 ]; then echo "Limit must be between 1 and 100" >&2 exit 1 fi ``` 6. Restrict importance to the documented values and validate tag length and character sets. 7. Add regression tests containing quotes, newlines, backslashes, command substitutions, and known Python-injection payloads. 8. Run the memory component under a dedicated, unprivileged account with narrowly scoped filesystem and network access. ]]>
