Skip to content

Conversation

NicolasToussaint
Copy link
Member

@NicolasToussaint NicolasToussaint commented Dec 13, 2022

Replaced cryptographically insecure PHP rand() function
with built-in for PHP random_int() with secure pseudo-random number generator

Description

This fixes weak methods of generating pseudo-random values, as detected by a Checkmarx scan of Fossology

Changes

Fixes 5 randomness generation in php scripts

with built-in for PHP random_int() with secure pseudo-random number generator

Signed-off-by: Toussaint Nicolas <[email protected]>
@shaheemazmalmmd
Copy link
Member

@NicolasToussaint : While testing this branch for an existing instance. I'm getting the below error please look into it.

[Tue Jan 03 11:08:04.210076 2023] [php:notice] [pid 25741] [client 10.0.2.2:58576] PHP Fatal error:  Uncaught Error: Fossology\\Lib\\Dao\\UserDao::getUserAndDefaultGroupByUserName(): Argument #1 ($userName) cannot be passed by reference in /usr/local/share/fossology/www/ui/core-auth.php:156\nStack trace:\n#0 /usr/local/share/fossology/www/ui/core-auth.php(137): core_auth->updateSession()\n#1 /usr/local/share/fossology/lib/php/Plugin/FO_Plugin.php(466): core_auth->PostInitialize()\n#2 /usr/local/share/fossology/lib/php/common-plugin.php(219): FO_Plugin->preInstall()\n#3 /usr/local/share/fossology/www/ui/index.php(46): plugin_preinstall()\n#4 {main}\n  thrown in /usr/local/share/fossology/www/ui/core-auth.php on line 156

Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

Changes looks good. Tested, working as expected.

@GMishx GMishx merged commit 2a9ff62 into fossology:master Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants