T09 · Insecure Skill Coding Practices
- Location
scripts/check-env.sh:51- Finding
Partial API Key Disclosure Through Environment-Check Output
- Content
View full analysis
Vulnerability Details
File Location:
scripts/check-env.sh, lines 51-59
Vulnerability Type: Sensitive credential exposure through logs
Risk Level: MediumVulnerable Code:
bash # 只显示前 10 个字符用于验证 local display_value="${var_value:0:10}" if [ ${#var_value} -gt 10 ]; then display_value="${display_value}..." fi log_info "✓ $var_name 已设置 ($display_value)" return 0The function is invoked with
ARK_API_KEYat line 155:bash check_env_variable "ARK_API_KEY" || trueTechnical Analysis
The environment-check function prints the first ten characters of every inspected secret. Because it is called for
ARK_API_KEY, a portion of the API credential is disclosed to standard output.Confirming that a credential exists does not require revealing any part of its value. Terminal output may be retained in CI/CD logs, Agent conversation transcripts, remote execution records, shell captures, or diagnostic reports. Consequently, users with access to those records can obtain partial credential material.
Although the exposed prefix is unlikely to be sufficient for authentication by itself, it can identify the credential format, correlate the same credential across systems, reduce the unknown search space, and amplify exposure when combined with another partial leak.
Attack Path
- A user or Agent runs
scripts/check-env.shas recommended by the project documentation. check_env_variablereadsARK_API_KEYthrough indirect environment-variable expansion.- The function extracts and prints the first ten characters of the key.
- The output is retained in a terminal transcript, Agent conversation, CI log, support bundle, or other execution record.
- A party with access to that record obtains the credential prefix and may correlate it with other leaks or use it to identify the affected account or credential.
Exploitation requires access to the environment-check output; the ...[truncated 581 chars]
- A user or Agent runs
- Remediation
View remediation
Remediation Suggestions
- Never print any substring of an API key. Report only whether the variable is set.
- Replace the vulnerable output with a constant status message:
bash if [ -z "$var_value" ]; then log_error "Required environment variable is not set: $var_name" return 1 fi log_info "Required environment variable is configured: $var_name" return 0 - If operators require credential correlation, display a short one-way fingerprint calculated with a cryptographic hash instead of token characters. Clearly document that even fingerprints should not be emitted by default.
- Ensure CI and Agent execution systems redact known API-key formats from logs.
- Rotate the ARK API key if existing environment-check output has been published or shared with untrusted parties.
