Skip to content

security: sweep-proof result slots, verified-login gate, panic cleanup, Velocity secret#2513

Open
kodareef5 wants to merge 14 commits into
Pumpkin-MC:masterfrom
kodareef5:hardening/05-hardening-rework
Open

security: sweep-proof result slots, verified-login gate, panic cleanup, Velocity secret#2513
kodareef5 wants to merge 14 commits into
Pumpkin-MC:masterfrom
kodareef5:hardening/05-hardening-rework

Conversation

@kodareef5

Copy link
Copy Markdown

Part 5 of the hardening stack (stacked on #2512).

Commits

  • make trade/craft outputs non-sweepable and refresh on take
  • harden Bedrock inventory moves and slot mapping
  • require finished login before Config and kick-old on dup
  • cleanup players after play-task panics and supervise ticks
  • cap Bedrock item wire buffers and require Velocity secret

What and why

  • Merchant/anvil result slots become take-only (no insertion), so PickupAll sweeps cannot steal them; craft results refresh per take. Fixes the trade/anvil dupe cycles architecturally instead of per-action.
  • Bedrock slot mapping hardened; bounded container slot indices.
  • A login-finished flag is now required before the Config state; the flag is only set after a verified login on every transport, and the profile is cleared on auth failure. Closes the residual auth-bypass race. Duplicate logins kick the old session (vanilla parity).
  • Play-task panics now always run full player cleanup (remove, save), so contained panics cannot leave ghost players; the world ticker is supervised so a tick panic cannot silently freeze the world; crash reports are written only for the first panic.
  • Bedrock item wire buffers (user_data/extra_data) are capped pre-allocation; Velocity secret required when velocity is enabled regardless of the proxy.master switch.

Tests

cargo test passes for pumpkin-inventory, pumpkin-protocol, and pumpkin (including take-only slot tests).

Worker-thread panics previously called stop_server() via the global panic
hook, turning every reachable unwrap into a full-server kill switch.
Log and save a crash report, abort the task, and keep serving. Main-thread
panics remain fatal.
@kodareef5
kodareef5 force-pushed the hardening/05-hardening-rework branch from e433591 to acb17fe Compare July 24, 2026 23:44
Add a depth budget for binary and serde NBT parsers so nested compounds
cannot stack-overflow the process. Reject non-empty END-typed lists and
bound string allocations. Includes regression tests.
@kodareef5
kodareef5 force-pushed the hardening/05-hardening-rework branch from acb17fe to 5d95d66 Compare July 24, 2026 23:55
Pumpkin Hardening added 12 commits July 25, 2026 00:03
Cap SClickSlot changed-slot arrays, IDSet/consumable effect lengths, ACK
range expansion, and potion hidden-effect nesting so wire lengths cannot
drive multi-gigabyte allocations or stack overflow.
Reject oversized split_size before allocating fragment vectors, limit
pending split compounds and ordered-channel queues, and bound unacked
outgoing frames so a never-ACK or split-bomb peer cannot retain unbounded
memory.
Mirror the binary NBT depth budget in the command SNBT parser so deeply
nested compounds/lists from /give and similar paths cannot overflow the
stack.
Return after failed Mojang authentication instead of completing login
with an unverified profile. Kick cleanly when the game profile is missing.
Run ban/whitelist/IP-ban and duplicate UUID/name checks in add_player for
every transport. Validate player names (reject empty/NUL/section sign),
timeout Mojang HTTP, fix prevent-proxy URL, and sanitize Velocity names.
Require a non-empty RCON password and Velocity secret when those features
are enabled. Warn when BungeeCord mode is on. Fix RCON max_connections to
decrement on close, and add read timeouts plus an incoming buffer bound.
Block PickupAll on merchant and anvil result slots, enforce trade uses
limits, consume both anvil inputs, fix drag-slot division-by-zero from u8
cast wrap, and correct Swap action operator precedence for offhand.
Require creative mode for CraftCreative and client inventory descriptors,
consume craft inputs per repetition, require allow_flying for StartFlying,
ignore invalid block actions without panicking, and make heal() tolerant of
overflowed potion amplifiers.
…take

Merchant and anvil result slots are take-only so PickupAll cannot steal
outputs without consumption. Crafting ResultSlot refills after each take
so multi-craft loops stop when ingredients run out.
Reject CreatedOutput without a tracked craft, bound HotBar slot ids,
and stop survival UseItem from writing client item descriptors into
the held stack.
Gate LoginAck on finish_login, clear profiles after failed Mojang auth,
prefer close in get_packet select, accept reconnects by kicking the old
session, and reject section-sign Bedrock names.
…icks

Run play loops in child tasks so connection cleanup always runs, save
only the first worker crash report to disk, and keep the ticker alive
if a single tick panics.
Bound item user/extra data allocations at 256 KiB and reject empty or
whitespace Velocity secrets whenever velocity is enabled.
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