Skip to content

Files S3 Follow Ups PR Review

Ed Mozley edited this page Dec 5, 2026 · 1 revision

Files' S3 storage follow-ups - PR review (#528)

PR #528 by @cloudcogsio Β· Files β†’ Settings β†’ Storage Β· merged 5 December 2026, in 6.0.0

Verdict: merge. Six items from Storage series - follow-ups and gaps that apply to Files' own S3 storage (#283, PR #318), split out of #361 so they don't wait for System β†’ Storage.

What it does

Item What changed
S1 plain http:// The Storage tab warns - under the endpoint, in its summary, and after a Test - when the endpoint is http:// to an address on the internet. A LAN or local server, shared address space (100.64.0.0/10: carrier-grade NAT, Tailscale), a Docker service name or a name that doesn't resolve is fine. A warning, never a block.
S4 failed Tests A failed Test is in the Files audit as the person who pressed it, with the endpoint, bucket, step and error - never the secret, nor a user name and password pasted into the address.
N1 being told Every other active administrator gets a bell and, when a mailbox can send, an email when Files' storage location really changes (another spelling of the same place moves nothing) or a move between locations ends. New notification type storage.changed, administrators only.
R1 the real size A download from the start asks the store for the file's real size and answers 410 when it isn't the recorded size_bytes, instead of headers promising more or fewer bytes than follow.
R2 ListBucket The help says the access key needs s3:ListBucket; without it S3 answers "access denied" for a missing file and Skip can't tell it is missing.
R3 alert() Retry, Skip, Finish and Remove show errors in the tab's own message line.

The warning under a plain http:// endpoint on the internet

What was good - copy this

  • Warn, don't block, and prove it before warning. storageEndpointInsecure() warns only for an address shown to be public - it resolves the name and checks every address - so a MinIO beside FreeITSM, a Tailscale address or a Docker service name never gets a scary message. It even handles the shared address space that PHP's own private-range filter misses:

    // Shared address space (100.64.0.0/10: carrier-grade NAT, Tailscale) is not the internet
    // either, but PHP's private and reserved ranges do not include it.
    if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && (ip2long($ip) & 0xFFC00000) === (ip2long('100.64.0.0') & 0xFFC00000)) continue;
  • Secrets never reach the audit, including the case nobody thinks of - credentials pasted into the address itself:

    $endpoint = preg_replace('#^([a-z][a-z0-9+.-]*://)[^/@]*@#i', '$1', trim((string)($s['endpoint'] ?? '')));
  • An existing pattern, reused. Telling administrators follows the API threat protection alerts (apiSecurityNotifyAdmins()): a bell through NotificationsService and an email through an existing mailbox. The person who made the change is not told about their own action, and telling people never throws - a failed bell or email is logged and the storage change itself goes through.

  • Tests replace the mailer, as MandatoryFields::$mailer does, so no test ever emails anyone; the two older storage tests now record mail instead of sending it.

  • A notification type every complete language can name. tests/notification-labels.php requires each type in all of them, so the two storage.changed labels came in the eight complete languages, with an honest note that the translations were the author's own.

  • The download check is placed exactly where it matters: only on a read from the store and only from the start of the file, so a viewer's many range requests are not slowed, and an offline copy is already used only when its size matches.

  • 39 checks with positive controls in tests/files-s3-followups.php, writes in one rolled-back transaction, and the PR lists every older storage test it re-ran on 5.19.0.

Nothing needed fixing. On a test install: files-s3-followups 39, files-storage-settings 16, files-storage-migration 27 and files-storage-backend 11, all passing.

One thing found while testing it was not this PR's: tests/notification-labels.php failed for the access services bell added in 5.19.0, which had been translated into German only. Its labels are now in the other seven complete languages.

Files

File Change
πŸ”΄ includes/services/files_storage.php testAudited(), tells administrators after a move, insecure
πŸ”΄ includes/storage/notify.php New: storageNotifyAdmins()
🟑 includes/storage/driver.php storageEndpointInsecure()
🟑 includes/files/storage.php The real-size check (410)
🟑 includes/files/storage_migration.php Who ended the move
🟑 includes/services/notifications.php, includes/entity_links.php, lang/*/common.php storage.changed
🟑 assets/js/files-settings.js, files/settings/index.php, files/help.php, api/files/settings.php The warning, errors in the tab, help
🟒 tests/files-s3-followups.php New, 39 checks

What this means for you

Nothing changes until your Files storage location changes. If you store Files in S3 over plain http:// to the internet, the Storage tab now says so. See Files.

Related

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally