GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Encryption settings not working · Issue #144 · projectsend/legacy

Encryption settings not working #144

New issue
Copy link
New issue
Copy link
Open
Open
Encryption settings not working#144
Copy link

Description

@Marvin36
Marvin36
opened on Apr 30, 2026
Issue body actions

Description

Files get encrypted regardless of maximum encryption file size or user selection on the upload page.
This happens even though mandatory encryption is deactivated.

Steps to Reproduce

  1. Activate "Enable file encryption feature" in Encryption Settings
  2. Deactivate "Make encryption mandatory"
  3. Set "Maximum file size for encryption (MB)" to any value
  4. Add a file that is larger than the given value
  5. Deselect "Encrypt files on server" in the upload screen
  6. Upload file
Image --- Image --- Image

Expected Behavior

The file does not get encrypted.

Actual Behavior

The file gets encrypted regardless of the chosen settings.

Since the maximum encryption size is not working as intended, this can also lead to memory exhaustion when it tries to encrypt larger files, depending on the memory_limit.

Example for a 350 MB file with memory_limit at 256M:
Image

ProjectSend Version

r2029

PHP Version

8.3

Database Type

MySQL

Database Version

No response

Web Server

No response

Browser

No response

Relevant Log Output

Screenshots

No response

Activity

  1. Iaotle commented on Jul 14, 2026

    @Iaotle
    Iaotle
    on Jul 14, 2026
    More actions

    I reproduced this on r2029 and traced the final-chunk 500 to the encryption implementation. This is still present on develop at 0ea849175f4c6c3e7c4a09c112534f62e2f4a8c3.

    Environment:

    • ProjectSend r2029 via lscr.io/linuxserver/projectsend:r2029-ls275
    • PHP 8.4.16
    • memory_limit = 512M
    • Nginx, MariaDB
    • Encryption enabled and required; maximum encryption file size set to 0 (unlimited)

    Observed behavior:

    1. Plupload successfully sends every 100 MiB chunk with HTTP 200.
    2. includes/upload.process.php assembles and renames the complete .part file.
    3. The final request returns an empty HTTP 500.
    4. The complete plaintext file remains as an orphan, while <filename>.encrypted contains exactly 12 bytes (the generated GCM IV).

    I reproduced this with files of 918,362,520 and 4,596,025,916 bytes. Disk capacity, inodes and directory ownership were not the cause.

    The immediate cause is includes/Classes/Encryption.php::encryptFile(). Despite the streaming comment and 8 KiB read loop, the method appends every chunk to one PHP string:

    $ciphertext = '';
    while (!feof($input)) {
        $chunk = fread($input, $this->chunk_size);
        $ciphertext .= $chunk;
    }
    $encrypted = openssl_encrypt($ciphertext, ...);

    Memory is therefore O(file size), with another similarly sized allocation needed for $encrypted. The process exhausts memory after writing the IV. catch (\Exception) cannot recover from this fatal allocation failure, so no JSON error is returned and the partial encrypted output is not cleaned up.

    There is a second issue in includes/upload.process.php: encryption is forced whenever Encryption::isEnabled() is true, even when it is not required. This bypasses the per-upload checkbox and helps explain why the configured maximum/selection has no effect.

    Suggested fixes:

    • Enforce files_encryption_required, the request checkbox, and files_encryption_max_file_size before encryption begins.
    • Replace the one-shot whole-file AES-GCM operation with an authenticated, versioned chunked format that uses bounded memory, while retaining a legacy read path.
    • On failure, remove the partial encrypted output, preserve the assembled input for recovery, log the underlying error, and return a structured JSON response.

    This also appears to explain at least some reports in #147.

  2. ignacionelson
    added a commit that references this issue on Aug 8, 2026

    Honour the encryption settings when a file is uploaded

    352d9ec
  3. ignacionelson
    transferred this issue fromprojectsend/projectsendon Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.