Skip to content

fix: harden reward payout and store integrity - #6

Merged
JustinasLa merged 1 commit into
mainfrom
fix/review-findings
Sep 10, 2026
Merged

JustinasLa merged 1 commit into
mainfrom
fix/review-findings

Conversation

@JustinasLa

Copy link
Copy Markdown
Contributor

Summary

Fixes from a full-codebase review (code-reviewer + security-specialist). Plugin has never been deployed, so legacy rewarded/daily-goal handling is deleted rather than migrated.

  • claimed milestone count → claimed-points threshold; changing bar.reward-every can no longer revive paid claims
  • claim(): refuse-before-mutate (unpayable names cost no write), synchronous save whose result is checked before any dispatch, dispatch exceptions caught, partial rollback of unpaid milestones
  • PlayerStore: floor/cap on load, loaded stays false if quarantine copy fails, loaded/instance volatile, empty entries skipped in snapshot, onJoin no longer creates entries
  • VoteListener: player resolution moved into the scheduled task; runTask guarded against disable race
  • ActivityGui: activity.use re-checked on claim; no double messages on refusal
  • One clock reading for week+day keys; log-name sanitisation; dead accessors removed
  • Tests: 44 → 65. PlayerStore gets a static seam and its first tests; property test over rollback arithmetic

Test plan

  • mvn -B clean package → Tests run: 65, Failures: 0, Errors: 0, Skipped: 0
  • In-game: claim with a %player%-only command as a Bedrock name → reward-failed, no write; claim with a throwing command → rollback, milestone still claimable

Findings from a full code and security review, none deployed yet so no
migration: claimed milestone count becomes a paid-points threshold so
changing reward-every cannot revive a paid claim; claim() refuses before
mutating, saves synchronously and verifies the write before dispatching,
and rolls back unpaid milestones if a command fails or throws; store
values are sanitised on load, a corrupt file that cannot be quarantined
blocks all writes, empty entries are not snapshotted and joins no longer
create entries; vote resolution moves off the async vote thread; week
and day keys come from one clock reading. PlayerStore gains a static
test seam and its first tests.
@JustinasLa
JustinasLa merged commit 49ba978 into main Sep 10, 2026
1 check passed
@JustinasLa
JustinasLa deleted the fix/review-findings branch September 10, 2026 20:00
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.

1 participant