# Cleartext Storage of Sensitive Information in an Environment Variable (CWE-526) The product uses environment variables to store sensitive information, but the environment is accessible to other processes or users. - Prevalence: Média 1 linguagens cobertas - Impact: Alto 1 regras de severidade alta - Prevention: Documentada 1 exemplos de correção **OWASP:** Security Misconfiguration (A05:2021-Security Misconfiguration) - #5 ## Description Environment variables are often visible to child processes and may be logged or exposed through error messages. Storing sensitive information like credentials in environment variables can lead to information disclosure. ## Prevention ### Go Never log or expose environment variables containing secrets ## Consequences - Ler dados da aplicação - Obter privilégios ## Mitigations - Use sistemas dedicados de gerenciamento de segredos - Criptografe valores sensíveis antes de armazená-los em variáveis de ambiente - Limite o acesso ao ambiente do processo ## Detection - Total rules: 1 - Languages: go ## Rules by Language ### Go (1 rules) - **Environment Variable Exposure** [HIGH]: Environment variables logged or included in HTTP responses. - Remediation: Use environment variables for configuration only, never log or expose them. ```go dbURL := os.Getenv("DATABASE_URL") // Use dbURL for connection only // Never log it: log.Printf("DB: %s", dbURL) // Wrong! ``` Learn more: https://shoulder.dev/learn/go/cwe-526/env-var-exposure