0.4.0: opt-in decision logging#3
Merged
Merged
Conversation
Adds a "Debug logging" toggle that records each protection decision so behaviour can be verified through the logs: - altcha: pass | fail (reason: missing/invalid/replay) - rate_limit: pass | blocked - content_filter: pass | spam (with score + which signals fired) - email_validation: allowed | blocked (status, disposable, reason, domain) Off by default. Every decision fires a `genero/gravityforms_altcha/log` action (routable to Sentry/Query Monitor/etc.); a default listener writes a greppable line to the PHP error log. Privacy-safe: IPs only as a salted hash, emails as the domain only — never raw. SpamFilter::contentReport now exposes the score and signal names for the logs. Co-Authored-By: Claude Opus 4.8 (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
Adds an opt-in Debug logging toggle so each protection decision can be verified through the logs — requested for confirming behaviour on staging/production.
When on, every decision writes one greppable line to the PHP error log:
altcha(pass/fail + reason missing/invalid/replay),rate_limit(pass/blocked),content_filter(pass/spam + score + signals),email_validation(allowed/blocked + status/disposable/reason/domain).genero/gravityforms_altcha/loggingfilter.genero/gravityforms_altcha/logaction (Sentry, Query Monitor, …); a default listener writes the error-log line and can be removed.SpamFilter::contentReport()now exposes the score + signal names (used by both the spam decision and the logs).Tests
Logger::format,contentReportsignals,emailDomain) + mocked (Logger::recordfires/suppresses the action) tests. 56 unit+mocked tests green on PHP 8.2–8.4. Verified end-to-end on DDEV.Bumps to 0.4.0.
🤖 Generated with Claude Code