Update synthetic ID generation: new components, random suffix, and IPv6 normalization #208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the synthetic ID generation system with three key improvements:
1. Updated Template Components (Closes #207)
Components kept:
client_ip- Client IP address (now normalized for IPv6)user_agent- Browser user agent stringaccept_language- Accept-Language headerComponents added:
accept_encoding- Accept-Encoding headerrandom_uuid- Random UUID for additional entropyComponents removed:
first_party_idpublisher_domainauth_user_idNew default template:
2. Random Suffix for Uniqueness
Appends a random 6-character alphanumeric suffix (a-z, A-Z, 0-9) to the HMAC hash, separated by a period.
Final ID format:
<64-char-hmac>.<6-char-random-suffix>Example:
a1748067b3908f2c9e0f6ea30a341328ba4b84de45448b13d1007030df14a98e.xK9f2B3. IPv6 Address Normalization (Closes #209)
Some devices rotate their IPv6 suffix frequently (Privacy Extensions), which would break the SyntheticID's persistence. This change normalizes IPv6 addresses to the /64 prefix (industry standard for stability).
Files Changed
Test plan
cargo fmt- no formatting issuescargo clippy- no warnings