T09 · Insecure Skill Coding Practices
- Location
scripts/exec-token.js:58- Finding
Shell Command Injection and API Key Exposure in exec-token
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is coherent for New API account management, but it handles real API keys with broad shell execution and overbroad environment access that users should review before installing.
Install only if you are comfortable giving the skill access to your New API management token, token keys, config files you point it at, the local clipboard, and shell commands you explicitly ask it to run. Avoid exec-token for untrusted commands or shared machines; prefer applying keys to a narrow config file, keep New API credentials out of broad project .env files, and review the unpinned install source before updating.
scripts/exec-token.js:58Shell Command Injection and API Key Exposure in exec-token
scripts/env.js:16Project .env Loader Imports Unrelated Secrets into Child Process Environment
scripts/api.js:68Raw API Error Responses Are Printed Without Sanitization
scripts/inject-key.js:55Heuristic Config Scanning Can Disclose Secrets from Arbitrary Files
Referenced artifact was not completely inspected
New API calls should go through the provided scripts (`api.js`, `copy-key.js`, `inject-key.js`, `exec-token.js`) rather than using `curl`, `wget`, `fetch`, or o
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
**Q: Can I ask the AI to show me my real token key?**
A: No. The AI is strictly prohibited from reading or displaying raw keys. The only supported way to retrieve a real key is `/newapi copy-token`, which copies it to your clipboard silently.
**Q: Where do I find my access token and user ID?**
A: Log in to the New API web console and open Personal Settings. Generate an access token there; your user ID is shown on the same page.
**Q: What's the difference between access token and API token?**
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
**Q: Can I ask the AI to show me my real token key?**
A: No. The AI is strictly prohibited from reading or displaying raw keys. The only supported way to retrieve a real key is `/newapi copy-token`, which copies it to your clipboard silently.
**Q: Where do I find my access token and user ID?**
A: Log in to the New API web console and open Personal Settings. Generate an access token there; your user ID is shown on the same page.
**Q: What's the difference between access token and API token?**
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
**Q: Can I ask the AI to show me my real token key?**
A: No. The AI is strictly prohibited from reading or displaying raw keys. The only supported way to retrieve a real key is `/newapi copy-token`, which copies it to your clipboard silently.
**Q: Where do I find my access token and user ID?**
A: Log in to the New API web console and open Personal Settings. Generate an access token there; your user ID is shown on the same page.
**Q: What's the difference between access token and API token?**
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
**Q: Can I ask the AI to show me my real token key?**
A: No. The AI is strictly prohibited from reading or displaying raw keys. The only supported way to retrieve a real key is `/newapi copy-token`, which copies it to your clipboard silently.
**Q: Where do I find my access token and user ID?**
A: Log in to the New API web console and open Personal Settings. Generate an access token there; your user ID is shown on the same page.
**Q: What's the difference between access token and API token?**
The skill includes self-update instructions that fetch the latest remote skill code. Even though this is framed as normal maintenance, self-modification/update paths increase risk because a compromised upstream repository or unexpected update could change the skill's behavior without prior review.
**Q: How do I configure a third-party CLI that needs `config set ... <key>`?**
A: Use `/newapi exec-token <token_id> <command...>`. Write the full command but use the placeholder `__NEWAPI_TOKEN_{id}__` where the real key would go. The script replaces the placeholder and executes the command — the real key never enters the AI conversation. For example: `/newapi exec-token 42 openclaw config set provider.openai.apiKey __NEWAPI_TOKEN_42__`.
**Q: How do I install or update this skill?**
A: Run `npx skills add https://github.com/QuantumNous/skills --skill newapi`. This fetches the latest version from the [skills repository](https://github.com/QuantumNous/skills).
---
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Every API request uses Access Token auth with these headers:
Authorization: Bearer <NEWAPI_ACCESS_TOKEN>
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
/**
* Shared configuration loader for new-api scripts.
*
* Loads .env files (project root first, then skill dir) and validates
* the three required variables. Exports { BASE_URL, ACCESS_TOKEN, USER_ID }.
*
* Priority (higher overrides lower):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
/**
* Shared configuration loader for new-api scripts.
*
* Loads .env files (project root first, then skill dir) and validates
* the three required variables. Exports { BASE_URL, ACCESS_TOKEN, USER_ID }.
*
* Priority (higher overrides lower):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
/**
* Shared configuration loader for new-api scripts.
*
* Loads .env files (project root first, then skill dir) and validates
* the three required variables. Exports { BASE_URL, ACCESS_TOKEN, USER_ID }.
*
* Priority (higher overrides lower):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
/**
* Shared configuration loader for new-api scripts.
*
* Loads .env files (project root first, then skill dir) and validates
* the three required variables. Exports { BASE_URL, ACCESS_TOKEN, USER_ID }.
*
* Priority (higher overrides lower):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const projectRoot = findProjectRoot(process.cwd());
// Lower priority first, higher priority overwrites undefined keys
loadEnv(path.join(projectRoot, ".env"));
loadEnv(path.join(skillDir, ".env"));
const BASE_URL = process.env.NEWAPI_BASE_URL;
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const projectRoot = findProjectRoot(process.cwd());
// Lower priority first, higher priority overwrites undefined keys
loadEnv(path.join(projectRoot, ".env"));
loadEnv(path.join(skillDir, ".env"));
const BASE_URL = process.env.NEWAPI_BASE_URL;
The skill references operations involving network access and potentially sensitive credential handling, but it does not declare any explicit tool scope such as permissions or allowed-tools. Without a restrictive scope, an agent may invoke broader environment or network capabilities than intended, increasing the chance of secret exposure or unauthorized outbound requests if the skill or downstream docs are abused.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
- ENV: `OPENAI_API_KEY=__NEWAPI_TOKEN_42__`
- TOML: `api_key = "__NEWAPI_TOKEN_42__"`
Also set the base URL field if needed — use the value from `NEWAPI_BASE_URL` environment variable with `/v1` appended (e.g., `https://api.example.com/v1`). The base URL is NOT a secret and can be written directly.
**Step 3 — Apply the real key**:
This markdown skill description instructs the agent to extract and display personal account data including username, display name, email, group, and request count. The file does not include any user-facing warning that the action reveals potentially sensitive account information, which is required for markdown files when behavior could affect user privacy.
The documented success message is explicitly in Chinese: Token <token_id> 的密钥已复制到剪贴板。. This imposes a specific language choice in the skill's user-facing behavior without offering a language preference or documenting a justified locale restriction.
The skill promotes copying the real token to the local clipboard silently but does not warn that clipboard contents may be readable by other local applications, clipboard history tools, remote desktop software, or shared workstations. This can lead to accidental credential disclosure even though the token is not shown in chat.
The documentation describes executing arbitrary user-supplied commands after substituting a real secret into them, but does not explicitly warn about command injection, shell expansion, logging, process-list exposure, or writing secrets into config/history. This is especially risky because the feature bridges secret handling with command execution, increasing the chance of credential leakage or unsafe command execution.
The documentation instructs users to install or update the skill via npx skills add ... without pinning an exact package or repository version. That creates a supply-chain risk: future upstream changes or a compromised package/repository could deliver modified code at install time.
The documentation explicitly instructs users to execute arbitrary shell commands after substituting a real token into the command line. Even though the script is described as sanitizing output, this pattern can still expose secrets through process arguments, shell history, child-process behavior, or unsafe user-supplied commands, and the docs do not adequately warn about those risks. In a skill specifically designed to help copy and apply API keys, this omission makes accidental credential leakage more likely.
The manifest does mention securely copying keys to config files or commands, which justifies handling secrets, but it does not explicitly justify executing host shell commands via child_process. Here the script uses execSync both to discover installed binaries and to run a clipboard command, introducing host command execution capability beyond straightforward API/key management logic.
Line L70 prints the completion message only in Chinese, which imposes a specific language on users with no opt-in or fallback. The file contains no indication that this skill is intentionally region-specific or that users can select their preferred locale.
Line L65 specifies a fixed Chinese success message (已将 Token {token_id} 的密钥写入 {file_path}) with no indication that the user can choose language or locale. This is a natural-language policy issue because it imposes a specific language without opt-in or documented justification.
The script emits its final user-facing status message only in Chinese: "已将 Token ... 的密钥写入 ...". This imposes a specific language on users without any visible language selection, fallback, or documentation justifying a locale-specific constraint.