T09 · Insecure Skill Coding Practices
- Location
scripts/publish_xhs.py:205- Finding
Full Authentication Cookie Can Be Forwarded to an Arbitrary API Endpoint
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is mostly coherent for creating and publishing Xiaohongshu notes, but it handles a full account cookie in ways that deserve careful review before installation.
Install only if you are comfortable giving the skill access to a Xiaohongshu session cookie. Keep .env local and out of source control, prefer a dedicated account, use dry-run and private posting first, avoid --api-mode unless the API service is your own trusted local service, and do not render Markdown from untrusted sources without sandboxing or sanitization.
scripts/publish_xhs.py:205Full Authentication Cookie Can Be Forwarded to an Arbitrary API Endpoint
scripts/render_xhs.py:105Untrusted Markdown and Metadata Are Rendered as Active Browser HTML
requirements.txt:4Open-Ended Dependency Constraints Permit Unreviewed Future Package Code
The documented workflow explicitly tells users to create a .env file to hold a live authenticated cookie, which centralizes a highly sensitive credential for an automation tool that can publish on the user's behalf. In the context of an agent skill for social-media automation, this is more dangerous because users may install and run it with broad filesystem/tool access, increasing the chance of secret leakage or misuse.
cp env.example.txt .env
编辑 .env:
This is another instance of the same core problem: the skill declaration suggests broader automated creation and publishing than the implementation supports. In a skill that may touch credentials and files, inaccurate behavior claims increase operational risk because users may invoke it in situations where tighter scrutiny or consent would otherwise be required.
This is another instance of the same core problem: the skill declaration suggests broader automated creation and publishing than the implementation supports. In a skill that may touch credentials and files, inaccurate behavior claims increase operational risk because users may invoke it in situations where tighter scrutiny or consent would otherwise be required.
This is another instance of the same core problem: the skill declaration suggests broader automated creation and publishing than the implementation supports. In a skill that may touch credentials and files, inaccurate behavior claims increase operational risk because users may invoke it in situations where tighter scrutiny or consent would otherwise be required.
This is another instance of the same core problem: the skill declaration suggests broader automated creation and publishing than the implementation supports. In a skill that may touch credentials and files, inaccurate behavior claims increase operational risk because users may invoke it in situations where tighter scrutiny or consent would otherwise be required.
This is another instance of the same core problem: the skill declaration suggests broader automated creation and publishing than the implementation supports. In a skill that may touch credentials and files, inaccurate behavior claims increase operational risk because users may invoke it in situations where tighter scrutiny or consent would otherwise be required.
This is another instance of the same core problem: the skill declaration suggests broader automated creation and publishing than the implementation supports. In a skill that may touch credentials and files, inaccurate behavior claims increase operational risk because users may invoke it in situations where tighter scrutiny or consent would otherwise be required.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 小红书 Cookie 配置
# 将此文件复制为 .env 并填入真实的 Cookie
#
# 获取方式:
# 1. 在浏览器中登录小红书 (https://www.xiaohongshu.com)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 小红书 Cookie 配置
# 将此文件复制为 .env 并填入真实的 Cookie
#
# 获取方式:
# 1. 在浏览器中登录小红书 (https://www.xiaohongshu.com)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 小红书 Cookie 配置
# 将此文件复制为 .env 并填入真实的 Cookie
#
# 获取方式:
# 1. 在浏览器中登录小红书 (https://www.xiaohongshu.com)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 小红书 Cookie 配置
# 将此文件复制为 .env 并填入真实的 Cookie
#
# 获取方式:
# 1. 在浏览器中登录小红书 (https://www.xiaohongshu.com)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 小红书 Cookie 配置
# 将此文件复制为 .env 并填入真实的 Cookie
#
# 获取方式:
# 1. 在浏览器中登录小红书 (https://www.xiaohongshu.com)
Using a .env file for secrets is common, but in this skill context it is paired with instructions to place a live browser-derived authentication cookie into that file. That creates a real credential exposure risk because .env files are frequently mishandled, copied, or accidentally committed, and the skill provides no compensating safeguards.
cp env.example.txt .env
编辑 .env:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""从 .env 文件加载 Cookie"""
# 尝试从多个位置加载 .env
env_paths = [
Path.cwd() / '.env',
Path(__file__).parent.parent / '.env',
Path(__file__).parent.parent.parent / '.env',
]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""从 .env 文件加载 Cookie"""
# 尝试从多个位置加载 .env
env_paths = [
Path.cwd() / '.env',
Path(__file__).parent.parent / '.env',
Path(__file__).parent.parent.parent / '.env',
]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""从 .env 文件加载 Cookie"""
# 尝试从多个位置加载 .env
env_paths = [
Path.cwd() / '.env',
Path(__file__).parent.parent / '.env',
Path(__file__).parent.parent.parent / '.env',
]
The README instructs users to extract their full authenticated Xiaohongshu session cookie from browser developer tools and store it in .env for automated publishing. A full session cookie is effectively an account bearer token; if exposed through logs, backups, shell history, malware, or accidental sharing, it can enable account takeover or unauthorized posting.
The skill advertises capabilities that involve reading local files, consuming environment secrets, and potentially performing network-backed publishing, but it does not declare any explicit tool scope or permission boundaries. This is dangerous because an agent or reviewer cannot easily determine what resources the skill is allowed to access, increasing the chance of overbroad execution and secret exposure such as XHS_COOKIE.
The manifest description and title describe the skill exclusively as a 小红书 note creation skill and the instructions throughout the file are written to produce content in that platform's Chinese-language style, but there is no statement that the user can choose another language or locale. This can violate a language/locale policy when a skill implicitly forces a specific language or regional format without explicit opt-in.
The document language is hard-coded to zh-CN, which imposes a specific language/locale setting. There is no nearby natural-language explanation that this template is region-specific or that users can opt into a different locale.
The document declares lang="zh-CN", which hard-codes a specific language/locale. Under the policy, locale constraints should either offer user choice or be clearly documented as justified for a region-specific skill, which is not present in this file.
This markdown file presents the skill content entirely in Chinese and targets '小红书笔记' creation without indicating that language selection is optional. Under the policy rule, a skill that implicitly forces a specific language or locale without opt-in should be flagged unless the locale constraint is clearly documented and justified.
The install script invokes npx playwright install chromium, which can resolve and execute a package based on the environment's package state rather than a tightly controlled, explicitly pinned binary. In build or agent environments, this weakens supply-chain guarantees and can result in unexpected code execution or installation behavior if resolution is manipulated or a different package version is used than intended.
The document instructs users to extract and store a full Xiaohongshu session cookie in a local .env file, but it provides no warning that this cookie is a highly sensitive authentication secret equivalent to account access. If the file is exposed through source control, logs, backups, or shared environments, an attacker could reuse the cookie to publish content or access the account.
This request transmits sensitive authentication material and session state to an API endpoint, expanding the trust boundary beyond the local script. In the context of a publishing skill that operates on a real social-media account, external transmission of cookies can directly enable account takeover or unauthorized posting if the endpoint or network path is compromised.
# 初始化 session
try:
resp = requests.post(
f"{self.api_url}/init",
json={
"session_id": self.session_id,
No suspicious patterns detected.