T09 · Insecure Skill Coding Practices
- Location
scripts/run.js:60- Finding
Bearer Token Can Be Forwarded to an Arbitrary Server
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears intended for Pinterest analysis, but its bundled runner is broader than disclosed and handles API tokens and cached data in ways users should review before installing.
Install only if you are comfortable using a KeyAPI token with a generic runner. Prefer setting KEYAPI_TOKEN only in the process environment, avoid entering it into the interactive prompt, do not set KEYAPI_SERVER_URL unless you fully trust the destination, and periodically delete .keyapi-cache if it may contain profile or social graph data you do not want retained.
scripts/run.js:60Bearer Token Can Be Forwarded to an Arbitrary Server
scripts/run.js:242API Token Is Persisted in a Plaintext Project File Without Explicitly Restricted Permissions
The skill is presented as Pinterest-specific, but the described operational model includes generic script-driven MCP access, schema inspection, tool listing, local file caching, and evidence of multi-platform behavior. That mismatch matters because users and enforcement systems may grant trust based on the declared purpose while the actual capability surface is broader, enabling unintended tool use or data handling outside the expected Pinterest analysis scope.
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform pinterest --list-tools
The script is a generic KeyAPI runner that accepts arbitrary platforms and tool names, while the declared skill is specifically for Pinterest analysis. This creates a scope-expansion issue: a user or downstream agent can invoke unrelated APIs and capabilities through the same skill, bypassing the principle of least privilege and the manifest's stated purpose.
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*(.*)$/);
This line marks the start of logic explicitly designed to prompt for a token and persist it to .env. In a skill setting, embedding credential-capture workflow in code increases the chance that users provide secrets directly to the skill and that those secrets remain stored on disk for reuse or compromise.
// ── 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 provided API token to a plaintext .env file in the skill directory, creating persistent local secret storage. If the directory is shared, synced, logged, or accidentally committed, the token can be exposed and abused to access the external KeyAPI service.
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;
The skill requires access to an environment secret (KEYAPI_TOKEN) and describes executable Node-based workflows, but it does not declare any explicit tool scope or allowed-tools boundary. That omission weakens least-privilege guarantees and makes it harder for a host to constrain what the skill may invoke, especially since the content references generic script execution and MCP tool access.
The skill instructs persistent local caching of profile, follower, following, and related response data under .keyapi-cache/ without clear user warning, retention limits, or handling guidance. Even if the source data is externally accessible, storing social graph data on disk creates privacy, compliance, and accidental disclosure risk on shared machines or in synced workspaces.