Skip to content

OSS-369 B-12/B-15: request/session limits and safe Geyser bind defaults - #537

Merged
athNdev merged 1 commit into
mainfrom
codex/hardening-slices
Nov 18, 2026
Merged

athNdev merged 1 commit into
mainfrom
codex/hardening-slices

Conversation

@athNdev

@athNdev athNdev commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Scope

Two isolated OSS-369 defensive-hardening slices; no other gap items touched.

B-12 — request/session limits

  • Upload sessions created with a real user context record OwnerUserID. The generated RPC service, raw streaming upload handler and every consuming import/save endpoint (file, mod, datapack, modpack, world import, Packwiz content/datapacks) enforce that owner through GetTempPathFor/CleanupSessionFor/CancelFor. Cross-user access returns permission_denied (Connect) or 403 (legacy REST); legacy unowned/internal sessions keep working.
  • The panel http.Server pins MaxHeaderBytes = 1 MiB (Go's historical default) through a helper shared with loopback fixtures.
  • The shared console/RCON command.Sender caps commands at 4096 bytes (matching the existing WebSocket console bound) and applies a 60-per-minute sliding-window limit keyed by authenticated user, or by validated server for background jobs. Unknown server IDs create no limiter keys; idle keys are pruned above 1024 entries.

B-15 — Bedrock/Geyser safe defaults

  • cmd/geyser now generates bedrock.address: 127.0.0.1 when BEDROCK_ADDRESS is unset, and warns on an explicit wildcard bind. Setting BEDROCK_ADDRESS explicitly remains the opt-in to wider binding.
  • The shipped Geyser module keeps its intentional explicit BEDROCK_ADDRESS=0.0.0.0 because the panel UDP proxy dials the container IP; a fixture pins that contract. Existing generated configs are never rewritten unless OVERWRITE_CONFIG=true. Migration and network-restriction guidance is in docs/deployment-modes.md and the proxy-routing guide.

Evidence

Pinned Go 1.26.11 on native Windows:

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... -count=1 — all packages pass
  • touched-package build/vet/tests re-run after the review fixes — all pass
  • golangci-lint v2.13.2 --new-from-rev=origin/main ./... — 0 issues
  • knowledge-lint -fix, then knowledge-lint — 71 concepts, 38/38 fixed queries, indexes current

Negative/positive fixtures: cross-user session status/chunk/stream/cancel/cleanup refusal and owner success; real InitUpload→stream→SaveUploadedFile RPC flow with permission denial for another user and success for the owner; wrong-owner raw streaming upload 403 and legacy unowned stream 200; oversized header 431 and ordinary header 200 on a loopback test server; oversized command refused before any transport, command at cap delivered; 61st command in a window refused and refill after window; independent user budgets; unknown-server IDs create no keys; idle-key pruning; Geyser default/override/wildcard-detection config tests; builtin template explicit wide bind preserved.

Review

Independent review initially found a release-blocking regression: owner-bound sessions could not be consumed by the unowned temp-path/cleanup wrappers, and consume endpoints lacked owner enforcement. Both were fixed across all seams, covered by new fixtures, and confirmed resolved by follow-up independent review with no new defects. CI is requested here; do not merge until independent review of the final head and required CI are green.

Honest limits

  • No live Docker/Minecraft/Bedrock client, live provider, deployment, registry write or credential exposure was used; Geyser evidence is config-generation fixtures and source-level deployment analysis, not a live container.
  • Native CGO race detector is unavailable (CGO_ENABLED=0); concurrency claims rest on code inspection and CI race expectations.
  • No frontend or browser changes were made; no browser suite was run for this PR.
  • This PR deliberately does not address B-07/B-08/B-09/B-10/B-14.

…369 B-12/B-15)

B-12 binds upload sessions to their authenticated owner across init, stream, status, chunk, cancel and every consuming import/save RPC or REST route. The panel HTTP server pins MaxHeaderBytes and the shared console/RCON sender enforces command length and a bounded, pruned rate-limit window. B-15 defaults standalone Geyser to a loopback Bedrock bind with explicit address opt-in; the shipped module keeps its deliberate container-wide bind and documents migration.

Verified with pinned Go 1.26.11: go build/vet ./..., full go test ./... -count=1, golangci-lint 2.13.2 --new-from-rev=origin/main (0 issues), knowledge-lint -fix then clean (71 concepts, 38/38 queries). Independent review found and verified fixes for a consume-path regression identified during review.
@athNdev
athNdev merged commit f9d78c0 into main Nov 18, 2026
33 checks passed
@athNdev
athNdev deleted the codex/hardening-slices branch November 18, 2026 10:06
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