Sobelow.DOS.CompressedFile (Sobelow v0.19.0)
View SourcePotential resource exhaustion in full compressed-file reads
Files opened with :compressed or :compressed_one decompress while reading.
IO.read/2 and IO.binread/2 with :all or :eof can materialize the entire
expanded contents. A small on-disk file or an output-size check after reading
does not establish a decompressed-byte budget. :eof requires Elixir 1.13+.
This check connects dynamic paths in File.open/2, File.open!/2 and
:file.open/2 assignments, including piped opens, to subsequent full reads of
the same variable. It also covers inline one-argument callbacks in
File.open/3 and open!/3.
Read calls are the finding locations; labels refer to the original path.
Controller paths receive medium confidence and other paths low confidence.
Tracking is local and straight-line: reassignment, close, handle escape and branching/nested scopes stop tracking. Handle aliases, delegated callbacks, computed modes, indirect open expressions and literal paths are not tracked. Literal paths can still contain hostile data. Opening alone and fixed-size reads are omitted, not certified safe: repeated reads or a single huge line may still exhaust resources. Raw descriptors are not IO devices.
Read bounded chunks while enforcing a cumulative actual-output budget before accumulation. Also bound input, execution resources and concurrency; closing a file automatically after the callback does not limit allocations within it.
Ignore this check with:
$ mix sobelow -i DOS.CompressedFile