Skip to content
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

Add PHP base-convert-loses-precision #3307

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

Sjord
Copy link
Contributor

@Sjord Sjord commented Feb 16, 2024

The function base_convert uses 64-bit numbers internally, and does not correctly convert large numbers. It is not suitable for random tokens such as those used for session tokens or CSRF tokens.

The function base_convert uses 64-bit numbers internally, and does not correctly convert large numbers.
It is not suitable for random tokens such as those used for session tokens or CSRF tokens.
$command = $secret = $counter = $uid = $totalColors = $i = $row = $value = $numeric = $string = '1';
$getRandomNumber = 'rand';

// ok: base-convert
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sjord all you annotations are using the wrong rule id: they should use base-convert-loses-precision.
That's why the CI check is failing :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I fixed it. I renamed the rule to give it a more specific name, but apparently did not replace all occurrences.

@p4p3r p4p3r merged commit 3206599 into semgrep:develop Feb 19, 2024
8 checks passed
0xDC0DE pushed a commit that referenced this pull request Feb 20, 2024
* Add PHP base-convert-loses-precision

The function base_convert uses 64-bit numbers internally, and does not correctly convert large numbers.
It is not suitable for random tokens such as those used for session tokens or CSRF tokens.

* PHP base-convert-loses-precision: Correctly name rule in test

Co-authored-by: Sjoerd Langkemper <sjoerd-github@linuxonly.nl>
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.

3 participants