Skip to content

fix: generate event short IDs with crypto/rand instead of math/rand f… - #274

Open
kckhchen wants to merge 1 commit into
schej-it:mainfrom
kckhchen:fix/event-shortid-security
Open

kckhchen wants to merge 1 commit into
schej-it:mainfrom
kckhchen:fix/event-shortid-security

Conversation

@kckhchen

Copy link
Copy Markdown

…rom timestamp

The problem

GenerateShortEventId used math/rand with unix timestamp of the event creation as the seed, which is predictable and deterministic. Also, the shortId space with only a length of 5 chars can be enumerated, leaving the privacy of events at risk.

The fix

This commit changes the ShortId generation from math/rand to crypto/rand to generate a 10-char long random id for an event, and stop using the timestamp as seed to prevent malicious guessing. This, however, should be implemented in tandem with rate limiting to truly prevent the enumeration risk. Another PR will be opened later to address the problem.

…rom timestamp

## The problem

GenerateShortEventId used math/rand with unix timestamp of the event
creation as the seed, which is predictable and deterministic. Also, the
shortId space with only a length of 5 chars can be enumerated, leaving
the privacy of events at risk.

## The fix

This commit changes the ShortId generation from math/rand to crypto/rand
to generate a 10-char long random id for an event, and stop using the
timestamp as seed to prevent malicious guessing. This, however, should
be implemented in tandem with rate limiting to truly prevent the
enumeration risk. Another PR will be opened later to address the
problem.
@jonyTF

jonyTF commented Sep 17, 2026

Copy link
Copy Markdown
Member

The reason why we initially implemented the short IDs was because we wanted to provide an easy way for someone to share a link on a whiteboard / so it was easy to manually type. Maybe a better solution is to just implement rate limiting so someone can't just run a script to discover a bunch of event IDs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants