Skip to content

Consider deterministically deriving the first three digits of minorVersion when instantiating SoulseekClient #909

Description

@slook

Since #893 version of 9 the library Require a minor version to be supplied when instantiating SoulseekClient. This is a good idea, but it is somewhat inconvenient that minorVersion...

  • ... is a required argument in the main constructor,
  • ... has to have a minimum value of no less than 100,
  • ... should be unique from other projects yet there's no easy method for developers to ensure this,
  • ... is named an ambiguous term whereas in fact it could be better if it were unrelated to a client's software version,
  • ... doesn't necessarily imply a unique client type, as ideally it should help to identify...
    • ... a unique developer, and/or;
    • ... the project by its name.
  • ... doesn't explicitly identify the library version upon which a client is based,
  • ... is prone to frequent changing if a developer ties it to their application's "minor version" and has a rapid release cycle,
  • ... doesn't protect against an actor from using a random number generator for each new instance of a malicious client.

Consider if the library could derive the first 3 or so digits of this number from, for instance:

  • Numeric digits from the library package Version, such as "9.1.0"=910; "10.0.x"=100; "10.1.x"=101 and so on
  • The client's application name string (if discoverable?), such as "slskd" = [numeric output of a deterministic hash function]
  • A numeric output of a deterministic hash function from the specific combination of all the SoulseekClientOptions()
  • Some other unique information that is already known by the library at build time that could be used for fingerprinting
  • A combination of any of the above which derives some useful number to use as the first three or more digits

Then the minorVersion could be made optional, whilst still providing the intended benefits of requiring this value to be supplied, and helping the server admins to more reliably identify different clients types/versions on the network because:

  • The likelihood of each client type having a unique value would be greatly increased
  • It would be harder for a malicious actor to deliberately impersonate other client types to hide a bot net or swarm
  • If the API library Version was used at the beginning of the value then...
    • ... the sequential numeric value would help to serve a purpose that is closer to the original intent of this field,
    • ... at least the start of the value will predictably increment rather than seeming/being entirely random/randomized,
    • ... client capabilities/vulnerabilities would be known and could be acted upon if required,
    • ... clients using legacy API versions could be restricted or obsoleted if and when it became necessary to do so.

If a custom value is also supplied by the caller then this could be appended after the first 3 derived digits, thereby still allowing developers the freedom to use the remaining part of this value for their own purposes as they so wish.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions