Skip to content

Kudos: tighten counting - #267

Merged
darkmastermindz merged 1 commit into
mainfrom
kudos-hardening
Oct 26, 2026
Merged

darkmastermindz merged 1 commit into
mainfrom
kudos-hardening

Conversation

@darkmastermindz

Copy link
Copy Markdown
Owner

Summary

Tightens how 👏 kudos are counted on the About card's XP entries.

Related Issue

None. Follow-up to #262, from a private review.

Changes Made

netlify/functions/kudos.mjs:

  • Only from the site's own pages: a kudos counts only when the request's Origin is the site's own. That's this deploy's address, URL, DEPLOY_URL or DEPLOY_PRIME_URL. Browsers send Origin on every tap, so nothing changes for visitors.
  • Once per connection: one count per connection per entry per day. IPv6 is counted by its /64 network (visitorNet). No address is stored, as before.
  • Daily records cleared: they're deleted after a day or two, as new kudos come in.

Tests:

  • tests/security/kudos.test.mjs covers each change.
  • KUDOS_IPS in payloads.mjs holds odd and hostile visitor addresses, which must never throw or grow the stored record.

README: the kudos paragraph is updated.

How to Test

  1. npm test: 296 pass.
  2. npm run generate.
  3. Checked locally in Chromium with the real handler: a tap on an XP entry counts, and the page passes axe.

Additional Notes


Generated by Claude Code

- Count a kudos only from the site's own pages (the request's Origin)
- One count per connection per entry per day
- Clear the daily records after a day or two
- Tests for each, with odd and hostile visitor addresses in payloads.mjs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nginuw5wmUjUSkmQB1J3pS
@darkmastermindz
darkmastermindz merged commit 7e6185f into main Oct 26, 2026
8 checks passed
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.

2 participants