T09 · Insecure Skill Coding Practices
- Location
SKILL.md:176- Finding
Credential Exposure Through Broad Environment Variable Enumeration
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 176–181
Vulnerability Type: Plaintext exposure of sensitive environment variables
Risk Level: MediumVulnerable Code
bash # 验证环境变量是否设置 echo "配置检查:" env | grep -E "API|KEY|TOKEN|SECRET" | sed "s/=.*/=***/" # Linux/macOS # 或 PowerShell # Get-ChildItem Env: | Where-Object {$_.Name -match "API|KEY|TOKEN"} | Format-TableTechnical Analysis
The configuration-verification instructions enumerate all environment variables whose names contain credential-related terms such as
API,KEY,TOKEN, orSECRET. This is unnecessarily broad because the Skill only needs to determine whetherNOTION_API_KEYis configured.The Unix command replaces values with
***, reducing immediate disclosure risk, but still enumerates unrelated secret-bearing variable names. The PowerShell command is more severe: it passes complete environment-variable objects toFormat-Tablewithout redacting their values. Consequently, unrelated API keys and access tokens can appear in plaintext in the terminal, AI Agent context, execution logs, captured transcripts, or screenshots.No evidence indicates that the Skill deliberately transmits these credentials to an attacker. The confirmed issue is local plaintext exposure caused by insecure verification guidance.
Attack Path
- A user or AI Agent follows the documented configuration-verification procedure on a system containing multiple credentials in environment variables.
- On PowerShell,
Get-ChildItem Env:retrieves the environment-variable names and values available to the current process. Where-Objectselects variables with names matchingAPI,KEY, orTOKEN, including credentials unrelated to Notion.Format-Tablerenders the selected objects without masking their values.- Plaintext credentials become visible in console output.
- Any party or system able to access the terminal, Agent transcript, execution log, screen recording, ...[truncated 777 chars]
- Remediation
View remediation
Remediation Suggestions
Replace broad environment enumeration with a targeted existence check that never prints the credential value.
For Unix-like systems:
bash if [ -n "${NOTION_API_KEY:-}" ]; then echo "NOTION_API_KEY is configured" else echo "NOTION_API_KEY is not configured" fiFor PowerShell:
powershell if (Test-Path Env:NOTION_API_KEY) { Write-Output "NOTION_API_KEY is configured" } else { Write-Output "NOTION_API_KEY is not configured" }Apply the following additional controls:
- Do not enumerate variables based on generic credential-related patterns.
- Never print secret values during configuration checks, including in debug mode.
- Avoid placing credentials in AI Agent prompts, transcripts, callback payloads, or execution logs.
- If diagnostic output must identify a variable, print only its exact expected name and a boolean configuration status.
- Document procedures for revoking and rotating credentials if they are exposed.
- Add an explicit warning that users must not paste terminal output containing secrets into issue reports or Agent conversations.
