Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: New to perl - Check authenticity of cpan mods installed/used

by ferreira (Chaplain)
on Feb 21, 2019 at 18:12 UTC ( [id://1230318]=note: print w/replies, xml ) Need Help??


in reply to New to perl - Check authenticity of cpan mods installed/used

With respect to "Check authenticity of cpan mods installed", I know that every tarball accepted on CPAN has a few checksum attributes computed and stored in the corresponding CPAN author directory.

For example, let's say you are interested in this specific distribution release:

https://cpan.metacpan.org/authors/id/A/AN/ANDK/CPAN-Checksums-2.12.tar.gz

You can find the "checksum" for every file on ANDK directory at

https://www.cpan.org/authors/id/A/AN/ANDK/CHECKSUMS

This file has a data structure encoded in Perl itself, and the bit that matters for the tarball in question is

'CPAN-Checksums-2.12.tar.gz' => { 'md5' => 'a98eaa3f96c052ee73690459d8e7a4f4', 'md5-ungz' => 'e49a4710110f8a6a916ece44165ee1e8', 'mtime' => '2016-06-14', 'sha256' => '99600fb2d1a007f84e16b5eae608ffbc288bd0af92fbcc5d73120 +d43ee5d2d38', 'sha256-ungz' => 'aaddaf9ca455863e3f28c55e26741251640ee477906e3e03 +8f5e330ccf406970', 'size' => 14868 },

So you can write code to make sure the downloaded tarball matches the corresponding attributes / checksums.

For example, the commands below (on OS X) manually "check" the size and md5 sum of the .gz file.

$ curl -O https://cpan.metacpan.org/authors/id/A/AN/ANDK/CPAN-Checksum +s-2.12.tar.gz $ stat -f '%N %z' CPAN-Checksums-2.12.tar.gz CPAN-Checksums-2.12.tar.gz 14868 $ md5 CPAN-Checksums-2.12.tar.gz MD5 (CPAN-Checksums-2.12.tar.gz) = a98eaa3f96c052ee73690459d8e7a4f4

I think some CPAN clients (especiallly CPAN which is part of Perl core) may be configured to verify those checksums while downloading and installing. Someone else may correct me or point to the specific incantations to make that work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1230318]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found