Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Resource Leak Medium

Failing to properly handle resources like files and network connections can lead to availability or exploitation issues - not closing file handles opened via os.Open/Create/OpenFile exhausts available handles over time, causing denial of service through lack of file access, while dynamically defined httptrace.ClientTrace objects allow arbitrary remote code execution by deserializing untrusted data into executable code during requests; to prevent resource exhaustion and potential remote attacks, files should be closed immediately after use through defer statements or helpers to ensure handles are released, and httptrace traces should be static and hardcoded to avoid dynamic deserialization of malicious payloads - proper resource handling through prompt cleanup and avoiding dynamic definitions prevents both availability problems and potential security exploits.

Detector ID
go/resource-leak@v1.0
Category