Skip to content

[Bug?]: Wrong server function called due to incorrect handling of file hash collisions for server func sourcesΒ #1570

Description

@apatrida

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

With a nested structure for server functions, the hashing of the files might have a collission and then one set is placed in the hash file, the other set inlined, but both use the same hashes therefore one set of functions calls the other set on accident causing unexpected server functions to execute, sometimes dangerously so.

file apiStripe.ts
export const apiStripe = {
   ...some server functions
}


file apiFortis.ts
export const apiFortisV3 = {
  ...some server functions
}


file serverApi.ts (merges the API's into one parent)

export const serverApi = {
   stripe: ...apiStripe,
   fortis: ...apiFortisV3
}

This creates a conflict hash, and so code from apiStripe.ts goes to some hash file C_54xxx and yet apiFortis.ts has the same hash, so its contents are copied into serverApi.ts instead, yet both are mapped with C_54xxx so calls to one set of functions happens to be call the incorrect set causing unexpected server functions to be called. If these have matching signatures they will execute and therefore you could execute a "delete" instead of your "update" or some other bad result.

It is very hard to debug, and will be a painful mystery for anyone encountering this.

Expected behavior πŸ€”

Server function calls never call the wrong server function

Steps to reproduce πŸ•Ή

See the main description for the structure that causes this.

Context πŸ”¦

Have server functions that are aggregated into a tree of server functions.

Your environment 🌎

Solid-start 1.0.2
Vinxi 0.3.12
Solid-router 0.13.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Start 1.xbugSomething isn't workingvinxirelated to vinxi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions