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

get_random_bytes gives taint errors #28

Open
gerv opened this issue Aug 4, 2015 · 2 comments
Open

get_random_bytes gives taint errors #28

gerv opened this issue Aug 4, 2015 · 2 comments

Comments

@gerv
Copy link

gerv commented Aug 4, 2015

See https://bugzilla.mozilla.org/show_bug.cgi?id=1187897 . The errors are:

Insecure dependency in eval while running with -T switch at /usr/local/share/perl5/Crypt/OpenPGP/Util.pm line 107.
at /usr/local/share/perl5/Crypt/OpenPGP/Util.pm line 104.
Crypt::OpenPGP::Util::get_random_bytes(490) called at /usr/local/share/perl5/Crypt/OpenPGP/SessionKey.pm line 96

It is suggested that this code may be responsible, from Util.pm:

sub get_random_bytes {
my $length = shift;
if (eval 'require Crypt::Random; 1;') {
return Crypt::Random::makerandom_octet( Length => $length);
}
elsif (eval 'require Bytes::Random::Secure; 1;') {
return Bytes::Random::Secure::random_bytes($length);
}
else {
die "No random source available!";
}
}

Gerv

@floatingatoll
Copy link

Module::Load::Conditional has been around a few years, has no C/XS dependencies, and was integrated into core around 5.22 (I believe?). It would help remove the above evals.

@dylanwh
Copy link

dylanwh commented Aug 4, 2015

the above evals are not needed at all. Just use an eval { } block. "require" is not compile time.
if (eval { require Bytes::Random::Secure; 1 }) {...}

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

No branches or pull requests

3 participants