Repository navigation
Restrict analytics tracking and harden settings and releases - #58
Merged
adriaandotcom merged 6 commits intoNov 19, 2026
Merged
Conversation
Contributor
Author
|
CI update for commit The only failed check is |
… optional Custom domains saved before this release, set with WP-CLI, or saved before a salt rotation now keep loading scripts. Changing the domain still requires unfiltered_html, which is the check that stops site administrators on multisite from choosing a script origin, so the approval hash is removed. Pasted URLs are reduced to their hostname, and a rejected change or an unusable saved value is explained beside the field, where the settings page shows it. Network administrators are excluded only when "Network administrator (Super Admin)" is selected among the roles, so existing sites keep collecting their visits. With no roles selected, every logged-in user stays excluded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adriaandotcom
pushed a commit
that referenced
this pull request
Nov 19, 2026
Use one validated client-IP resolver for tracking exclusions and **Add Current IP**, so the address offered in settings is also the address checked on visits. Normalize IPv4/IPv6 before comparison and hide the button when no valid address is available. Forwarded headers are no longer trusted automatically. Deployments should configure trusted proxies at the web server or use the documented `simpleanalytics_client_ip` filter after verifying the proxy. This intentionally changes behavior for installations that previously relied on unvalidated `X-Forwarded-For` values. Fixes #40. Validation: the WordPress regression fails on the original forwarded-header handling and passes with the fix, covering spoofed headers/chains, IPv6 equivalence, shared UI/filter behavior, malformed inputs and missing addresses. The existing Add Current IP browser test also passes. PHP syntax and diff checks pass. Combined validation: all six proposed fixes were applied to a local integration branch; all 23 browser and WordPress regression tests, the asset build, PHP syntax checks and diff checks passed. GitHub workflows currently report `action_required` for these fork pull requests. ## Update The second paragraph above is out of date. Forwarded addresses are still trusted: the first public address in `X-Forwarded-For` is used, skipping private, loopback and invalid entries, and `REMOTE_ADDR` only when the header is absent. See the update on #40 for the reasons. Also merged current `main` and added the direct-access guard that #58 adds to every file. **Validation:** all 24 browser and WordPress regression tests pass locally on WordPress 7.1.4 with PHP 8.5, plus the regression scripts on multisite. CI covers MySQL and PHP 7.4. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved client IP detection when requests pass through proxies, including more reliable handling of forwarded addresses and IPv4/IPv6 formats. * Excluded IP rules now compare normalized addresses consistently. * The IP settings page shows the resolved client IP and hides the add button when no valid address is available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: simple-analytics-ai[bot] <313929673+simple-analytics-ai[bot]@users.noreply.github.com> Co-authored-by: Simple Analytics Codex <codex@simpleanalytics.invalid> Co-authored-by: Simple Analytics Agent <343555763+simpleanalytics-agent@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Simple Analytics Agent <github-agent@adriaan.simpleanalytics.com>
adriaandotcom
approved these changes
Nov 19, 2026
simpleanalytics-agent
added a commit
to jdevalk/wordpress-plugin
that referenced
this pull request
Nov 19, 2026
main's tree is identical to the final security hardening branch merged above, because simpleanalytics#58 was squash-merged. Recording main as a parent with the already-merged tree avoids replaying the same changes as conflicts.
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.
Analytics scripts could load on login and admin pages, and administrators without
unfiltered_htmlcould choose an arbitrary script origin through Custom Domain. This change limits tracking to front-end pages and requires an authorized save before a custom domain can serve scripts.Upgrade note: Existing custom domains fall back to the default CDN until an administrator with
unfiltered_htmlsaves them again.Validation:
pnpm buildandpnpm testspass on the rebased branch: 28 tests, comprising 22 Chromium browser tests and six PHP regression scripts. Workflow YAML, action pins, permissions, shell interpolation, andgit diff --checkalso pass.Update
Changes pushed on top of this PR:
unfiltered_htmlcheck on save stays and still stops multisite site administrators from changing the script origin. The upgrade note above no longer applies.https://Stats.Example.com/are saved asstats.example.com..github/workflows/release.ymlrestores its schedule and keeps the pinned actions, permissions and concurrency from this PR.main.Validation: all 30 browser and WordPress regression tests pass locally on WordPress 7.1.4 with PHP 8.5, plus the regression scripts on multisite. CI covers MySQL and PHP 7.4.