mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 09:13:19 +03:00
[PR #402] [MERGED] refactor: do not include test controller in production builds #821
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/402
Author: @ItalyPaleAle
Created: 3/28/2025
Status: ✅ Merged
Merged: 3/30/2025
Merged by: @stonith404
Base:
main← Head:e2etest-controller-tag📝 Commits (2)
7b56da1refactor: do not include test controller in production builds8394c85Merge branch 'main' into e2etest-controller-tag📊 Changes
8 files changed (+48 additions, -5 deletions)
View changed files
📝
.github/workflows/e2e-tests.yml(+2 -0)➕
.vscode/settings.json(+3 -0)📝
CONTRIBUTING.md(+1 -1)📝
Dockerfile(+10 -1)➕
backend/internal/bootstrap/e2etest_router_bootstrap.go(+21 -0)📝
backend/internal/bootstrap/router_bootstrap.go(+6 -3)📝
backend/internal/controller/e2etest_controller.go(+3 -0)📝
backend/internal/service/e2etest_service.go(+2 -0)📄 Description
Currently, the test controller is built into Pocket ID binaries and is enabled every time
APP_ENVis any value butproduction.The test controller is very powerful, as it includes a RESTful endpoint that allows nuking the entire database. While it is required for E2E tests, its existence outside of that can be considered a security risk.
This PR uses Go build tags to make sure that the test controller is only built when the application is compiled with
-tag "e2etest", which is not included in production builds🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.