* **Description:** A small compressed file expands to a vastly larger size, consuming excessive memory or disk space, leading to a Denial of Service (DoS).
* **How Compressor Contributes:** The library is the *engine* performing the decompression. Its handling of resource limits during decompression is critical.
* **Example:** A 1KB compressed file that expands to 10GB upon decompression. The `compressor` library, if it doesn't have limits, will attempt to allocate the 10GB, causing a DoS.
* **Impact:** Denial of Service (DoS) – the application becomes unresponsive or crashes.
* **Risk Severity:** High
* **Mitigation Strategies:**
* **Library-Provided Limits (Ideal):** The `compressor` library *should* provide configuration options to limit the maximum allowed size of the decompressed data. This is the most direct and effective mitigation. This should be a *configurable* limit, not a hardcoded one.
* **Expansion Ratio Limits (Helpful):** The library could offer an option to limit the maximum expansion ratio (compressed size vs. decompressed size). This is a good supplementary defense.
* **Documentation:** The library *must* clearly document the risks of decompression bombs and strongly recommend (or require) the use of size limits.
* **Description:** If the library handles archive extraction (e.g., `.zip` files), an attacker could include filenames with `../` sequences to write files outside the intended extraction directory.
* **How Compressor Contributes:** The library is *directly responsible* for handling filenames during archive extraction. If it doesn't sanitize them, it enables the attack.
* **Example:** A compressed archive contains a file named `../../../../etc/passwd`. The `compressor` library, if it doesn't sanitize, will attempt to write to that location.
* **Impact:** Arbitrary File Write, Potential for Privilege Escalation, System Compromise.
* **Risk Severity:** High (if archive extraction is supported; otherwise, Not Applicable)
* **Mitigation Strategies:**
* **Mandatory Filename Sanitization:** The library *must* rigorously sanitize filenames to prevent path traversal. This is a non-negotiable security requirement if archive extraction is supported. It should reject or modify any filename containing `../`, absolute paths, or other potentially dangerous characters. There should be *no way* to disable this sanitization.
* **Clear Documentation:** The library's documentation must clearly state its policy on filename sanitization and warn users about the risks of path traversal.