BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr
Fixed public pages being blocked by secure entry subscribing to the submission interface replacing files inside the container
lotk27dd0e9606b0
diff --git a/core/internal/cmd/cmd.go b/core/internal/cmd/cmd.goindex 2cf86278..309c0631 100644--- a/core/internal/cmd/cmd.go+++ b/core/internal/cmd/cmd.go@@ -127,12 +127,17 @@ var (// Define excluded URIsexcludesURIs := map[string]struct{}{- "/favicon.ico": {},- "/robots.txt": {},- "/unsubscribe.html": {},- "/api/unsubscribe/user_group": {},- "/api/unsubscribe": {},- "/api/batch_mail/api/send": {},+ "/favicon.ico": {},+ "/robots.txt": {},+ "/unsubscribe.html": {},+ "/api/unsubscribe/user_group": {},+ "/api/unsubscribe": {},+ "/api/batch_mail/api/send": {},+ "/api/batch_mail/api/batch_send": {},+ "/already_subscribed.html": {},+ "/subscribe_confirm.html": {},+ "/subscribe_form.html": {},+ "/subscribe_success.html": {},}// Bind Server Hooksdiff --git a/core/internal/controller/middleware/ip_whitelist.go b/core/internal/controller/middleware/ip_whitelist.goindex 496ebfe5..d58c5b82 100644--- a/core/internal/controller/middleware/ip_whitelist.go+++ b/core/internal/controller/middleware/ip_whitelist.go@@ -11,13 +11,17 @@ import (// Paths excluded from IP whitelist verificationvar ExcludedPaths = map[string]struct{}{- "/favicon.ico": {},- "/robots.txt": {},- "/unsubscribe.html": {},- "/api/unsubscribe/user_group": {},- "/api/unsubscribe": {},- "/api/batch_mail/api/send": {},-+ "/favicon.ico": {},+ "/robots.txt": {},+ "/unsubscribe.html": {},+ "/api/unsubscribe/user_group": {},+ "/api/unsubscribe": {},+ "/api/batch_mail/api/send": {},+ "/api/batch_mail/api/batch_send": {},+ "/already_subscribed.html": {},+ "/subscribe_confirm.html": {},+ "/subscribe_form.html": {},+ "/subscribe_success.html": {},// other}diff --git a/core/internal/controller/subscribe_list/subscribe_list.go b/core/internal/controller/subscribe_list/subscribe_list.goindex 1ab00db5..00a196df 100644--- a/core/internal/controller/subscribe_list/subscribe_list.go+++ b/core/internal/controller/subscribe_list/subscribe_list.go@@ -104,13 +104,6 @@ func readTemplateFiles(baseFilename string) (htmlContent string, txtContent strihtmlPath := filepath.Join(public.AbsPath("../core/template"), baseFilename+".html")txtPath := filepath.Join(public.AbsPath("../core/template"), baseFilename+".txt")- // Security check (prevent directory traversal)- //cleanDir := filepath.Clean(filepath.Join(hostwork, "core", "data"))- //if !strings.HasPrefix(filepath.Clean(htmlPath), cleanDir) ||- // !strings.HasPrefix(filepath.Clean(txtPath), cleanDir) {- // return "", "", fmt.Errorf("illegal path access: %s", baseFilename)- //}-// Read HTML filehtmlBytes, err := os.ReadFile(htmlPath)if err != nil {diff --git a/core/internal/service/subscribe_list/subscribe_url.go b/core/internal/service/subscribe_list/subscribe_url.goindex f420ad2b..9a74f408 100644--- a/core/internal/service/subscribe_list/subscribe_url.go+++ b/core/internal/service/subscribe_list/subscribe_url.go@@ -5,13 +5,15 @@ import ("context""github.com/gogf/gf/v2/frame/g""github.com/gogf/gf/v2/os/gfile"- "path/filepath""strings")func ReplaceSubmitUrl(ctx context.Context) {- hostwork := public.HostWorkDir- filePath := filepath.Join(hostwork, "/core/public/html/subscribe_form.html")+ //hostwork := public.HostWorkDir+ //filePath := filepath.Join(hostwork, "/core/public/html/subscribe_form.html")+ //content := gfile.GetContents(filePath)++ filePath := public.AbsPath("../core/public/html/subscribe_form_code.html")content := gfile.GetContents(filePath)if !strings.Contains(content, "{{ SubmitURL . }}") {