T09 · Insecure Skill Coding Practices
- Location
scripts/generate_summary.py:36- Finding
Unrestricted Summary API Endpoint Can Expose API Credentials and Transcript Content
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill appears purpose-built for Bilibili transcription, but it combines browser session-cookie use, recurring automation, local transcript persistence, and external AI summarization with insufficient safeguards and disclosure.
Review before installing. Use a dedicated or low-privilege environment, avoid storing broad browser session cookies where the skill can read them, keep .env private and locked down, set SUMMARY_API_URL only to a trusted HTTPS provider, use a restricted API key with spending limits, and be aware that transcripts and summaries are retained locally and may be sent externally when AI summaries are enabled.
scripts/generate_summary.py:36Unrestricted Summary API Endpoint Can Expose API Credentials and Transcript Content
scripts/bilibili_transcript.sh:390Executable Shell Loading of the .env Configuration File
SKILL.md:11Unpinned and Unverified Third-Party Python Dependencies
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
while True:
url = f"{API_BASE}?media_id={FAV_MEDIA_ID}&ps=20&pn={pn}"
try:
resp = requests.get(url, headers=headers, timeout=30)
data = resp.json()
except requests.exceptions.RequestException as e:
print(json.dumps({"error": f"网络请求失败 - {e}"}))
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
],
"max_tokens": 1024
}
resp = requests.post(
api_url,
json=payload,
headers={
Using external LLM APIs and network access without explicit declared permissions is a real security transparency issue. Users may not realize transcript contents and metadata can be transmitted off-host, which is especially sensitive for private or copyrighted media content.
Using external LLM APIs and network access without explicit declared permissions is a real security transparency issue. Users may not realize transcript contents and metadata can be transmitted off-host, which is especially sensitive for private or copyrighted media content.
Using external LLM APIs and network access without explicit declared permissions is a real security transparency issue. Users may not realize transcript contents and metadata can be transmitted off-host, which is especially sensitive for private or copyrighted media content.
Using external LLM APIs and network access without explicit declared permissions is a real security transparency issue. Users may not realize transcript contents and metadata can be transmitted off-host, which is especially sensitive for private or copyrighted media content.
Using external LLM APIs and network access without explicit declared permissions is a real security transparency issue. Users may not realize transcript contents and metadata can be transmitted off-host, which is especially sensitive for private or copyrighted media content.
The matched command accesses a local Edge browser profile to export cookies, behavior that closely overlaps with credential-harvesting techniques flagged by infostealer detections. Although the apparent goal is functional access to private/member content rather than overt theft, the mechanism is risky because it teaches extraction of live browser session data from user profiles.
um:$CHROMIUM_PATH"
--cookies /tmp/bili_cookies.txt
--skip-download
--print title
"https://www.bilibili.com/video/BV1rPDkB7ESC/"
⚠️ `--cookies` 参数读写双用,每次调用覆盖目标文件,不要在同一tick多次调用。
通过 yt-dlp 导出 Windows Edge Cookie:
```bash
WIN_USER=$(ls /mnt/c/Users/ | grep -v "Public\|Default\|All Users" | head -1)
yt-dlp \
--cookies-from-browser "edge:C:/Users/$WIN_USER/AppData/Local/Microsoft/Edge/User Data" \
--cookies /tmp/bili_cookies.txt \
--skip-download \
--print title \
"https://www.bilibili.com/video/BV1rPDkB7ESC/"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try:
from dotenv import load_dotenv
SKILL_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(SKILL_DIR, ".env"))
except Exception:
pass
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try:
from dotenv import load_dotenv
SKILL_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(SKILL_DIR, ".env"))
except Exception:
pass
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try:
from dotenv import load_dotenv
SKILL_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(SKILL_DIR, ".env"))
except Exception:
pass
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try:
from dotenv import load_dotenv
SKILL_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(SKILL_DIR, ".env"))
except Exception:
pass
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try:
from dotenv import load_dotenv
SKILL_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(SKILL_DIR, ".env"))
except Exception:
pass
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try:
from dotenv import load_dotenv
SKILL_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(SKILL_DIR, ".env"))
except Exception:
pass
cleanup_temp deletes files under CLEANUP_DIR, which is derived from a user-controlled output directory. Although the glob prefixes limit deletion to bilibili_* patterns, a caller can still point OUTPUT_DIR at an unintended location and cause deletion of matching files there on exit, making this a path-abuse issue in an agent setting.
}
cleanup_temp() {
rm -f "$CLEANUP_DIR"/bilibili_subtitle*.srt "$CLEANUP_DIR"/bilibili_ai_subtitle*.srt \
"$CLEANUP_DIR"/bilibili_audio*.mp3 "$CLEANUP_DIR"/bilibili_audio*.m4a \
"$CLEANUP_DIR"/bilibili_audio*.wav "$CLEANUP_DIR"/bilibili_audio*.txt \
"$CLEANUP_DIR"/.qwen_transcript.txt
The script sources ../.env directly into the shell using '. "$SCRIPT_DIR/../.env"', which executes shell syntax from that file rather than merely reading a key/value pair. If the .env file is modified by another local process or attacker, arbitrary shell commands could run in the context of the skill, making this more dangerous than simple credential loading.
echo ""
echo "🤖 正在生成AI摘要..."
# 仅在未设置API key时才从.env加载(尊重已存在的环境变量)
if [ -z "$OPENAI_API_KEY" ] && [ -f "$SCRIPT_DIR/../.env" ]; then
set -a; . "$SCRIPT_DIR/../.env" 2>/dev/null || true; set +a
fi
if [ -n "$BVID" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. DB模式(推荐):python3 generate_summary.py --bvid BVxxx
2. 文件模式(兼容):python3 generate_summary.py <转录文件路径>
支持环境变量(或 .env 文件):
OPENAI_API_KEY — API密钥(不设置则跳过摘要)
SUMMARY_API_URL — API地址(默认 OpenAI)
SUMMARY_API_MODEL — 模型名(默认 gpt-4o-mini)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. DB模式(推荐):python3 generate_summary.py --bvid BVxxx
2. 文件模式(兼容):python3 generate_summary.py <转录文件路径>
支持环境变量(或 .env 文件):
OPENAI_API_KEY — API密钥(不设置则跳过摘要)
SUMMARY_API_URL — API地址(默认 OpenAI)
SUMMARY_API_MODEL — 模型名(默认 gpt-4o-mini)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. DB模式(推荐):python3 generate_summary.py --bvid BVxxx
2. 文件模式(兼容):python3 generate_summary.py <转录文件路径>
支持环境变量(或 .env 文件):
OPENAI_API_KEY — API密钥(不设置则跳过摘要)
SUMMARY_API_URL — API地址(默认 OpenAI)
SUMMARY_API_MODEL — 模型名(默认 gpt-4o-mini)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. DB模式(推荐):python3 generate_summary.py --bvid BVxxx
2. 文件模式(兼容):python3 generate_summary.py <转录文件路径>
支持环境变量(或 .env 文件):
OPENAI_API_KEY — API密钥(不设置则跳过摘要)
SUMMARY_API_URL — API地址(默认 OpenAI)
SUMMARY_API_MODEL — 模型名(默认 gpt-4o-mini)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. DB模式(推荐):python3 generate_summary.py --bvid BVxxx
2. 文件模式(兼容):python3 generate_summary.py <转录文件路径>
支持环境变量(或 .env 文件):
OPENAI_API_KEY — API密钥(不设置则跳过摘要)
SUMMARY_API_URL — API地址(默认 OpenAI)
SUMMARY_API_MODEL — 模型名(默认 gpt-4o-mini)
The README advertises AI summary generation via OpenAI-compatible APIs without clearly warning that transcript content may be transmitted to third-party services. Because transcripts can contain personal, proprietary, or copyrighted material, this omission creates a real privacy and compliance risk for users who may enable the feature without informed consent.
The README instructs users to log in with Chromium to obtain Bilibili cookies but does not warn that these cookies are active session credentials. Mishandling them can enable account takeover or unauthorized access if copied, logged, or stored insecurely by the skill or user workflow.
The README explicitly documents storing transcripts and summaries in a local SQLite database but does not warn that these artifacts may contain sensitive personal, account, or copyrighted content. This creates a real privacy and data-retention risk because users may persist large amounts of extracted content without understanding the security implications or applying filesystem protections.
The skill declares installation and runtime behaviors that require shell, filesystem, environment-variable, and network access, but it does not declare an explicit permission/tool scope. This weakens user visibility and policy enforcement, making it easier for a skill to perform sensitive operations without clear consent boundaries.
No suspicious patterns detected.