T09 · Insecure Skill Coding Practices
- Location
SKILL.md:20- Finding
Plaintext API Key Persistence and Missing HTTPS Enforcement
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 20–51
Vulnerability Type:T09: Insecure Skill Coding Practices
Risk Level: MediumThe Skill recommends persisting a long-lived WeKnora API key in a plaintext shell startup file. It subsequently transmits that key to the environment-configured base URL without validating that the URL uses HTTPS.
bash export WEKNORA_BASE_URL="https://your-server.com/api/v1" export WEKNORA_API_KEY="sk-your-api-key"> Add the above to
~/.zshrcor~/.bashrcto persist across sessions.bash if [ -z "$WEKNORA_BASE_URL" ] || [ -z "$WEKNORA_API_KEY" ]; then echo "Missing WeKnora credentials. Set WEKNORA_BASE_URL and WEKNORA_API_KEY per Setup." exit 1 fibash wk_api() { local method="$1" endpoint="$2" body="$3" curl -s -X "$method" "$WEKNORA_BASE_URL/$endpoint" \ -H "X-API-Key: $WEKNORA_API_KEY" \ -H "Content-Type: application/json" \ -H "X-Request-ID: $(uuidgen 2>/dev/null || date +%s)" \ ${body:+-d "$body"} }Technical Analysis
Shell startup files are generally plaintext configuration files and are not purpose-built secret stores. Persisting the API key in
~/.zshrcor~/.bashrcincreases its exposure to local users, processes, backup systems, diagnostic tooling, and accidental disclosure through configuration sharing.Although the example base URL uses HTTPS, the request helper accepts any value supplied through
WEKNORA_BASE_URL. It performs no scheme validation before placingWEKNORA_API_KEYin theX-API-Keyheader. If the variable is configured with anhttp://URL, the credential and request contents can traverse the network without transport encryption.Attack Path
Local credential-disclosure path:
- A user follows the documented persistence recommendation and stores
WEKNORA_API_KEYin a shell startup file. - Another local account, process, backup service, s ...[truncated 1359 chars]
- A user follows the documented persistence recommendation and stores
- Remediation
View remediation
Remediation Suggestions
- Do not recommend storing API keys directly in
~/.bashrc,~/.zshrc, or other plaintext startup files. - Retrieve the credential from a platform secret manager, operating-system keychain, or dedicated credential helper at runtime.
- If file-based storage is unavoidable, use a dedicated file with permissions restricted to the owner, such as mode
0600, and load it only for the process that requires the credential. - Validate
WEKNORA_BASE_URLbefore every request and reject any URL that does not usehttps://. - If local plaintext HTTP is required for development, allow it only through an explicit opt-in restricted to loopback addresses such as
127.0.0.1orlocalhost. - Consider restricting allowed API hosts to a configured allowlist to reduce credential forwarding to unintended destinations.
- Apply least privilege and expiration controls to API keys, and rotate any key that may previously have been stored or transmitted insecurely.
- Ensure shell profiles, backups, logs, and support archives do not contain previously persisted credentials.
- Do not recommend storing API keys directly in
