# Exposure of Sensitive Information to an Unauthorized Actor (CWE-200) The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. **Stack:** Go - Prevalence: 高 頻繁に悪用される - Impact: クリティカル 4 件の重大度クリティカルなルール - Prevention: 文書化済み 14 件の修正例 **OWASP:** Broken Access Control (A01:2021-Broken Access Control) - #1 ## Description There are many different kinds of mistakes that introduce information exposures. The severity of the error can range widely, depending on the context in which the product operates, the type of sensitive information that is revealed, and the benefits it may provide to an attacker. ## Prevention 4 件の Shoulder 検出ルールに基づく Information Exposure の予防策。 ### Go Use environment variables for configuration only; never log or return their values Store API keys in environment variables, never log them, and protect model endpoints with authentication Mask PII and redact credentials before sending data to LLM APIs, and use structured logging ## Warning Signs - [HIGH] Model theft vulnerability: ... - [HIGH] vulnerabilities leading to model theft or API key exposure such as hardcoded keys or insecure model - [HIGH] Potential sensitive information disclosure: ... - [HIGH] sensitive information disclosure in AI/LLM implementations such as credentials or PII in prompts ## Consequences - アプリケーションデータの読み取り - ファイルまたはディレクトリの読み取り ## Mitigations - 信頼境界を明確に引ける安全な領域を持つようシステムを区画化する - エラーメッセージには、対象とする読み手にとって必要最小限の詳細のみを含める ## Detection - Total rules: 14 - Critical: 4 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (4 rules) - **Environment Variable Secret Exposure** [HIGH]: Environment variables containing secrets flow to logs or HTTP responses. - Remediation: Use environment variables for configuration only, never log or return them. ```go apiKey := os.Getenv("API_KEY") if apiKey == "" { log.Fatal("API_KEY not configured") } // Use apiKey internally, never log or return it ``` Learn more: https://shoulder.dev/learn/go/cwe-200/env-vars-secret-exposure - **LLM Model Theft** [HIGH]: Detects vulnerabilities leading to model theft or API key exposure such as hardcoded keys or insecure model endpoints. - Remediation: Use environment variables for API keys and authenticate model endpoints. ```go client := openai.NewClient(os.Getenv("OPENAI_API_KEY")) ``` Learn more: https://shoulder.dev/learn/go/cwe-200/llm-model-theft - **LLM Sensitive Information Disclosure** [HIGH]: Detects sensitive information disclosure in AI/LLM implementations such as credentials or PII in prompts. - Remediation: Mask or redact PII and credentials before sending to LLM APIs. ```go safeMessage := maskPII(userInput) safeMessage = redactCredentials(safeMessage) ``` Learn more: https://shoulder.dev/learn/go/cwe-200/llm-sensitive-info-disclosure - **Sensitive Field Exposure in API Response** [CRITICAL]: Sensitive fields like password, token, or apiKey included in HTTP responses. - Remediation: Use response DTOs or json:"-" tag to exclude sensitive fields. ```go type User struct { ID string `json:"id"` Email string `json:"email"` Password string `json:"-"` // Never serialized } ``` Learn more: https://shoulder.dev/learn/go/cwe-200/sensitive-field-response-exposure