T09 · Insecure Skill Coding Practices
- Location
scripts/run.js:49- Finding
Bearer Token Disclosure Through Unrestricted MCP Server Override
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Reddit-analysis skill is mostly coherent, but its runner has broader platform/network authority and weaker token handling than the Reddit-only description makes clear.
Review this before installing. Use KEYAPI_TOKEN from a controlled environment variable, avoid entering it into the interactive prompt, check that KEYAPI_SERVER_URL is unset or points only to the intended KeyAPI host, and expect Reddit results to be cached locally until you delete them.
scripts/run.js:49Bearer Token Disclosure Through Unrestricted MCP Server Override
scripts/run.js:251API Token Collected Visibly and Persisted in a Plaintext Environment File
package.json:5Unpinned Dependency Resolution Without a Lockfile
The documentation presents a Reddit-specific analysis skill, but the detected behavior indicates generic MCP tool invocation, multi-platform capability, and unrelated TikTok/image-processing paths. This mismatch is dangerous because users and policy systems may authorize the skill under a narrow Reddit-only trust model while the underlying implementation can reach broader remote functionality with the provided bearer token.
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --platform reddit --list-tools
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 function is designed to interactively solicit a secret from the user and persist it to a plaintext .env file in the skill directory. In a skill whose stated purpose is Reddit analysis, prompting for and storing credentials locally increases secret-handling risk, especially if the directory is shared, backed up, or accidentally committed.
// ── MCP client ────────────────────────────────────────────────────────────────
/** Prompt for KEYAPI_TOKEN interactively and persist it to .env */
async function promptToken() {
if (!process.stdin.isTTY) {
throw new Error(
This line writes the provided KEYAPI_TOKEN directly to a plaintext .env file, creating persistent local exposure of the credential. If the working directory is readable by other users, synchronized to cloud storage, or mistakenly committed, the token can be stolen and abused to access the external API.
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 a sensitive environment variable (KEYAPI_TOKEN) and clearly instructs users to execute Node-based tooling, but it does not declare an explicit tool scope such as allowed-tools or permissions. That weakens policy boundaries and makes it harder to constrain what the skill may invoke or access, especially given the surrounding references to generic runner scripts and remote MCP access.
The skill explicitly recommends collecting, profiling, and locally caching Reddit user and community data under a dated cache directory, but it provides no warning, retention guidance, access controls, or privacy considerations. Even though the data is nominally public, aggregating and storing profiles, activity patterns, and community affiliations locally increases privacy risk, persistence, and the chance of secondary misuse or accidental disclosure.
The script is a generic MCP runner that can invoke arbitrary KeyAPI tools across multiple platforms, while the skill is described narrowly as Reddit user/subreddit analysis. This expands the effective capability surface beyond the declared purpose, increasing the risk of misuse, unexpected data access, and hidden functionality that a user or reviewer would not reasonably expect from this skill.
The skill's purpose is to analyze Reddit users and subreddits, but this script includes its own .env parser and interactive token prompt that writes KEYAPI_TOKEN to disk for future reuse. Persisting credentials locally is an operational capability beyond the user-facing analysis purpose and is not declared in the manifest description.