How We Secured the MyZubster Metaverse: Session Ownership, Verified Explorers and the Road to Realti

Leader ●2 ●25 ●155
calendar_today • schedule7 min read

A technical update on the architecture, security controls, testing and remaining roadmap behind the open-source MyZubster Metaverse.
The MyZubster Metaverse is moving from an experimental interface toward a secure, testable multiplayer environment.
Our goal is not simply to display avatars in a browser. We want to create an open-source world connecting public profiles, verified contributors, Zorgax characters, community knowledge and software-development workflows.
The public Metaverse is available at:
https://www.myzubster.com/metaverse
This article describes what we have implemented, the security problem we recently solved and what remains before the platform can support realtime interaction at scale.
The current experience
A user can enter the MyZubster world as a guest without providing:

  • a cryptocurrency wallet;
  • identity documents;
  • a GitHub account;
  • an installed application.
    The current interface supports guest onboarding through a public display name and also presents verified explorers associated with authorized public accounts.
    This creates two identity levels:
    1. Guest explorers use temporary world sessions.
    2. Verified explorers have characters linked to a MyZubster account or confirmed GitHub identity.
      “Verified” does not mean KYC or legal identity verification. It only confirms control of the connected public account.
      Building the presence layer
      The backend maintains a presence record for every active participant.
      A simplified record may contain:
      {
      sessionId,
      displayName,
      characterId,
      accountId,
      githubLogin,
      position,
      status,
      lastSeenAt
      }
      This model supports the main world operations:
      Join
      Synchronize
      Move
      Chat
      Emote
      Leave
      Retrieve events
      Public players must be discoverable by other clients, so each presence has a public session identifier.
      However, a public identifier must never be treated as proof that a request belongs to that player.
      That distinction became the focus of our latest security milestone.
      The original session-ownership problem
      A multiplayer client needs to identify which session it wants to update.
      For example:
      {
      "sessionId": "public-session-id",
      "x": 120,
      "y": 80
      }
      If the backend trusts only sessionId, a malicious user may be able to submit another player’s identifier and perform actions on their behalf.
      Depending on the exposed routes, this could allow an attacker to:
  • move another character;
  • send chat messages under another identity;
  • publish unauthorized emotes;
  • retrieve session-specific events;
  • terminate another player’s session.
    A public session ID is an identifier, not an authorization credential.
    Implementing possession-bound sessions
    We implemented a new security boundary in:
    Pull Request #34 — Bind world actions to session credentials
    The change was merged into main as commit:
    148a798
    Every new Metaverse session now receives two different values:
    Public session ID
    Private session token
    The public ID can appear in world-state responses. The private token proves that the client controls the session.
    Cryptographically random credentials
    The server generates a token using 32 random bytes:
    const sessionToken = crypto
    .randomBytes(32)
    .toString("base64url");
    This provides 256 bits of entropy.
    The raw token is returned only during session creation and is never included in public presence data.
    Storing only a digest
    The server does not persist the raw credential.
    Instead, it calculates a SHA-256 digest:
    const sessionTokenHash = crypto
    .createHash("sha256")
    .update(sessionToken)
    .digest("hex");
    Only sessionTokenHash is stored with the presence record.
    This prevents a database reader from immediately obtaining active bearer credentials.
    Constant-time comparison
    When a protected request arrives, the server hashes the submitted credential and compares it with the stored digest.
    The verification uses a constant-time comparison:
    crypto.timingSafeEqual(expected, received);
    A shared ownership middleware verifies that:
  • the session exists;
  • a credential was supplied;
  • the credential has the expected format;
  • its digest matches the stored value;
  • the caller owns the requested session.
    Invalid or missing credentials return:
    HTTP 401 Unauthorized
    Protected world routes
    Session ownership is now required for mutable and session-specific operations such as:
    /sync
    /move
    /chat
    /emote
    /leave
    /events
    Knowing another participant’s sessionId is no longer sufficient to control their character.
    The authorization rule is now:
    Public session ID
      +
    

    Private possession token

      =
    

    Authorized world action
    Keeping credentials out of public payloads
    The frontend sends the private token through a dedicated HTTP header:
    X-Metaverse-Session-Token: <private-token>
    Example:
    const createSessionHeaders = (sessionToken) => ({
    "X-Metaverse-Session-Token": sessionToken,
    });
    The world-state body remains limited to operational data:
    {
    "sessionId": "public-session-id",
    "x": 120,
    "y": 80
    }
    This separation reduces the probability that credentials are accidentally copied into:

  • world events;
  • analytics;
  • public API responses;
  • application logs;
  • debugging output;
  • cached payloads.
    The credential is also kept in React runtime memory instead of being written to localStorage or public profile objects.
    An in-memory token is not a complete defense against browser compromise, but it reduces persistent credential exposure.
    Identity boundaries
    The Metaverse now distinguishes between several layers:
    Account identity
    ↓
    

    Public profile

    ↓
    

    Character identity

    ↓
    

    Temporary world session

    ↓
    

    Private session credential
    These layers have different meanings.
    A verified GitHub account does not automatically prove legal identity, employment, payment eligibility or institutional affiliation.
    Similarly, a public session ID identifies a player’s presence but does not authorize requests for that player.
    Documenting these boundaries is essential for avoiding security and governance problems later.
    Testing the implementation
    The session-ownership change includes backend, frontend and architecture-level tests.
    Backend tests
    The targeted backend suites verify:

  • secure token generation;
  • SHA-256 digest storage;
  • valid credential acceptance;
  • missing credential rejection;
  • invalid credential rejection;
  • cross-session mutation prevention;
  • protected movement and chat;
  • protected emotes and leave operations;
  • exclusion of secrets from public responses.
    Results:
    3 backend suites
    22 tests passed
    Frontend tests
    Frontend coverage verifies:
  • token retention in application memory;
  • use of the session-token header;
  • authenticated world operations;
  • removal of tokens from normal JSON bodies;
  • correct handling of protected session requests.
    Results:
    1 frontend suite
    5 tests passed
    Integration and deployment
    The completed verification included:
    Production frontend build: successful
    git diff --check: clean
    Marketplace regression suite: passed
    Vercel preview deployments: successful
    Main CI workflow: successful
    Production deployment: successful
    The public Metaverse route was also loaded after deployment.
    Current architecture
    The current system can be summarized as:
    React Metaverse Client
      |
      | HTTPS
      | X-Metaverse-Session-Token
      v
    

    Node.js / Express API

      |
      | Session ownership middleware
      | Hash verification
      v
    

    Metaverse Presence Storage

      |
      v
    

    Shared world synchronization
    This is a practical foundation, but it is not yet the final realtime architecture.
    What remains to be built
    Realtime communication
    The current synchronization model still depends on polling in important areas.
    We need a versioned realtime protocol supporting:

  • authenticated WebSocket connections;
  • session-to-connection binding;
  • reconnect handling;
  • ordered events;
  • duplicate-event protection;
  • presence expiration;
  • backpressure;
  • slow-client management.
    The protocol should remain usable by multiple clients, including future community-built and WebXR clients.
    Distributed rate limiting
    Per-process rate limiting is not enough when the backend runs across multiple instances.
    We need a distributed limiter for:
    Session creation
    Authentication attempts
    Movement
    Chat
    Emotes
    Reconnects
    Limits should be calculated using combinations of:
  • IP address;
  • account ID;
  • session ID;
  • route;
  • world ID;
  • time window.
    Chat and authentication need stricter limits than normal movement updates.
    Session expiration and revocation
    The possession credential is now implemented, but lifecycle controls still need improvement:
  • explicit expiration;
  • server-side revocation;
  • abandoned-session cleanup;
  • token rotation;
  • reconnect-safe renewal;
  • active-session limits;
  • multi-device logout;
  • suspicious-session invalidation.
    Canonical authentication
    Verified characters require a stable account-linking process.
    The remaining work includes:
  • canonical GitHub OAuth;
  • verified account-to-character relationships;
  • account-link substitution protection;
  • reauthorization;
  • identity-change audit trails;
  • account recovery procedures.
    The backend must never trust a GitHub username supplied directly by a browser.
    Privacy-safe analytics
    We need enough telemetry to maintain the platform without introducing unnecessary tracking.
    Useful operational metrics include:
  • concurrent sessions;
  • API latency;
  • reconnect frequency;
  • server errors;
  • world capacity;
  • rate-limit events;
  • event throughput.
    Retention, aggregation and access rules must be documented before expanding analytics.
    Reliability and load testing
    Future tests must simulate:
  • simultaneous joins;
  • movement bursts;
  • reconnect storms;
  • malformed messages;
  • database latency;
  • backend restarts;
  • multiple server instances;
  • slow or disconnected clients.
    We also need measurable targets for latency, error rate, recovery time and maximum concurrent participants.
    Complete E2E acceptance testing
    The complete guest flow should be automated:
    Join
    → receive credential
    → become visible
    → move
    → chat
    → publish an emote
    → reject impersonation attempts
    → reconnect safely
    → leave or expire
    The same acceptance flow is required for verified characters.
    WebXR
    WebXR remains part of the roadmap, but it should follow security and realtime stabilization.
    The eventual world protocol should support:
    2D web client
    3D browser client
    WebXR client
    Mobile client
    Independent community clients
    All clients should use the same documented API and event protocol.
    Dependency-security debt
    The repository currently reports vulnerabilities during npm audit.
    These findings were already present and were not introduced by the Metaverse session-ownership pull request, which did not change package manifests or lockfiles.
    However, they remain technical debt.
    A separate dependency-hardening milestone should include:
    1. classifying production and development exposure;
    2. updating direct dependencies;
    3. reviewing transitive dependencies;
    4. replacing abandoned packages;
    5. regenerating lockfiles;
    6. running complete regression tests;
    7. updating SBOM and audit evidence.
      Disabling the audit to produce a green badge would hide the problem instead of solving it.
      Recommended roadmap
      The recommended implementation sequence is:
    8. Session expiration and revocation
    9. Distributed rate limiting
    10. Canonical account authentication
    11. Versioned realtime protocol
    12. Authenticated WebSocket transport
    13. Privacy-safe monitoring
    14. Reliability and load testing
    15. Complete E2E acceptance tests
    16. Dependency-security remediation
    17. WebXR client development
      Security, reliability and protocol stability must come before graphical complexity.
      Open-source participation
      We are looking for contributors interested in:
  • React;
  • Node.js and Express;
  • MongoDB;
  • Redis;
  • WebSockets;
  • application security;
  • privacy engineering;
  • abuse prevention;
  • load testing;
  • WebXR;
  • technical documentation.
    Repository:
    https://github.com/danieldirimini-myzubster/myzubster
    Public Metaverse:
    https://www.myzubster.com/metaverse
    Security implementation:
    https://github.com/danieldirimini-myzubster/myzubster/pull/34
    Conclusion
    The MyZubster Metaverse now has a stronger session-security foundation.
    We moved from public identifier-based operations to possession-bound authorization using:
  • 256-bit random credentials;
  • SHA-256 token digests;
  • constant-time verification;
  • dedicated authorization headers;
  • memory-only client credentials;
  • protected world routes;
  • backend and frontend security tests.
    The next milestone is transforming this foundation into a distributed realtime system with strong authentication, rate limiting, privacy-safe observability and measurable reliability.
    The Metaverse is online, but the deeper work is still ahead: building an open world protocol that other developers can inspect, test and extend.

Want more #devops & #softwarearchitecture deep dives?

Join 5,955+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Engineering a Browser-First Metaverse: WebXR Fallbacks, Server-Authoritative Rooms, and Versioned

Myzubster - Oct 12

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

How AI Is Changing Web Development, and What Developers Still Need to Understand

Daniel Decker - Nov 10

A Textile Mill's Dyehouse Ramp Curve: Get One Step Wrong and the Sheet Belongs to the Master

aiomniu - Oct 18
chevron_left
4.4k Points • 182 Badges
Rimini
112Posts
17Comments
33Connections

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!