Skip to content

Comments

Added packet manipulation dupe glitches fixes#22

Open
GrapJeje wants to merge 3 commits intoKittehDev:masterfrom
GrapJeje:master
Open

Added packet manipulation dupe glitches fixes#22
GrapJeje wants to merge 3 commits intoKittehDev:masterfrom
GrapJeje:master

Conversation

@GrapJeje
Copy link

Async Vault Saving with Anti-Dupe Protection

Problem:

  • Vault saves block main thread (server lag)
  • Race conditions cause data corruption
  • Players can exploit packet manipulation to dupe items
  • No verification after writes

Solution
Implement async saves with per-player locking and anti-dupe validation.

Changes

  • Async Saves - File I/O in background thread pool (zero lag)
  • Per-Player Locks - Only one save per player at a time
  • Atomic Writes - Temp file + rename (no corruption on crash)
  • Verification - Reload and validate after save
  • Anti-Dupe Checks - Block saves < 500ms, validate item amounts

Result

  • ✅ Zero server lag during saves
  • ✅ No data corruption from concurrent writes
  • ✅ Packet duping exploits blocked
  • ✅ Fully backwards compatible

Hardens vault saving against advanced packet manipulation exploits (delayed close, forced quit, combined packet cancellation). Adds a per-player save guard to prevent concurrent double-saves, snapshots inventory contents immediately on the main thread before any async work, and scopes the 500ms throttle to individual vault numbers instead of the player as a whole. Clicks and drags are blocked while a save is in flight to prevent ghost-item injection.
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