T09 · Insecure Skill Coding Practices
- Location
SKILL.md:83- Finding
API Key Disclosed by Configuration Status Command
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:83-85
Vulnerability Type: Credential exposure through unsafe shell parameter expansion
Risk Level: HighVulnerable Code:
bash # Check if key is configured echo "Key: ${SPARKI_API_KEY:+configured}${SPARKI_API_KEY:-MISSING}"Technical Analysis
The command is presented as a status check, but it prints the actual API key whenever
SPARKI_API_KEYis set. The first expansion,${SPARKI_API_KEY:+configured}, produces the wordconfigured, while the second expansion,${SPARKI_API_KEY:-MISSING}, produces the secret value. These results are concatenated.For example, if the environment contains
SPARKI_API_KEY=sk_live_secret, the command prints:text Key: configuredsk_live_secretThis exposes a credential in standard output rather than merely reporting whether it is configured.
Attack Path
- A user configures
SPARKI_API_KEYas instructed by the skill. - The prerequisite status command is executed.
- The shell expands the environment variable to its complete secret value.
- The secret is written to terminal output.
- The credential may be captured by an agent transcript, shell log, CI log, terminal recording, monitoring system, or another party with access to command output.
- An attacker who obtains the key may submit authenticated requests to the associated service, subject to the permissions assigned to that key.
Impact Assessment
The vulnerability directly compromises the confidentiality of
SPARKI_API_KEY. An attacker could obtain the same service-level privileges granted to the exposed key, potentially including media uploads, project creation, project-status access, and consumption of account resources. The precise scope depends on server-side permissions and account controls. This issue does not by itself grant local operating-system privileges.- A user configures
- Remediation
View remediation
Remediation Suggestions
Replace the unsafe expansion with a status-only conditional that never interpolates the credential into output:
bash if [[ -n "${SPARKI_API_KEY:-}" ]]; then echo "Key: configured" else echo "Key: MISSING" fiAdditional hardening measures:
- Never print, trace, or log API keys, including during diagnostic operations.
- Disable shell tracing before handling credentials and ensure callers do not invoke the workflow with
set -x. - Redact authorization headers and environment variables from agent transcripts and CI logs.
- Rotate any credential that may already have been exposed by this command.
- Restrict API keys to the minimum required permissions and apply expiration, quotas, and server-side audit logging.
