Repository navigation
Security findings M2–M4: email cap with digest, submission clean-up, rate limit address - #56
Merged
Merged
Conversation
- notify-submission sends at most settings.review_emails_per_day (20) review emails a day; later submissions go into one evening digest (pg_cron) - Daily clean-up job: spam after 7 days, rejected and withdrawn after 30 - Privacy policy: rejected and withdrawn submissions kept 30 days - Sign-in: its own message when the site-wide email limit is reached Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtKM4TZ917FEo7VwVUDwjU
✅ Deploy Preview for swim-events ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Tested on the live function: a faked X-Forwarded-For was replaced by the gateway, and a request with its own CF-Connecting-IP got 403 from Cloudflare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtKM4TZ917FEo7VwVUDwjU
nicolasmesser
marked this pull request as ready for review
November 29, 2026 16:01
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.
Fixes M2 and M4 from the security review. M3 (the rate limit address) follows in this PR once the header check is done. M5 needs no code.
M2: protect the shared email budget
notify-submissionsends at mostsettings.review_emails_per_day(default 20) review emails a day (UTC). Later submissions get no email of their own.pg_cronjob at 19:00 UTC calls the function with{"type": "DIGEST"}. Every pending submission that hasn't been emailed goes into one email, which also points to thesubmissions_openemergency switch.event_submissions.review_email_sent_atrecords when each submission was emailed. Existing rows are backfilled.over_email_send_rate_limit) is hit: "try again later or tomorrow, or write to swim-events@proton.me". The per-visitor "wait a few minutes" message stays.M4: clean-up promised in the privacy policy
pg_cronat 02:00 UTC deletes spam submissions after 7 days, and rejected or withdrawn ones after 30 days. Withdrawals count from when they were sent.Database
supabase/migrations/20261129000000_email_cap_and_cleanup.sqlturns onpg_cron, adds both columns, and schedules both jobs.notify_webhook_secret), so it never appears in the repository. It's created once before the migration is applied.Tested
deno testfor the functions: 8 passed, including a new digest email test.astro checkand eslint pass.After merging
notify-submission. Claude does this, after the Vault secret exists.cron.joblistsreview-digestandsubmissions-cleanup, and that the first runs succeed (cron.job_run_details).Generated by Claude Code