[PR #2575] [MERGED] fix(security): prevent file size limit bypass via import (GHSA-qh78-rvg3-cv54) #5742

Closed
opened 2026-04-16 13:50:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2575
Author: @tink-bot
Created: 4/9/2026
Status: Merged
Merged: 4/9/2026
Merged by: @kolaente

Base: mainHead: fix-import-file-size-bypass


📝 Commits (6)

  • 30bf9f5 fix(files): derive file size from reader at creation boundary
  • 3d0c343 refactor(files): derive attachment size from content in sibling callers
  • 42f93dd fix(migration): compute attachment size from content during import
  • 3f47e2c fix(migration): bound per-entry zip cap by configured files.maxsize
  • d754c1a test(migration): regression test for forged attachment size
  • d5dd913 test(todoist): serve attachment from local test server

📊 Changes

10 files changed (+244 additions, -25 deletions)

View changed files

📝 pkg/files/files.go (+48 -3)
📝 pkg/files/files_test.go (+54 -3)
📝 pkg/models/project_duplicate.go (+1 -1)
📝 pkg/models/task_attachment_test.go (+3 -2)
📝 pkg/models/task_duplicate.go (+1 -1)
📝 pkg/modules/migration/create_from_structure.go (+6 -2)
📝 pkg/modules/migration/todoist/todoist.go (+1 -1)
📝 pkg/modules/migration/todoist/todoist_test.go (+21 -4)
📝 pkg/modules/migration/vikunja-file/vikunja.go (+36 -8)
📝 pkg/modules/migration/vikunja-file/vikunja_test.go (+73 -0)

📄 Description

The Vikunja file import endpoint trusted the attacker-supplied Size field from the JSON metadata inside the import zip when enforcing files.maxsize, so setting "size": 0 while stuffing arbitrarily large content into the corresponding files/<id> zip entry bypassed the limit and could fill server disk.

This PR fixes the immediate bypass at the import layer and adds defense in depth at the file creation boundary so future callers cannot reintroduce the same class of bug.

Reference: GHSA-qh78-rvg3-cv54


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2575 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 4/9/2026 **Status:** ✅ Merged **Merged:** 4/9/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-import-file-size-bypass` --- ### 📝 Commits (6) - [`30bf9f5`](https://github.com/go-vikunja/vikunja/commit/30bf9f5eaf727e257cd1733e8521fc1a1847681e) fix(files): derive file size from reader at creation boundary - [`3d0c343`](https://github.com/go-vikunja/vikunja/commit/3d0c3432098552a916e7edc338ce596f8fd91236) refactor(files): derive attachment size from content in sibling callers - [`42f93dd`](https://github.com/go-vikunja/vikunja/commit/42f93dddd8ca10cd6e1be74eaab4b2c5eec4001a) fix(migration): compute attachment size from content during import - [`3f47e2c`](https://github.com/go-vikunja/vikunja/commit/3f47e2c4fb3f20eed78b11aa8dd003a638192cff) fix(migration): bound per-entry zip cap by configured files.maxsize - [`d754c1a`](https://github.com/go-vikunja/vikunja/commit/d754c1af10368e27ef6cd4c68cda2c38a6782d8d) test(migration): regression test for forged attachment size - [`d5dd913`](https://github.com/go-vikunja/vikunja/commit/d5dd913fdc02358fbba0b6ec7e4d6ce4c0dcc184) test(todoist): serve attachment from local test server ### 📊 Changes **10 files changed** (+244 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `pkg/files/files.go` (+48 -3) 📝 `pkg/files/files_test.go` (+54 -3) 📝 `pkg/models/project_duplicate.go` (+1 -1) 📝 `pkg/models/task_attachment_test.go` (+3 -2) 📝 `pkg/models/task_duplicate.go` (+1 -1) 📝 `pkg/modules/migration/create_from_structure.go` (+6 -2) 📝 `pkg/modules/migration/todoist/todoist.go` (+1 -1) 📝 `pkg/modules/migration/todoist/todoist_test.go` (+21 -4) 📝 `pkg/modules/migration/vikunja-file/vikunja.go` (+36 -8) 📝 `pkg/modules/migration/vikunja-file/vikunja_test.go` (+73 -0) </details> ### 📄 Description The Vikunja file import endpoint trusted the attacker-supplied `Size` field from the JSON metadata inside the import zip when enforcing `files.maxsize`, so setting `"size": 0` while stuffing arbitrarily large content into the corresponding `files/<id>` zip entry bypassed the limit and could fill server disk. This PR fixes the immediate bypass at the import layer and adds defense in depth at the file creation boundary so future callers cannot reintroduce the same class of bug. Reference: GHSA-qh78-rvg3-cv54 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 13:50:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5742