diff options
author | Stig Palmquist <git@stig.io> | 2022-08-19 19:34:51 +0200 |
---|---|---|
committer | Stig Palmquist <git@stig.io> | 2022-08-19 19:57:56 +0200 |
commit | 5b709277f48df630c8fa7aab0cf6157f71a5b45c (patch) | |
tree | 536c7679b24e1f643c0a17ba235ee8427422a665 /pkgs/development/interpreters/perl | |
parent | 51422b1831366cd8ee56d340bc4183d841dc2d33 (diff) |
perl: `verify_SSL=>1` by default in HTTP::Tiny
Diffstat (limited to 'pkgs/development/interpreters/perl')
-rw-r--r-- | pkgs/development/interpreters/perl/default.nix | 3 | ||||
-rw-r--r-- | pkgs/development/interpreters/perl/http-tiny-verify-ssl-by-default.patch | 79 |
2 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix index 0a9c53e11c5f4..79e2bf84a0cdd 100644 --- a/pkgs/development/interpreters/perl/default.nix +++ b/pkgs/development/interpreters/perl/default.nix @@ -39,6 +39,9 @@ let [ # Do not look in /usr etc. for dependencies. ./no-sys-dirs-5.31.patch + + # Enable TLS/SSL verification in HTTP::Tiny by default + ./http-tiny-verify-ssl-by-default.patch ] ++ optional stdenv.isSunOS ./ld-shared.patch ++ optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ] diff --git a/pkgs/development/interpreters/perl/http-tiny-verify-ssl-by-default.patch b/pkgs/development/interpreters/perl/http-tiny-verify-ssl-by-default.patch new file mode 100644 index 0000000000000..59248061513db --- /dev/null +++ b/pkgs/development/interpreters/perl/http-tiny-verify-ssl-by-default.patch @@ -0,0 +1,79 @@ +Patch for HTTP::Tiny that defaults verify_SSL to 1 + +Based on proposed Debian patch by Dominic Hargreaves: +https://salsa.debian.org/perl-team/interpreter/perl/-/commit/1490431e40e22052f75a0b3449f1f53cbd27ba92 + + +diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm +index 5803e4599..88ba51461 100644 +--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm ++++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm +@@ -40,7 +40,7 @@ sub _croak { require Carp; Carp::croak(@_) } + #pod * C<timeout> — Request timeout in seconds (default is 60) If a socket open, + #pod read or write takes longer than the timeout, an exception is thrown. + #pod * C<verify_SSL> — A boolean that indicates whether to validate the SSL +-#pod certificate of an C<https> — connection (default is false) ++#pod certificate of an C<https> — connection (default is true) + #pod * C<SSL_options> — A hashref of C<SSL_*> — options to pass through to + #pod L<IO::Socket::SSL> + #pod +@@ -112,7 +112,7 @@ sub new { + max_redirect => 5, + timeout => defined $args{timeout} ? $args{timeout} : 60, + keep_alive => 1, +- verify_SSL => $args{verify_SSL} || $args{verify_ssl} || 0, # no verification by default ++ verify_SSL => $args{verify_SSL} // $args{verify_ssl} // 1, # verification by default + no_proxy => $ENV{no_proxy}, + }; + +@@ -1038,7 +1038,7 @@ sub new { + timeout => 60, + max_line_size => 16384, + max_header_lines => 64, +- verify_SSL => 0, ++ verify_SSL => 1, + SSL_options => {}, + %args + }, $class; +@@ -1765,7 +1765,7 @@ C<timeout> — Request timeout in seconds (default is 60) If a socket open, read + + =item * + +-C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is false) ++C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is true) + + =item * + +@@ -2035,7 +2035,7 @@ Verification of server identity + + =back + +-B<By default, HTTP::Tiny does not verify server identity>. ++B<By default, HTTP::Tiny in NixOS verifies server identity>. + + Server identity verification is controversial and potentially tricky because it + depends on a (usually paid) third-party Certificate Authority (CA) trust model +@@ -2043,16 +2043,14 @@ to validate a certificate as legitimate. This discriminates against servers + with self-signed certificates or certificates signed by free, community-driven + CA's such as L<CAcert.org|http://cacert.org>. + +-By default, HTTP::Tiny does not make any assumptions about your trust model, +-threat level or risk tolerance. It just aims to give you an encrypted channel +-when you need one. +- + Setting the C<verify_SSL> attribute to a true value will make HTTP::Tiny verify + that an SSL connection has a valid SSL certificate corresponding to the host + name of the connection and that the SSL certificate has been verified by a CA. + Assuming you trust the CA, this will protect against a L<man-in-the-middle +-attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>. If you are +-concerned about security, you should enable this option. ++attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>. ++ ++If you are not concerned about security, and this default in NixOS causes ++problems, you should disable this option. + + Certificate verification requires a file containing trusted CA certificates. + +-- + + |