T09 · Insecure Skill Coding Practices
- Location
scripts/add_comment.sh:13- Finding
Hardcoded Feishu Application Secret
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is meant to edit Feishu documents, but it ships a Feishu app secret and can make credential-backed document changes without tight user controls.
Review before installing. The publisher should remove and rotate the exposed Feishu secret, require credentials from a protected runtime source, JSON-encode comment content, narrow activation to explicit Feishu document URLs or requests, and require confirmation before each document-changing action.
scripts/add_comment.sh:13Hardcoded Feishu Application Secret
scripts/add_comment.sh:30Unsafe JSON Construction Using Unescaped Comment Text
The skill advertises three document-editing capabilities, but the documented implementation only concretely covers comment insertion via a shell script and direct API call. This mismatch can mislead users and reviewers about what code actually exists and what trust boundary applies, which is dangerous when hidden or undocumented behavior may be introduced later.
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
APP_SECRET="${FEISHU_APP_SECRET:-lo4II96JWo5W0DMjgYfZ1diOodp8xlnj}"
# 获取 tenant_access_token
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['tenant_access_token'])")
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
fi
# 添加批注
RESULT=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/drive/v1/files/${DOC_TOKEN}/comments?file_type=docx" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
The skill invokes a shell script for comment creation but does not declare tool scope such as allowed-tools or permissions. That increases the chance an agent can use broader execution capabilities than users expect, which is risky because the same skill also handles credentials and external API calls.
The trigger phrases are broad enough to match generic requests like 'review一下文档' or '标注一下', which could cause the skill to activate outside the intended Feishu context. Because the skill performs write operations on documents, overbroad activation raises the risk of accidental modification of the wrong target or use in situations the user did not intend.
The instructions tell the agent to perform highlight, underline, and comment operations that modify a live document, but they do not require an explicit user-facing warning or confirmation before making changes. In a document-review context this is risky because users may believe they are asking for analysis rather than immediate edits, leading to unintended persistent modifications.
The skill directs use of sensitive credentials and direct POST requests to an external API without clearly warning the user that authentication material will be used and data will be transmitted to Feishu. This is dangerous because it obscures external data flow and credential-backed actions behind a simple review request, reducing transparency and increasing the chance of unauthorized or unexpected network activity.
The documentation authorizes use of a specific app ID and suggests reading the app secret from environment variables or even using a directly known secret value. Embedding or encouraging direct use of credentials in skill instructions expands access beyond ordinary document review and creates a serious risk of secret exposure, misuse, or unauthorized API actions.
The script embeds a default Feishu app secret directly in code via the fallback value for FEISHU_APP_SECRET. Hard-coded secrets are dangerous because anyone with access to the script can recover and abuse the credential to mint access tokens and act against the associated Feishu tenant.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
APP_SECRET="${FEISHU_APP_SECRET:-lo4II96JWo5W0DMjgYfZ1diOodp8xlnj}"
# 获取 tenant_access_token
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['tenant_access_token'])")
The script performs an HTTP request to obtain an access token and then uses that token to call the Feishu API, transmitting credentials and user-supplied comment content. Although there are inline comments describing the mechanics, there is no user-facing warning, confirmation, or disclosure that document data and secrets will be sent to an external service.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
fi
# 添加批注
RESULT=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/drive/v1/files/${DOC_TOKEN}/comments?file_type=docx" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
The activation guidance and example invocations are presented only in Chinese, implying a language-specific usage model without documenting user opt-in or a justified region-specific constraint. Under the policy rule, forcing or assuming a specific language without choice can be a natural-language policy concern.
Comments and user-facing messages in the script are written only in Chinese, including the usage text and success or failure output. The file does not offer any language choice or explain that the skill is intentionally restricted to a Chinese-speaking context, which can violate language/locale policy expectations.