T09 · Insecure Skill Coding Practices
- Location
iching.py:13- Finding
Hard-Coded API Credential in Source Code
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This I Ching skill mostly matches its stated purpose, but it sends users' questions to an undisclosed third-party AI endpoint by default and includes a hardcoded API key plus broader tool permissions than the feature needs.
Install only after the publisher removes and rotates the embedded API key, documents the third-party AI endpoint and data sent, makes remote AI interpretation opt-in, narrows the activation scope to explicit divination requests, and reduces allowed tools to what the skill actually needs.
iching.py:13Hard-Coded API Credential in Source Code
iching.py:181User Questions Are Transmitted to an Undisclosed Third-Party Endpoint by Default
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
)
try:
with urllib.request.urlopen(req, timeout=60) as resp:
result = json.loads(resp.read())
return result["choices"][0]["message"]["content"]
except Exception as e:
The core functional purpose broadly matches the description: this is indeed an I Ching divination/interpretation tool. However, the declared permissions list is empty, while the code clearly performs external HTTP POST requests to https://api.sfkey.cn/v1/chat/completions and authenticates with a bearer token. That is a materially undeclared capability/resource access. Additionally, the code includes a hardcoded fallback API key, which is a sensitive credential-handling behavior not reflected in the description or permissions. So this is not a purpose mismatch, but it is a description/behavior mismatch on capabilities and resource access.
The code reads environment variables to obtain credentials, but the skill metadata apparently does not declare this capability. Undeclared access to secrets/environment weakens least-privilege guarantees and makes review and operator consent less reliable.
The skill embeds a hardcoded bearer token in source code and uses it to call a third-party API. Hardcoded credentials are easily leaked via source control, logs, packaging, or reuse by unauthorized parties, enabling abuse of the external service and possible billing/account compromise.
Using an embedded default API credential without disclosure is dangerous because it silently authorizes external network use and exposes a reusable secret to anyone with code access. In practice, this can lead to credential theft, quota exhaustion, unauthorized billing, and loss of control over the linked account.
The trigger list is very broad, covering common topics like business decisions, career, relationships, money, future, and general advice. This can cause the skill to activate in many ordinary conversations, potentially overriding more appropriate domain-specific skills and steering users toward ungrounded divination-style guidance in sensitive decision contexts.
The description strongly centers Chinese-language behavior and does not indicate that the assistant should respect the user's preferred language. This can degrade usability and cause confusing or inaccessible responses, especially when the skill auto-triggers for non-Chinese-speaking users.
This skill is a content-only divination/advice skill, yet it requests Bash, Write, and WebFetch capabilities that are not necessary for interpreting I Ching guidance. Excess permissions enlarge the attack surface: if the skill is ever triggered or modified, it could access the filesystem, write files, run shell commands, or fetch remote content unrelated to the user's request.
The usage examples instruct fixed Chinese-language system responses without offering a locale choice. In combination with broad triggers, this increases the chance that users receive responses in an unexpected language, reducing clarity and trust.
The code performs external transmission to a third-party endpoint, which is expected for an AI-backed feature but still security-relevant. In this skill context, the danger is elevated because users may reveal sensitive personal concerns during divination and are not clearly told their data leaves the local tool.
# API配置
MINIMAX_KEY = os.environ.get('MINIMAX_KEY', 'sk-y9avgZsHEoTQ9be4jBVvmaEjWAvmJgfAs7ZCJ1lMRUrMNqvr')
MINIMAX_URL = "https://api.sfkey.cn/v1/chat/completions"
class Bagua:
The manifest describes a divination tool, but the code transmits user questions to an external AI provider for interpretation. That mismatch is security-relevant because users and reviewers may not expect third-party data sharing, especially for sensitive personal, emotional, or decision-making questions.
User-submitted divination questions are sent verbatim to an external AI service without any visible warning, consent, or minimization. Because users may include intimate relationship, health, career, or financial details, this creates a real privacy and data-governance risk in the context of a seemingly harmless spiritual tool.
The instruction 用中文回答。 hard-codes the model's response language. This is a natural-language locale policy issue because the skill does not offer the user any language selection or document that it is intentionally limited to Chinese-only use.