From 6c69b5cd895e15b29e563200a9a6dfc27b06525e Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 25 Jul 2026 07:56:17 +0200 Subject: [PATCH] fix(http): enforce download permission on the checksum branch The ?checksum= branch of the resource GET handler read the whole file to compute its digest and returned it without checking Perm.Download, unlike the sibling raw, preview, subtitle and X-Encoding paths. A user provisioned with Perm.Download=false could therefore obtain md5/sha1/sha256/sha512 digests of files they are not allowed to download, giving a file-content hash oracle, and force a full-file read. Return 202 Accepted before computing the checksum when the user lacks Perm.Download, matching the other read paths. This completes the fix for CVE-2026-35606, whose original patch gated only the content-returning paths. Refs GHSA-7whw-q6gh-xr59 --- http/resource.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http/resource.go b/http/resource.go index d8f5cad9..c4a7b2f3 100644 --- a/http/resource.go +++ b/http/resource.go @@ -67,6 +67,10 @@ var resourceGetHandler = withUser(func(w http.ResponseWriter, r *http.Request, d } if checksum := r.URL.Query().Get("checksum"); checksum != "" { + if !d.user.Perm.Download { + return http.StatusAccepted, nil + } + err := file.Checksum(checksum) if errors.Is(err, fberrors.ErrInvalidOption) { return http.StatusBadRequest, nil