Skip to content

Replace sha1(uniqid()) by bin2hex(random_bytes(20)) #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

TimWolla
Copy link

The output size and format is identical, but random_bytes() provides much better randomness than uniqid() even with the $more_entropy parameter which adds only 32 Bits of entropy on top of the current (micro)time which is more or less known externally.

For MultipartStream that might result in a guessable boundary, which might allow an attacker to modify the semantics of an outgoing request with a well-crafted file.

The output size and format is identical, but `random_bytes()` provides much
better randomness than `uniqid()` even with the $more_entropy parameter which
adds only 32 Bits of entropy on top of the current (micro)time which is more or
less known externally.

For MultipartStream that might result in a guessable boundary, which might
allow an attacker to modify the semantics of an outgoing request with a
well-crafted file.
@GrahamCampbell GrahamCampbell merged commit e58dd20 into guzzle:master Oct 26, 2022
@TimWolla TimWolla deleted the uniqid branch October 26, 2022 14:01
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.

None yet

2 participants