EventStore / EventStoreDB-Client-Java

Official Asynchronous Java 8+ Client Library for EventStoreDB 20.6+
https://eventstore.com
Apache License 2.0
64 stars 20 forks source link

Ensure stream identifiers are limited to the correct character set #25

Open jen20 opened 4 years ago

jen20 commented 4 years ago

As of #21, stream identifiers are now structured, but represented on the wire as ByteString types. @jageall suggests that these should be limited in which bytes are acceptable, and that the encoding should then be ASCII rather than UTF-8 (though they are identical for the acceptable range of bytes). We should enforce this from the start in this client.

@jageall, what are the restrictions which need to be implemented here?

jageall commented 4 years ago

static readonly byte[] IllegalBytes = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x5b, 0x5c, 0x5d, 0x5e, 0x60, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f };

Anything above 0x7f is also considered illegal