mirror of
https://github.com/securego/gosec.git
synced 2026-06-20 00:15:59 +02:00
* Add G118 SSA analyzer for context propagation failures that can cause goroutine/resource leaks This PR introduces G118, a new SSA-based gosec rule that detects high-risk context misuse patterns: goroutines using context.Background/TODO when request context exists, missing cancel() calls from WithCancel/WithTimeout/WithDeadline, and unbounded blocking loop regions without ctx.Done() guards. These patterns can leak goroutines and I/O resources, leading to resource exhaustion/DoS in production services. The rule is mapped to CWE-400, integrated into analyzer registration and docs, and includes positive/negative samples (including complex loop CFG cases) to reduce false positives while preserving detection quality. Signed-off-by: Cosmin Cojocar <cosmin@cojocar.ch> * Fix false pasitive Signed-off-by: Cosmin Cojocar <cosmin@cojocar.ch> --------- Signed-off-by: Cosmin Cojocar <cosmin@cojocar.ch>