[PR #1080] [MERGED] feat: add support for S3 storage backend #1042

Closed
opened 2026-02-04 21:12:44 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/1080
Author: @stonith404
Created: 11/7/2025
Status: Merged
Merged: 11/10/2025
Merged by: @stonith404

Base: mainHead: feat/s3-storage-backend


📝 Commits (10+)

  • e1b04e1 feat: add support for S3 storage backend
  • 03604e8 add missing directories if they don't exist
  • b8ec0bf add e2e test environment for s3
  • d2a27e5 fix incorrect root path handling
  • 3d9d6fd adapt unit tests
  • db2fd47 Merge branch 'main' into feat/s3-storage-backend
  • d9fa66c Update backend/internal/service/app_images_service.go
  • 9317774 Update backend/internal/service/oidc_service.go
  • 355eb9c add missing contexts
  • ec0cc49 clear temporary files from atomic writes

📊 Changes

28 files changed (+1080 additions, -612 deletions)

View changed files

📝 .github/workflows/e2e-tests.yml (+33 -3)
📝 backend/go.mod (+18 -4)
📝 backend/go.sum (+53 -231)
📝 backend/internal/bootstrap/app_images_bootstrap.go (+45 -29)
📝 backend/internal/bootstrap/bootstrap.go (+27 -2)
📝 backend/internal/bootstrap/e2etest_router_bootstrap.go (+1 -1)
📝 backend/internal/bootstrap/scheduler_bootstrap.go (+1 -1)
📝 backend/internal/bootstrap/services_bootstrap.go (+7 -4)
📝 backend/internal/common/env_config.go (+31 -24)
📝 backend/internal/common/env_config_test.go (+38 -0)
📝 backend/internal/controller/app_images_controller.go (+8 -7)
📝 backend/internal/controller/oidc_controller.go (+3 -2)
📝 backend/internal/controller/user_controller.go (+4 -4)
📝 backend/internal/job/file_cleanup_job.go (+54 -21)
📝 backend/internal/service/app_images_service.go (+32 -17)
📝 backend/internal/service/app_images_service_test.go (+58 -32)
📝 backend/internal/service/e2etest_service.go (+17 -9)
📝 backend/internal/service/ldap_service.go (+1 -1)
📝 backend/internal/service/oidc_service.go (+47 -36)
📝 backend/internal/service/user_service.go (+29 -49)

...and 8 more files

📄 Description

This PR adds S3 support, which was the final step needed to run Pocket ID in a serverless environment. The implementation is done with a FileStorage interface. Based on the configured environment variables Pocket ID chooses between the filesystem or S3 implementation.

A nice advantage of the new file handling is that we can reduce the risk of path traversal attacks because filesystemStorage uses os.OpenRoot which only allows file system access in the defined directory which is UPLOAD_PATH.

Closes #497


🔄 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/pocket-id/pocket-id/pull/1080 **Author:** [@stonith404](https://github.com/stonith404) **Created:** 11/7/2025 **Status:** ✅ Merged **Merged:** 11/10/2025 **Merged by:** [@stonith404](https://github.com/stonith404) **Base:** `main` ← **Head:** `feat/s3-storage-backend` --- ### 📝 Commits (10+) - [`e1b04e1`](https://github.com/pocket-id/pocket-id/commit/e1b04e17172cb74e752acd5389fd9512b8623ca0) feat: add support for S3 storage backend - [`03604e8`](https://github.com/pocket-id/pocket-id/commit/03604e8c123784295fd607821b4b299731a7f111) add missing directories if they don't exist - [`b8ec0bf`](https://github.com/pocket-id/pocket-id/commit/b8ec0bf41c95a47b3477e8807593ccfde8fa3820) add e2e test environment for s3 - [`d2a27e5`](https://github.com/pocket-id/pocket-id/commit/d2a27e57e1cb2bfa9044038f52772fc5cec8dd8c) fix incorrect root path handling - [`3d9d6fd`](https://github.com/pocket-id/pocket-id/commit/3d9d6fd7ea6f0e4b2687ebeda720fca45d1ef73c) adapt unit tests - [`db2fd47`](https://github.com/pocket-id/pocket-id/commit/db2fd47bc359268257701eaf31a9ef81caecde63) Merge branch 'main' into feat/s3-storage-backend - [`d9fa66c`](https://github.com/pocket-id/pocket-id/commit/d9fa66c9690c8ee67a1c4741896b9b2fbe0945af) Update backend/internal/service/app_images_service.go - [`9317774`](https://github.com/pocket-id/pocket-id/commit/93177747a61bb6e263324db03a341ed2bbbc7a8e) Update backend/internal/service/oidc_service.go - [`355eb9c`](https://github.com/pocket-id/pocket-id/commit/355eb9c95f71102a921a938283fc13170c20b088) add missing contexts - [`ec0cc49`](https://github.com/pocket-id/pocket-id/commit/ec0cc49ce229e7d4b35987c124e0bbc4f41f454b) clear temporary files from atomic writes ### 📊 Changes **28 files changed** (+1080 additions, -612 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/e2e-tests.yml` (+33 -3) 📝 `backend/go.mod` (+18 -4) 📝 `backend/go.sum` (+53 -231) 📝 `backend/internal/bootstrap/app_images_bootstrap.go` (+45 -29) 📝 `backend/internal/bootstrap/bootstrap.go` (+27 -2) 📝 `backend/internal/bootstrap/e2etest_router_bootstrap.go` (+1 -1) 📝 `backend/internal/bootstrap/scheduler_bootstrap.go` (+1 -1) 📝 `backend/internal/bootstrap/services_bootstrap.go` (+7 -4) 📝 `backend/internal/common/env_config.go` (+31 -24) 📝 `backend/internal/common/env_config_test.go` (+38 -0) 📝 `backend/internal/controller/app_images_controller.go` (+8 -7) 📝 `backend/internal/controller/oidc_controller.go` (+3 -2) 📝 `backend/internal/controller/user_controller.go` (+4 -4) 📝 `backend/internal/job/file_cleanup_job.go` (+54 -21) 📝 `backend/internal/service/app_images_service.go` (+32 -17) 📝 `backend/internal/service/app_images_service_test.go` (+58 -32) 📝 `backend/internal/service/e2etest_service.go` (+17 -9) 📝 `backend/internal/service/ldap_service.go` (+1 -1) 📝 `backend/internal/service/oidc_service.go` (+47 -36) 📝 `backend/internal/service/user_service.go` (+29 -49) _...and 8 more files_ </details> ### 📄 Description This PR adds S3 support, which was the final step needed to run Pocket ID in a serverless environment. The implementation is done with a `FileStorage` interface. Based on the configured environment variables Pocket ID chooses between the filesystem or S3 implementation. A nice advantage of the new file handling is that we can reduce the risk of path traversal attacks because `filesystemStorage` uses `os.OpenRoot` which only allows file system access in the defined directory which is `UPLOAD_PATH`. Closes #497 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-04 21:12:44 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#1042