T09 · Insecure Skill Coding Practices
- Location
SKILL.md:33- Finding
AMiner API Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 33-51
Vulnerability Type: Insecure credential handling through command-line arguments
Risk Level: MediumVulnerable Code
bash # Scholar profile analysis python scripts/aminer_client.py --token <TOKEN> --action scholar_profile --name "Andrew Ng" # Paper deep dive (with citation chain) python scripts/aminer_client.py --token <TOKEN> --action paper_deep_dive --title "Attention is all you need" # Organization analysis python scripts/aminer_client.py --token <TOKEN> --action org_analysis --org "清华大学" # Venue/journal paper monitoring python scripts/aminer_client.py --token <TOKEN> --action venue_papers --venue "Nature" --year 2024 # Academic Q&A (natural language) python scripts/aminer_client.py --token <TOKEN> --action paper_qa --query "transformer架构最新进展" # Patent search python scripts/aminer_client.py --token <TOKEN> --action patent_search --query "量子计算"The same
--token <TOKEN>pattern is repeated in the workflow examples at approximately lines 85, 102, 120, 137, 147, and 161.Technical Analysis
The documentation instructs users to substitute an AMiner API token directly into a command-line argument. Secrets supplied this way can be exposed through:
- Shell history files.
- Process listings and process-monitoring utilities while the command is running.
- Terminal session recording.
- CI/CD command logs and diagnostic output.
- Wrapper scripts, telemetry, or error reports that capture complete command lines.
This practice is unnecessary because the Skill metadata already declares the
AMINER_TOKENenvironment variable. The referencedscripts/aminer_client.pyimplementation is absent from the audited project, so its token redaction and handling behavior cannot be verified.Attack Path
- A user follows one of the documented examples and replaces `<TOKEN> ...[truncated 1074 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove every
--token <TOKEN>example fromSKILL.md. - Make the client read the credential from the declared
AMINER_TOKENenvironment variable or from a supported operating-system secret store. - For interactive use, permit token entry through a non-echoing prompt or protected standard input rather than a command-line option.
- If a
--tokenoption must remain for compatibility, clearly mark it as deprecated and reject or warn about its use in production and shared environments. - Ensure authorization headers and tokens are redacted from application logs, exception messages, HTTP debugging output, telemetry, and retry diagnostics.
- Add the referenced
scripts/aminer_client.pyimplementation to the package so its credential handling can be reviewed and tested. - Add automated tests verifying that tokens never appear in logs, exceptions, or serialized workflow results.
- Advise users who previously followed these examples to remove affected shell-history entries and rotate potentially exposed AMiner tokens.
- Remove every
