feat: support wildcard subdomain matching in trusted_domains - #1121
Open
dono-zz wants to merge 4 commits into
Open
feat: support wildcard subdomain matching in trusted_domains#1121dono-zz wants to merge 4 commits into
dono-zz wants to merge 4 commits into
Conversation
Add wildcard pattern support (e.g. `https://*.example.com`) for trusted_domains config and site URLs. This allows dynamically trusting all subdomains under a base domain without listing each one explicitly. The wildcard `*` matches exactly one subdomain level — `*.example.com` matches `sub.example.com` but not `example.com` or `a.b.example.com`. Scheme must also match. Exact domain matching is fully preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add rel="ugc" alongside nofollow, noreferrer, noopener on all user-generated links (avatar, nick, markdown content). This follows Google's 2019 recommendation for qualifying UGC outbound links. Reference: ArtalkJS#1120 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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
https://*.example.com) fortrusted_domainsconfig and site URLs*matches exactly one subdomain level —*.example.commatchessub.example.combut notexample.comora.b.example.comhttps://*.example.comwon't matchhttp://sub.example.com)Motivation
When domains are frequently blocked (e.g. by regional firewalls), operators need to quickly spin up new subdomains. Currently every new subdomain must be manually added to
trusted_domainsor site URLs. With wildcard support,https://*.example.comcovers all future subdomains automatically.Changes
server/middleware/cors.go: ModifiedCheckOriginTrusted()to check wildcard patterns alongside exact matches. AddedmatchWildcardOrigin()helper function.server/middleware/cors_test.go: Added 15 test cases covering matching, non-matching, edge cases, and scheme validation.Usage
Or via site URLs in the Dashboard — add
https://*.example.comas a site URL.Test plan
go test ./server/middleware/ -run TestMatchWildcard)Idea and used by https://lk21.mobile