T09 · Insecure Skill Coding Practices
- Location
scripts/configure-keyapi-auth.mjs:121- Finding
Bearer Token Persisted in Plaintext Shell Profile Without Permission Hardening
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its stated KeyAPI Facebook data purpose, but it needs Review because it stores and reuses a bearer token through shell profile files and exposes a broad authenticated API helper.
Review before installing. Use this only if you are comfortable giving KeyAPI a bearer token for live API calls. Prefer setting KEYAPI_TOKEN only for the current session or using a safer secret store instead of the setup script's persistent shell-profile storage; avoid passing real tokens with --token or entering them while screen sharing. Confirm broad API reports and output-file paths before running, and protect or delete saved response files.
scripts/configure-keyapi-auth.mjs:121Bearer Token Persisted in Plaintext Shell Profile Without Permission Hardening
references/setup-and-auth.md:39Documented Command-Line Token Option Exposes Credentials Through Process and Shell Metadata
scripts/configure-keyapi-auth.mjs:199Interactive Token Prompt Does Not Disable Terminal Echo
Referenced artifact was not completely inspected
2. Check auth with `node scripts/configure-keyapi-auth.mjs --status` when script execution is available and setup state is unknown; treat `authStatus: "availabl
Referenced artifact was not completely inspected
2. Check auth with `node scripts/configure-keyapi-auth.mjs --status` when script execution is available and setup state is unknown; treat `authStatus: "availabl
Referenced artifact was not completely inspected
2. Check auth with `node scripts/configure-keyapi-auth.mjs --status` when script execution is available and setup state is unknown; treat `authStatus: "availabl
Referenced artifact was not completely inspected
2. Check auth with `node scripts/configure-keyapi-auth.mjs --status` when script execution is available and setup state is unknown; treat `authStatus: "availabl
Referenced artifact was not completely inspected
2. Check auth with `node scripts/configure-keyapi-auth.mjs --status` when script execution is available and setup state is unknown; treat `authStatus: "availabl
Referenced artifact was not completely inspected
9. Resolve current docs with `node scripts/search-keyapi-docs.mjs --query "<semantic entity action>" --resolve` when the helper script is available; otherwise o
Referenced artifact was not completely inspected
9. Resolve current docs with `node scripts/search-keyapi-docs.mjs --query "<semantic entity action>" --resolve` when the helper script is available; otherwise o
Referenced artifact was not completely inspected
9. Resolve current docs with `node scripts/search-keyapi-docs.mjs --query "<semantic entity action>" --resolve` when the helper script is available; otherwise o
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
12. Prefer `node scripts/keyapi-api.mjs` for live REST calls when script execution is available. Use the host's HTTP client only when scripts are unavailable or
Referenced artifact was not completely inspected
a different current working directory, resolve `scripts/...` relative to this `SKILL.md`. For large JSON bodies, especially base64 image payloads, prefer `--bo
The guidance explicitly recommends saving full API helper results to local temporary or workspace files for analysis, but it does not warn that those files may contain sensitive response data, identifiers, or metadata. In an agent environment, temp/workspace files may persist longer than intended, be readable by other processes or users, or be accidentally exposed in logs, artifacts, or follow-on tool outputs.
The script persists the provided API token by writing it into the user's shell profile, causing the credential to be automatically loaded into future shells and increasing its exposure window. For a read-only data-exploration skill, modifying persistent startup files is an unnecessarily invasive setup step that can leak secrets to other local processes, terminal histories/workflows, backups, or later commands that inherit the environment.
The skill is described as exploring public Facebook data, but the implementation is a general authenticated API client that accepts arbitrary paths within /v1/facebook, arbitrary HTTP methods, query parameters, and JSON bodies. That creates a capability mismatch: users or higher-level agents may reasonably assume read-only behavior, while the script can perform state-changing or privileged API actions if the backend exposes them, increasing the risk of unintended writes or abuse with the user's token.
The script reads shell profile files and parses a managed block to recover KEYAPI_TOKEN automatically. Even though it targets a specific token, this expands the skill's access into sensitive local configuration unrelated to simply exploring Facebook data, and normalizes reading secrets from user profile files without explicit consent at execution time.
This code creates directories and writes JSON output to an arbitrary filesystem path supplied by --output-file, which is a user-data-affecting operation. The file contains no user-facing warning, confirmation prompt, or explanatory comment/docstring near the write path to disclose that it will create parent directories and overwrite the target file.
Detected: suspicious.env_credential_access, suspicious.secret_argv_exposure