T09 · Insecure Skill Coding Practices
- Location
scripts/yinxiang.py:43- Finding
Full-Access API Token Stored Without File-Permission Safeguards
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:13-17;scripts/yinxiang.py:43-53
Vulnerability Type: Plaintext credential storage with missing ownership and permission validation
Risk Level: MediumThe setup instructions direct users to store a full-account-access Yinxiang token in a plaintext
.envfile:text YINXIANG_TOKEN=S=your-token .env file path: ~/.qclaw/skills/evernote-yinxiang/.envThe implementation reads this file without verifying its owner, permissions, file type, or symbolic-link status:
python @staticmethod def _load_token(): env_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), ".env") if os.path.exists(env_path): with open(env_path) as f: for line in f: line = line.strip() if line and not line.startswith('#') and '=' in line: k, v = line.split('=', 1) if k.strip() == "YINXIANG_TOKEN": return v.strip() return os.environ.get("YINXIANG_TOKEN", "")Technical Analysis
Credential access is necessary for the Skill's declared Yinxiang integration. However, the token grants broad access to the user's account, while neither the instructions nor the implementation enforce least-exposure controls for the credential file.
Files created under a permissive user configuration may be readable by other local users or processes. The loader accepts the file regardless of whether it is group-readable, world-readable, owned by another user, or represented by a symbolic link. Consequently, the confidentiality of the token depends entirely on external filesystem settings that the Skill neither documents nor validates.
Token transmission itself is restricted to fixed Yinxiang production or sandbox hosts over HTTPS in the reviewed implementation. No transmission to unrelated domains was identified.
Attack Pat
...[truncated 1336 chars]
- Remediation
View remediation
Remediation Suggestions
-
Require restrictive permissions when creating the credential file. For example:
bash install -m 600 /dev/null ~/.qclaw/skills/evernote-yinxiang/.env -
Before reading the file, use
os.stat()oros.lstat()to verify that:- The file is owned by the current effective user.
- Group and other permission bits are unset.
- The path is a regular file.
- Symbolic links are rejected where supported.
-
Fail securely with a clear error if the ownership or mode is unsafe rather than silently loading the token.
-
Prefer an operating-system credential store or secret-management service over a plaintext project-local file.
-
If a file remains supported, document secure creation, backup, rotation, and revocation procedures.
-
Use the narrowest token scope supported by Yinxiang. If scoped tokens are unavailable, explicitly warn that compromise exposes the entire account.
-
Advise users to revoke and replace the token immediately if the
.envfile may have been exposed. Avoid printing the token in normal output, logs, or exception messages.
-
