T09 · Insecure Skill Coding Practices
- Location
scripts/run.js:59- Finding
Bearer Token Can Be Redirected to an Arbitrary Server
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This TikTok analytics skill is not clearly malicious, but it needs Review because it persists secrets and cached data locally while exposing broader MCP and server-routing authority than its stated purpose requires.
Install only if you are comfortable giving this skill a KeyAPI token, storing TikTok/API results on local disk, and using a generic KeyAPI MCP runner. Prefer setting KEYAPI_TOKEN only in the process environment, avoid the interactive prompt that writes .env, keep KEYAPI_SERVER_URL unset unless you fully trust the endpoint, and periodically remove .keyapi-cache and any .env file you do not intend to retain.
scripts/run.js:59Bearer Token Can Be Redirected to an Arbitrary Server
scripts/run.js:242Interactive API Token Is Persisted in Plaintext Without Explicit Permission Hardening
package.json:5Dependency Installation Is Not Reproducibly Locked
The skill is presented as a TikTok analytics helper, but its instructions expose broader meta-capabilities: listing tools, inspecting arbitrary schemas, generic MCP invocation, local caching, pagination, and file output. This mismatch increases risk because a user or agent may trust the declared narrow purpose while the actual workflow enables more general API exploration and local side effects than advertised.
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --list-tools
Referenced artifact was not completely inspected
node scripts/run.js --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.
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 writes the bearer token to a plaintext .env file in the project root. In the context of a reusable skill, that creates a concrete secret-exposure risk because the token can be recovered by other local users/processes, included in backups, or accidentally committed to source control.
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 privileged capabilities via environment access (KEYAPI_TOKEN) and execution of node scripts/run.js, but it does not declare any explicit tool scope such as permissions or allowed-tools. That omission weakens policy enforcement and transparency, making it easier for the skill to invoke broader local execution or tool functionality than a reviewer or runtime might expect.
The skill mandates persistent local caching of retrieved TikTok content, comments, captions, analytics, live-stream details, and downloaded images under .keyapi-cache/ without warning about data retention or sensitivity. Writing third-party content and analytics to disk can create privacy, compliance, and data-leakage risks, especially on shared workstations, CI runners, or multi-tenant agent environments.
The script is a generic MCP tool runner that can list schemas and invoke any server-exposed tool by name, not just tools needed for TikTok content analysis. In a skill context, that creates capability overreach: a user invoking this skill may unknowingly grant access to a much broader operation set than the manifest describes.
The runner accepts an arbitrary --platform value and builds the server URL dynamically, even though the skill is described as TikTok content analysis. This scope expansion can expose users to unreviewed capabilities and data flows on other platforms, undermining least-privilege and making the skill behave more broadly than advertised.
No suspicious patterns detected.