Skip to content

fix: exclude /pmta tracking links from safepath check (fixes #338) - #354

Open
srmdn wants to merge 1 commit into
Billionmail:devfrom
srmdn:fix/safepath-track-links
Open

fix: exclude /pmta tracking links from safepath check (fixes #338)#354
srmdn wants to merge 1 commit into
Billionmail:devfrom
srmdn:fix/safepath-track-links

Conversation

@srmdn

@srmdn srmdn commented Jun 15, 2026

Copy link
Copy Markdown

Problem

When safepath is enabled, click/open tracking links (/pmta/*) return 404 for recipients who open emails in incognito/private windows or forwarded emails — they lack the safe_path_pass session cookie.

Root Cause

The safepath middleware in core/internal/cmd/cmd.go blocks all requests without the safe_path_pass cookie. The /pmta tracking endpoints are not in the excludesURIs whitelist, so tracking links get 404.

Fix

  1. Add /pmta to the excludesURIs exact-match map
  2. Add excludedURIPrefixes list with /pmta/ for prefix matching — tracking links include encrypted IDs after the path prefix (e.g., /pmta/ENCRYPTED_ID)

Testing

  • go build ./core/... — compiles clean
  • go vet ./core/... — no issues
  • go test -count=1 -short ./internal/... — 1,275 tests pass

Related

Fixes #338

Signed-off-by: srmdn mail@saidwp.com

…ail#338)

Tracking links (/pmta/*) return 404 when safepath is enabled
because the safepath middleware blocks requests that lack the
safe_path_pass session cookie. Click/open tracking in marketing
emails breaks when recipients open links in incognito windows
or forward emails (no safepath cookie set).

Fix: add /pmta to the safepath excludesURIs for exact match,
and add a excludedURIPrefixes list for prefix matching /pmta/*
paths (tracking IDs are appended to the path).

Tested: go build, go vet clean, 1275 unit tests pass.

Signed-off-by: srmdn <mail@saidwp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking links return Not Found because of safepath

1 participant