T09 · Insecure Skill Coding Practices
- Location
tdl_download_notify.py:20- Finding
Hard-Coded ServerChan SendKey Exposed in Source Code and Documentation
- Content
View full analysis
Vulnerability Details
File Locations:
tdl_download_notify.py:20-21SKILL.md:23-24
Vulnerability Type: Hard-coded service credential and plaintext secret disclosure
Risk Level: MediumVulnerable Code
tdl_download_notify.py:20-21:python SENDKEY = "sctp6765tcomfljakjcquc4e7mdaman" SERVERCHAN_API = f"https://sctapi.ftqq.com/{SENDKEY}.send"SKILL.md:23-24:markdown 2. **Server 酱已配置** - SendKey: `sctp6765tcomfljakjcquc4e7mdaman`Technical Analysis
The ServerChan SendKey is embedded directly in the executable source code and repeated in the public-facing documentation. A SendKey is a bearer credential: possession of the value is sufficient to submit notification requests to the associated ServerChan endpoint.
Anyone who can read the project package, source repository, build artifacts, backups, or documentation can recover and reuse this credential without authentication beyond the key itself. The key is also interpolated into the URL path. URLs may be retained in application diagnostics, HTTP traces, proxy logs, monitoring systems, or exception reports, creating additional disclosure opportunities.
During normal operation, the script transmits notification content to the ServerChan account associated with this fixed credential. That content can include:
- Telegram chat and message identifiers
- Local output directory paths
- Downloaded filenames, sizes, and modification times
- Download command error output
- Task completion and failure timestamps
The implementation therefore binds every installation of the Skill to the same embedded notification credential rather than requiring each operator to supply an independently protected secret.
Attack Path
- An attacker obtains read access to the Skill package, repository, documentation, artifact, or a copy of either affected file.
- The attacker extracts the plaintext SendKey.
- The attacker con ...[truncated 1380 chars]
- Remediation
View remediation
Remediation Suggestions
-
Immediately revoke and rotate the exposed ServerChan SendKey. Removing it from the current files is insufficient because copies may remain in source history, distributed artifacts, logs, caches, or backups.
-
Remove the real credential from both
tdl_download_notify.pyandSKILL.md. -
Load the key at runtime from a protected environment variable or secret-management service. For example:
python SENDKEY = os.environ.get("SERVERCHAN_SENDKEY") if not SENDKEY: raise RuntimeError("SERVERCHAN_SENDKEY is not configured") SERVERCHAN_API = f"https://sctapi.ftqq.com/{SENDKEY}.send" -
Ensure secret files and local environment configuration are excluded from version control and distributed Skill packages.
-
Replace the documentation value with an explicit placeholder such as
YOUR_SERVERCHAN_SENDKEY. -
Avoid logging the complete ServerChan endpoint. Redact the key from exceptions, traces, proxy logs, and diagnostic output.
-
Give each deployment its own independently revocable credential rather than sharing one key across all installations.
-
Minimize notification data by omitting or redacting local filesystem paths, sensitive filenames, Telegram identifiers, and unfiltered command error output unless they are operationally necessary.
-
Review ServerChan activity for unauthorized messages or quota consumption associated with the exposed key.
-
Add automated secret scanning to source-control and release pipelines to prevent future credential commits.
-
