Cleartext Transmission of Sensitive Information
The product transmits sensitive or security-critical data in cleartext in a communication channel that can be sniffed by unauthorized actors.
Many communication channels can be sniffed by attackers during data transmission. When sensitive data is transmitted without encryption, an attacker can intercept and read this information. Secure channels like TLS should be used to protect sensitive data in transit.
Comment corriger cette vulnérabilité
Use StartTLS instead of Start to enable HTTPS encryption
package main import "github.com/labstack/echo/v4" func main() { e := echo.New() e.POST("/api/login", loginHandler) - e.Start(":8080") + e.StartTLS(":443", "cert.pem", "key.pem") }
Use ListenTLS instead of Listen to enable HTTPS encryption
package main import "github.com/gofiber/fiber/v2" func main() { app := fiber.New() app.Post("/api/login", loginHandler) - app.Listen(":3000") + app.ListenTLS(":443", "cert.pem", "key.pem") }
Use RunTLS instead of Run to enable HTTPS encryption
package main import "github.com/gin-gonic/gin" func main() { r := gin.Default() r.POST("/api/login", loginHandler) - r.Run(":8080") + r.RunTLS(":443", "cert.pem", "key.pem") }
Configure TLS on Ingress resources to encrypt traffic in transit
apiVersion: networking.k8s.io/v1 kind: Ingress - spec: + metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + spec: + tls: + - hosts: + - example.com + secretName: example-tls rules: - host: example.com http: paths: - path: / pathType: Prefix backend: service: name: web port: number: 80
Remove insecure-skip-tls-verify and use proper certificate verification with CA certificates
apiVersion: v1 clusters: - cluster: server: https://192.168.0.100:8443 - insecure-skip-tls-verify: true + certificate-authority: /path/to/ca.crt name: my-cluster kind: Config
Use HTTPS for all external requests and enable SSL redirect in frameworks
import requests - API_URL = "http://api.example.com" - response = requests.get(f"{API_URL}/data") + API_URL = "https://api.example.com" + response = requests.get(f"{API_URL}/data", verify=True, timeout=10)
Trouvez les vulnérabilités dans votre code
Utilisez Shoulder pour scanner votre code à la recherche de patterns Cleartext Transmission of Sensitive Information. 6 règles.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=319 # Or scan entire project npx @shoulderdev/cli trust .
Règles de Détection (6)
Ce qu'il faut surveiller lors des revues de code
Ces patterns indiquent des vulnérabilités potentielles Cleartext Transmission of Sensitive Information. Recherchez-les lors des revues de code et des audits de sécurité.
Scannez votre base de code pour Cleartext Transmission of Sensitive Information
Shoulder CLI trouve les motifs vulnérables dans toute votre base de code.