Skip to content

fix(loadusers): validate client-reported core stats before caching/persisting - #186

Open
Pajt9whauht283as wants to merge 1 commit into
VORPCORE:mainfrom
Pajt9whauht283as:fix/validate-core-stats-on-save
Open

fix(loadusers): validate client-reported core stats before caching/persisting#186
Pajt9whauht283as wants to merge 1 commit into
VORPCORE:mainfrom
Pajt9whauht283as:fix/validate-core-stats-on-save

Conversation

@Pajt9whauht283as

Copy link
Copy Markdown

Summary

As discussed in #184 — health/stamina values arriving over the network (vorp:SaveHealth, vorp:SaveStamina, vorp:HealthCached) were stored without any type or range checks and flushed to the characters table on save/disconnect, letting a modified client persist arbitrary values (e.g. locked max-health snapshots restored on every relogin) or non-numeric garbage that breaks downstream consumers.

Per the discussion, this keeps it minimal: no continuous server-side recalculation, just validation at persist time.

Changes

  • New SanitizeCoreValue() helper: tonumber() + clamp to the 0–100 core range
  • Applied in all three handlers before values reach character state / cache
  • Non-numeric payloads are rejected entirely (event is a no-op)
  • HealthOuter(healthOuter - healthInner) is additionally floored at 0 after sanitizing both inputs

Fixes #184

…rsisting

Health and stamina values arriving over the network (vorp:SaveHealth,
vorp:SaveStamina, vorp:HealthCached) were stored without any type or
range checks and flushed to the characters table on save/disconnect,
letting a client persist arbitrary values for its own character.

Validate at persist time: tonumber + clamp to the 0-100 core range.
Rejects non-numeric payloads entirely.

Fixes VORPCORE#184
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.

Security finding - client-controlled health/stamina values persisted straight into character DB rows

1 participant