Skip to content

v0.0.2

Choose a tag to compare

@yeatdev yeatdev released this 07 Jun 06:55

OMP-DX Security & Text Rendering Update

This release focuses on security hardening, safer font loading, async logging, event spam protection, and improved Unicode text rendering.

Highlights

  • Mitigated the previous font-based RCE risk by removing arbitrary remote font loading.
  • Added SHA-256 based font allowlist validation.
  • Added server-to-client font transfer with strict client-side verification.
  • Added async client/server logging to prevent log writes from freezing gameplay.
  • Added server-side protection against invalid and valid element ID spam.
  • Added Unicode text rendering support for UTF-8 strings.
  • Added /dxtext test panel for multilingual text rendering checks.

Security

Font RCE Mitigation

Font loading has been redesigned around an allowlist model.

Previously, server-side scripts could request arbitrary font resources, which created a dangerous attack surface because the client could be forced to parse untrusted font files.

Now:

  • Fonts must match an allowlist entry.
  • The client validates:
    • SHA-256 hash
    • font family
    • file name
  • Unsafe font names, paths, URLs, .., and unsupported extensions are rejected.
  • Server-provided font bytes are only accepted if they match the client allowlist.
  • Bundled fonts are shipped in the client omp-dx/fonts/ directory.

Bundled fonts currently include:

  • FontAwesome
  • Outfit
  • Poppins
  • JetBrains Mono

Event ID Spam Protection

Server-side DX event handling is now hardened against malicious clients sending random or excessive element IDs.

Added protections:

  • Per-player DX element registry
  • Unknown/disallowed element rejection
  • Global player event rate limit
  • Per-element/per-event rate limits
  • Valid-ID spam throttling
  • Safer handling for stateful events like sliders, drag, color picker, and scroll containers
  • Drag events are now only accepted for elements explicitly marked draggable

This prevents clients from crashing or heavily stressing the server by sending arbitrary DX event packets.

Registry Overflow Protection

The server now enforces a maximum DX element count per player. If the registry is full, new element payloads are rejected instead of silently desynchronizing client/server state.

Logging

Client and server loggers are now asynchronous.

Changed logs:

  • dx_client_log.txt
  • dx_server_log.txt

Benefits:

  • Log writes no longer block the game/server thread directly.
  • Queues are bounded to prevent unbounded memory growth.
  • Oversized log messages are truncated.
  • Dropped messages are reported when the queue overflows.

Text Rendering

Unicode Rendering Support

The client text renderer now supports UTF-8 text properly.

Fixed issues like:

  • Türkçe rendering as Türkçe
  • Russian/Chinese/Korean text appearing as mojibake
  • Unicode text width measurement being based on raw bytes

Added:

  • UTF-8 to UTF-16 conversion
  • Unicode glyph cache
  • Unicode-aware text width measurement
  • Better button centering and input cursor positioning for Unicode text

This should work for any language where the selected font contains the required glyphs.

Notes:

  • Font coverage still matters.
  • Complex shaping is not fully implemented yet, so Arabic, Indic scripts, emoji ZWJ sequences, etc. may require future DirectWrite/HarfBuzz-style shaping support for perfect rendering.

Test Script

Added a new /dxtext command to the test filterscript.

The new text rendering panel includes:

  • Korean text
  • Chinese text
  • Russian text
  • Turkish text
  • Mixed-language text
  • Font coverage tests
  • Scale tests
  • Clip area text test

Existing component lab commands remain available:

  • /dxlab
  • /dxfont
  • /dxfontbad
  • /dxclear

API / Behavior Changes

DX_LoadFont

DX_LoadFont now expects a safe local/server font file name instead of an arbitrary remote URL.

DX_LoadFont(playerid, "Outfit", "Outfit.ttf");

Security behavior:

  • Client checks omp-dx/fonts/font-allowlist.txt.
  • Server may transfer font bytes, but the client still verifies the SHA-256 allowlist.
  • Missing or unapproved fonts are rejected.

Allowlist format:

SHA256|FontFamily|FileName

Example:

...|Outfit|Outfit.ttf

Build / Packaging Notes

Client deployment now requires copying the generated omp-dx/ folder next to the ASI.

Expected client layout:

GTA San Andreas/
  omp-dx.asi
  omp-dx/
    fonts/
      font-allowlist.txt
      FontAwesome.ttf
      Outfit.ttf
      Poppins.ttf
      JetBrainsMono.ttf

Server-side fonts can be placed in one of:

fonts/
omp-dx/fonts/
components/omp-dx/fonts/

Commits Included

  • Harden server DX event handling
  • Mitigate font RCE and harden text rendering
  • Add DX text rendering test panel
  • Document secure font loading

Recommended Upgrade Steps

  1. Replace the server component DLL.
  2. Replace the client ASI.
  3. Copy the client omp-dx/ asset folder next to the ASI.
  4. Update omp-dx.inc.
  5. Recompile scripts using DX_LoadFont.
  6. Test /dxtext and /dxlab on a local server.

Important Security Note

This update prevents servers from forcing clients to parse arbitrary remote fonts. Font loading is now controlled by the client-side allowlist.