T09 · Insecure Skill Coding Practices
- Location
scripts/run.js:59- Finding
Bearer Token Can Be Transmitted to an Arbitrary Server
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a KeyAPI data runner, but it is broader than its Amazon-only description and handles API tokens in ways users should review before installing.
Review this before installing. Use it only if you trust KeyAPI and the publisher, set KEYAPI_TOKEN through your environment or a secure secret store instead of the interactive prompt, do not commit any .env file, and avoid setting KEYAPI_SERVER_URL unless you intentionally want to send your token to that specific MCP server. Expect local API response caches under .keyapi-cache.
scripts/run.js:59Bearer Token Can Be Transmitted to an Arbitrary Server
scripts/run.js:254API Token Is Entered Visibly and Persisted in Plaintext
package.json:5Dependency Graph Is Not Reproducibly Pinned
The description presents an Amazon e-commerce analytics skill, but the supplied code does not implement Amazon-specific product/search/category/review/deals/seller functionality. Instead, it is a generic command-line client for a remote KeyAPI MCP server, able to list available tools, inspect schemas, and call arbitrary tools for different platforms. The code explicitly defaults to the TikTok platform and includes TikTok-specific image handling, with examples for TikTok and YouTube. While the runner could theoretically be used to access Amazon-related tools if such tools exist on the server, that behavior is not evidenced in this code chunk, and the primary purpose materially differs from the declared Amazon-focused description.
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform amazon --list-tools
The runner script’s documented behavior and examples target TikTok/YouTube influencer and social-media tooling, which materially conflicts with the skill manifest claiming Amazon e-commerce functionality. This kind of capability mismatch is dangerous because it can mislead users, reviewers, or higher-level agents into sending data or credentials to an unexpected service and invoking tools outside the declared trust boundary.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");
// ── .env loader ───────────────────────────────────────────────────────────────
(function loadDotenv() {
const envPath = join(ROOT, ".env");
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");
// ── .env loader ───────────────────────────────────────────────────────────────
(function loadDotenv() {
const envPath = join(ROOT, ".env");
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");
// ── .env loader ───────────────────────────────────────────────────────────────
(function loadDotenv() {
const envPath = join(ROOT, ".env");
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
// ── .env loader ───────────────────────────────────────────────────────────────
(function loadDotenv() {
const envPath = join(ROOT, ".env");
if (!existsSync(envPath)) return;
for (const line of readFileSync(envPath, "utf8").split("\n")) {
const m = line.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/);
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
// ── .env loader ───────────────────────────────────────────────────────────────
(function loadDotenv() {
const envPath = join(ROOT, ".env");
if (!existsSync(envPath)) return;
for (const line of readFileSync(envPath, "utf8").split("\n")) {
const m = line.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/);
The script interactively prompts for an API token and persists it to a plaintext .env file in the skill directory. Storing credentials unencrypted in a project-local file increases the chance of accidental disclosure through source control, backups, shared workspaces, or other local processes, especially because the skill already shows signs of functionality mismatch that weaken trust in intended scope.
// ── MCP client ────────────────────────────────────────────────────────────────
/** Prompt for KEYAPI_TOKEN interactively and persist it to .env */
async function promptToken() {
if (!process.stdin.isTTY) {
throw new Error(
This code writes the supplied KEYAPI_TOKEN directly into a plaintext .env file under the project root, creating a persistent local credential artifact. If the repository is shared, synced, backed up, or accidentally committed, the token can be exposed and reused for unauthorized API access.
reject(new Error("No token entered. Set KEYAPI_TOKEN and try again."));
return;
}
const envPath = join(ROOT, ".env");
writeFileSync(envPath, `KEYAPI_TOKEN=${token}\n`, "utf8");
log(`[token] Saved to ${envPath} — future runs will load it automatically`);
process.env.KEYAPI_TOKEN = token;