feat: add wildcard domain restriction feature#4259
Open
TuroYT wants to merge 4 commits intoDokploy:canaryfrom
Open
feat: add wildcard domain restriction feature#4259TuroYT wants to merge 4 commits intoDokploy:canaryfrom
TuroYT wants to merge 4 commits intoDokploy:canaryfrom
Conversation
Add settings to define allowed wildcard domain patterns (e.g., *.example.com) that restrict which domains can be created for applications. - Add domainRestrictionConfig field to webServerSettings schema - Add validation utility for wildcard pattern matching - Add API endpoints for getting/updating domain restriction config - Add DomainRestriction settings UI component - Modify domain creation UI to use subdomain + domain dropdown when restriction is enabled - Integrate domain validation in createDomain service Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…omain.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
Summary
This PR implements the wildcard domain restriction feature, allowing administrators to define allowed domain patterns (e.g.,
*.example.com) that restrict which domains can be created for applications.Closes: #2859, #3941, #2560, #1404
Supersedes: #3324, #3929
Changes
domainRestrictionConfigfield towebServerSettingsschema (JSONB withenabledandallowedWildcardsarray)*.example.comfor single-level,**.example.comfor multi-level)getDomainRestrictionConfigandupdateDomainRestrictionDomainRestrictionsettings UI component in Server SettingscreateDomainserviceHow it works
*.example.com,*.app.company.io)my-app.example.com) is validated and registeredSSL/HTTPS Support
Yes, SSL works correctly. Each subdomain gets its own individual SSL certificate via Let's Encrypt HTTP-01 challenge. For example:
app1.example.com→ individual certificateapp2.example.com→ individual certificateThis is the standard approach and works perfectly. Wildcard SSL certificates (
*.example.com) would require DNS-01 challenge configuration, which is a separate enhancement.Test plan
*.test.com,*.prod.io)myapp.test.com)Greptile Summary
This PR adds a wildcard domain restriction feature that lets admins define allowed domain patterns (e.g.
*.example.com) enforced at domain creation time, with a new settings UI, adomainRestrictionConfigJSONB column, and a wildcard-matching utility.validateDomainRestrictionis only called increateDomain;updateDomainByIdhas no equivalent check, so any user with domain-edit permission can change a domain'shostto an arbitrary value after creation, circumventing the restriction entirely.Confidence Score: 4/5
The core restriction can be bypassed via the domain update path; fix required before the feature is effective.
One P1 finding:
updateDomainByIddoes not callvalidateDomainRestriction, meaning the admin-defined restriction is trivially bypassed by editing an existing domain's host. The remaining findings are P2 (wildcard check ordering, schema validation, client-side UX). The migration and schema additions look correct.packages/server/src/services/domain.ts— missing restriction check inupdateDomainById.Comments Outside Diff (1)
packages/server/src/services/domain.ts, line 127-141 (link)updateDomainByIdis called directly without runningvalidateDomainRestriction, so any user with domain-edit permission can change a domain'shostto an arbitrary value and completely bypass the admin-defined wildcard restriction. The enforcement increateDomain(line 20) has no effect once an edit is possible.Add the same validation guard here:
Reviews (1): Last reviewed commit: "feat: add wildcard domain restriction fe..." | Re-trigger Greptile