T09 · Insecure Skill Coding Practices
- Location
scripts/helper.py:430- Finding
Debug Logs Persist Complete User Text and API Responses
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This looks like a real language-learning TTS helper, but it can automatically upload and send generated audio to Feishu chats without a per-use confirmation step.
Install only if you want Feishu/Lark voice-message delivery, and configure it with a narrowly scoped bot and a deliberate chat ID. Avoid using the Feishu option for private phrases unless you are comfortable sending them to that chat. Prefer environment variables or a locked-down .env file, do not commit .env or debug logs, and avoid --debug-log for sensitive text.
scripts/helper.py:430Debug Logs Persist Complete User Text and API Responses
scripts/helper.py:16Credential-Bearing Environment File Is Created Without Explicit Permission Hardening
scripts/feishu_api.py:134Optional Feishu Chat Enumeration Exceeds Core TTS Functionality
This mismatch combines two security-relevant issues: undisclosed Feishu data transmission and the absence of the claimed core translation/analysis functionality. A skill that primarily performs external chat operations while presenting itself as a benign learning helper can mislead operators and users about where their data goes and what the skill actually does.
This mismatch combines two security-relevant issues: undisclosed Feishu data transmission and the absence of the claimed core translation/analysis functionality. A skill that primarily performs external chat operations while presenting itself as a benign learning helper can mislead operators and users about where their data goes and what the skill actually does.
This mismatch combines two security-relevant issues: undisclosed Feishu data transmission and the absence of the claimed core translation/analysis functionality. A skill that primarily performs external chat operations while presenting itself as a benign learning helper can mislead operators and users about where their data goes and what the skill actually does.
Referenced artifact was not completely inspected
先检查环境变量 `SENSEAUDIO_API_KEY`。如果已经存在,直接使用;如果不存在,再提示用户提供 API Key 或先在终端设置环境变量。不要把密钥写进 `SKILL.md`、脚本源码或提交记录。
The skill is described as a language-learning translator with TTS, but this file adds Feishu chat enumeration and arbitrary outbound messaging capabilities. That scope expansion creates a channel to discover chats and post content outside the user’s immediate translation request, which is dangerous because it enables unauthorized dissemination or misuse of the bot in unrelated conversations.
Listing all chats the bot has joined is unnecessary for a translation/pronunciation helper and exposes organizational metadata such as chat names, IDs, and descriptions. In the context of this skill, that capability broadens access well beyond the user’s request and can be used to map communication structure or target subsequent unauthorized messages.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parent.parent
_ENV_FILE = ROOT_DIR / ".env"
_ENV_TEMPLATE = """\
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parent.parent
_ENV_FILE = ROOT_DIR / ".env"
_ENV_TEMPLATE = """\
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _ensure_env_file():
"""Create .env template if it does not exist."""
if _ENV_FILE.exists():
return
_ENV_FILE.write_text(_ENV_TEMPLATE, encoding="utf-8")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _ensure_env_file():
"""Create .env template if it does not exist."""
if _ENV_FILE.exists():
return
_ENV_FILE.write_text(_ENV_TEMPLATE, encoding="utf-8")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _ensure_env_file():
"""Create .env template if it does not exist."""
if _ENV_FILE.exists():
return
_ENV_FILE.write_text(_ENV_TEMPLATE, encoding="utf-8")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _ensure_env_file():
"""Create .env template if it does not exist."""
if _ENV_FILE.exists():
return
_ENV_FILE.write_text(_ENV_TEMPLATE, encoding="utf-8")
The skill declares capabilities that imply access to environment variables, filesystem, network, and shell execution, but it does not define an explicit tool/permission scope. That creates an over-privileged execution model where a caller may not realize the skill can read secrets, write files, invoke commands, and make outbound requests. In this context the risk is elevated because the skill handles API keys and can also send content to external services.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
which ffmpeg
## 内置音色映射
Obtaining Feishu tenant tokens via FEISHU_APP_ID and FEISHU_APP_SECRET is not justified by the manifest’s narrowly stated purpose of translating text, producing pronunciation audio, and analyzing grammar. Environment-backed third-party messaging credentials introduce an external integration capability unrelated to the declared language-helper context.
This code uploads a local file to Feishu without any visible user-facing disclosure, consent, or restriction in this module. Even if intended for generated OPUS output, the function accepts an arbitrary path and could exfiltrate local file contents to an external service if called improperly elsewhere in the skill.
Sending an audio message to a Feishu chat without an explicit confirmation path allows the skill to perform an external side effect on behalf of the user silently. In a language-learning context, that is risky because it can spam chats, leak generated content to unintended recipients, or be repurposed for unauthorized outbound communication.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
_load_dotenv()
API_URL = "https://api.senseaudio.cn/v1/t2a_v2"
MODEL_NAME = "SenseAudio-TTS-1.0"
FALLBACK_VOICE_IDS = ["child_0001_b", "male_0004_a", "male_0018_a"]
RETRYABLE_HTTP_STATUS_CODES = {500, 502, 503, 504}
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
_load_dotenv()
API_URL = "https://api.senseaudio.cn/v1/t2a_v2"
MODEL_NAME = "SenseAudio-TTS-1.0"
FALLBACK_VOICE_IDS = ["child_0001_b", "male_0004_a", "male_0018_a"]
RETRYABLE_HTTP_STATUS_CODES = {500, 502, 503, 504}
The debug logging captures full input text, payloads, request metadata, and raw response bodies, which can contain sensitive user-provided content and operational details. If debug logs are enabled, this creates a clear data exposure risk through local files without minimization or redaction of text content.
The manifest describes translating user text, generating pronunciation audio via SenseAudio TTS, and providing grammar analysis. This file additionally exposes a separate concat command that executes an external binary (ffmpeg) to merge arbitrary audio files, which is a broader media-processing capability not declared in the stated purpose.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
ffmpeg = "ffmpeg"
try:
subprocess.run(
[ffmpeg, "-version"],
check=True,
stdout=subprocess.DEVNULL,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
ffmpeg, "-y", "-f", "concat", "-safe", "0",
"-i", str(manifest), "-c", "copy", str(output),
]
result = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace")
if result.returncode != 0:
raise SystemExit(result.stderr.strip() or "ffmpeg concat failed.")
The skill imports Feishu chat enumeration and message-sending capabilities even though its stated purpose is language learning with TTS support. This expands the tool's ability to interact with external communications systems, increasing the risk of unintended data disclosure or misuse beyond user expectations.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"-c:a", "libopus", "-b:a", "32k",
str(opus_path),
]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode != 0:
raise RuntimeError(f"ffmpeg WAV->OPUS failed:\n{result.stderr}")
return str(opus_path)
No suspicious patterns detected.