fix(traefik): restrict default Dokploy route (#5036) - #5054
Open
9MidhunPM wants to merge 1 commit into
Open
Conversation
9MidhunPM
marked this pull request as ready for review
August 12, 2026 03:57
9MidhunPM
force-pushed
the
fix/restrict-default-traefik-route
branch
from
August 12, 2026 04:49
757b79b to
04ed74d
Compare
9MidhunPM
force-pushed
the
fix/restrict-default-traefik-route
branch
from
August 12, 2026 04:52
04ed74d to
fb4e92d
Compare
9MidhunPM
force-pushed
the
fix/restrict-default-traefik-route
branch
from
August 12, 2026 05:10
fb4e92d to
e9c2af4
Compare
Author
|
@Siumauricio Final update: the fallback-host regression is fixed, all Greptile threads are resolved, and typecheck, the 16-test targeted Traefik suite, and Biome pass. Ready for human review. |
Comment on lines
+229
to
+231
| const fallbackHostRule = `Host(\`${appName}.docker.localhost\`)`; | ||
| const isFallbackRule = (rule: unknown) => | ||
| rule === defaultRule || rule === fallbackHostRule; |
Contributor
There was a problem hiding this comment.
Fallback restriction is later removed
When an administrator assigns dokploy.docker.localhost after startup, updateServerTraefik replaces the HTTP middleware list and recreates the secure router without dokploy-local-access. Because this reconciliation runs only during startup, the fallback dashboard becomes publicly reachable again until the next production restart.
Knowledge Base Used:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5036.
Summary
The generated Dokploy fallback router is bound to Traefik's public
webentrypoint and trusts the client-controlledHost: dokploy.docker.localhostheader. That exposes the Dokploy UI through port 80 even when port 3000 is firewalled.Fix
Adds a route-specific Traefik
ipAllowListmiddleware to the default fallback router. It permits only loopback and RFC1918 IPv4 ranges:127.0.0.1/3210.0.0.0/8172.16.0.0/12192.168.0.0/16This preserves local/private default access while public requests are denied before they reach Dokploy.
Migration design
On startup, existing valid fallback configurations are reconciled unconditionally to Dokploy's canonical local-access middleware definition and router attachment. This avoids relying on presence-based correctness detection, which can miss malformed or permissive definitions under the Dokploy-owned middleware key. Both canonical fallback forms are reconciled: the generated
Host(...) && PathPrefix(...)rule and theHost(...)rule produced when server settings selectdokploy.docker.localhost.Migration has two explicit skip categories:
dokploy-router-appno longer has either canonical fallback rule, indicating it has been configured with a real custom domain. The configuration is left untouched.Test coverage
ipAllowListvalue.Verification
pnpm typecheck— passed.pnpm --filter=dokploy exec vitest run --config __test__/vitest.config.ts __test__/traefik/server/update-server-config.test.ts— passed (16/16).pnpm exec biome check packages/server/src/setup/traefik-setup.ts packages/server/src/utils/traefik/file-types.ts apps/dokploy/__test__/traefik/server/update-server-config.test.ts— passed; Biome reports one existing informationalparseIntradix notice outside this change.Greptile Summary
The PR adds a private-network allowlist to Dokploy’s default Traefik route and reconciles existing fallback configurations during startup.
dokploy-local-accessmiddleware for new installations.Confidence Score: 3/5
The PR is not yet safe to merge because assigning the fallback host after startup can restore public access to the Dokploy dashboard.
The startup migration correctly protects existing fallback routers, but the live settings path subsequently replaces their middleware configuration without preserving or reapplying the allowlist, leaving the previously reported fallback-host exposure reachable.
Files Needing Attention: packages/server/src/setup/traefik-setup.ts and packages/server/src/utils/traefik/web-server.ts
Security Review
The fallback-host restriction remains bypassable after startup: assigning
dokploy.docker.localhostthrough server settings replaces the protected router middleware and creates an unrestricted secure router. The dashboard can therefore become publicly reachable until the next restart.Reviews (8): Last reviewed commit: "fix(traefik): restrict default Dokploy r..." | Re-trigger Greptile
Context used: