Skip to content

Commit 7143385

Browse files
committed
Add SECURITY.md
1 parent 3135eca commit 7143385

File tree

5 files changed

+171
-16
lines changed

5 files changed

+171
-16
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* It's 2024
66
* Tested with perl-5.40.0
77
* It's 2025
8+
* Add SECURITY.md
89

910
0.60 - 2023-01-06, H.Merijn Brand
1011
* It's 2023

MANIFEST

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ChangeLog
22
MANIFEST
33
Makefile.PL
44
CONTRIBUTING.md
5+
SECURITY.md
56
cpanfile
67
README
78
lib/Bundle/DBD/CSV.pm

SECURITY.md

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Security Policy for the DBD::CSV distribution.
2+
3+
Report issues via email at: Jochen Wiedmann.
4+
5+
6+
This is the Security Policy for the Perl DBD::CSV distribution.
7+
8+
The latest version of the Security Policy can be found in the
9+
[git repository for DBD::CSV](https://github.com/perl5-dbi/DBD-CSV).
10+
11+
This text is based on the CPAN Security Group's Guidelines for Adding
12+
a Security Policy to Perl Distributions (version 1.0.0)
13+
https://security.metacpan.org/docs/guides/security-policy-for-authors.html
14+
15+
# How to Report a Security Vulnerability
16+
17+
Security vulnerabilities can be reported by e-mail to the current
18+
project maintainers at Jochen Wiedmann.
19+
20+
Please include as many details as possible, including code samples
21+
or test cases, so that we can reproduce the issue. Check that your
22+
report does not expose any sensitive data, such as passwords,
23+
tokens, or personal information.
24+
25+
If you would like any help with triaging the issue, or if the issue
26+
is being actively exploited, please copy the report to the CPAN
27+
Security Group (CPANSec) at <[email protected]>.
28+
29+
Please *do not* use the public issue reporting system on RT or
30+
GitHub issues for reporting security vulnerabilities.
31+
32+
Please do not disclose the security vulnerability in public forums
33+
until past any proposed date for public disclosure, or it has been
34+
made public by the maintainers or CPANSec. That includes patches or
35+
pull requests.
36+
37+
For more information, see
38+
[Report a Security Issue](https://security.metacpan.org/docs/report.html)
39+
on the CPANSec website.
40+
41+
## Response to Reports
42+
43+
The maintainer(s) aim to acknowledge your security report as soon as
44+
possible. However, this project is maintained by a single person in
45+
their spare time, and they cannot guarantee a rapid response. If you
46+
have not received a response from them within 10 days, then
47+
please send a reminder to them and copy the report to CPANSec at
48+
49+
50+
Please note that the initial response to your report will be an
51+
acknowledgement, with a possible query for more information. It
52+
will not necessarily include any fixes for the issue.
53+
54+
The project maintainer(s) may forward this issue to the security
55+
contacts for other projects where we believe it is relevant. This
56+
may include embedded libraries, system libraries, prerequisite
57+
modules or downstream software that uses this software.
58+
59+
They may also forward this issue to CPANSec.
60+
61+
# Which Software This Policy Applies To
62+
63+
Any security vulnerabilities in DBD::CSV are covered by this policy.
64+
65+
Security vulnerabilities are considered anything that allows users
66+
to execute unauthorised code, access unauthorised resources, or to
67+
have an adverse impact on accessibility or performance of a system.
68+
69+
Security vulnerabilities in upstream software (embedded libraries,
70+
prerequisite modules or system libraries, or in Perl), are not
71+
covered by this policy unless they affect DBD::CSV, or DBD::CSV can
72+
be used to exploit vulnerabilities in them.
73+
74+
Security vulnerabilities in downstream software (any software that
75+
uses DBD::CSV, or plugins to it that are not included with the
76+
DBD::CSV distribution) are not covered by this policy.
77+
78+
## Supported Versions of DBD::CSV
79+
80+
The maintainer(s) will only commit to releasing security fixes for
81+
the latest version of DBD::CSV.
82+
83+
Note that the DBD::CSV project only supports major versions of Perl
84+
released in the past 5 years, even though DBD::CSV will run on
85+
older versions of Perl. If a security fix requires us to increase
86+
the minimum version of Perl that is supported, then we may do so.
87+
88+
# Installation and Usage Issues
89+
90+
The distribution metadata specifies minimum versions of
91+
prerequisites that are required for DBD::CSV to work. However, some
92+
of these prerequisites may have security vulnerabilities, and you
93+
should ensure that you are using up-to-date versions of these
94+
prerequisites.
95+
96+
Where security vulnerabilities are known, the metadata may indicate
97+
newer versions as recommended.
98+
99+
## Usage
100+
101+
Please see the software documentation for further information.

sandbox/genMETA.pl

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use 5.014001;
44
use warnings;
55

6-
our $VERSION = "1.20 - 20160520";
6+
our $VERSION = "1.21 - 20250113";
77

88
sub usage {
99
my $err = shift and select STDERR;
@@ -12,14 +12,14 @@ sub usage {
1212
} # usage
1313

1414
use Getopt::Long qw(:config bundling nopermute);
15-
my $opt_v = 0;
1615
GetOptions (
1716
"help|?" => sub { usage (0); },
1817
"V|version" => sub { say $0 =~ s{.*/}{}r, " [$VERSION]"; exit 0; },
1918

20-
"c|check!" => \my $check,
21-
"w|write:s" => \my $write,
22-
"v|verbose:1" => \$opt_v,
19+
"c|check!" => \ my $check,
20+
"w|write:s" => \ my $write,
21+
"u|update!" => \ my $update,
22+
"v|verbose:1" => \(my $opt_v = 0),
2323
) or usage (1);
2424

2525
use lib "sandbox";
@@ -31,6 +31,7 @@ sub usage {
3131

3232
$meta->quiet (defined $write);
3333
$meta->from_data (<DATA>);
34+
$meta->security_md ($update);
3435
$meta->gen_cpanfile ();
3536

3637
if ($check) {

sandbox/genMETA.pm

+62-11
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22

33
package genMETA;
44

5-
our $VERSION = "1.16-20240903";
5+
our $VERSION = "1.18-20250113";
66

77
use 5.014001;
88
use warnings;
99
use Carp;
1010

11-
use List::Util qw( first );
11+
use CPAN::Meta::Converter;
12+
use CPAN::Meta::Validator;
13+
use Data::Peek;
14+
use Date::Calc qw( Delta_Days );
1215
use Encode qw( encode decode );
16+
use File::Find;
17+
use JSON::PP;
18+
use List::Util qw( first );
19+
use Parse::CPAN::Meta;
20+
use Software::Security::Policy::Individual;
1321
use Term::ANSIColor qw(:constants);
14-
use Date::Calc qw( Delta_Days );
1522
use Test::CPAN::Meta::YAML::Version;
16-
use CPAN::Meta::Validator;
17-
use CPAN::Meta::Converter;
1823
use Test::More ();
19-
use Parse::CPAN::Meta;
20-
use File::Find;
21-
use YAML::Syck;
22-
use Data::Peek;
2324
use Text::Diff;
24-
use JSON::PP;
25+
use YAML::Syck;
2526

2627
sub new {
2728
my $package = shift;
@@ -576,7 +577,7 @@ sub gen_cpanfile {
576577
if (my $of = $jsn->{optional_features}) {
577578
foreach my $f (sort keys %$of) {
578579
my $fs = $of->{$f};
579-
say $fh qq/\nfeature "$f", "$fs->{description}" => sub {/;
580+
say $fh qq/\nfeature "$f", "$fs->{description}" => sub {/;#}
580581
say $fh _cpfd ($self, $fs, "", 1) =~ s/^(?=\S)/ /gmr;
581582
}
582583
}
@@ -593,4 +594,54 @@ sub gen_cpanfile {
593594
}
594595
} # gen_cpanfile
595596

597+
sub security_md {
598+
my ($self, $update) = @_;
599+
600+
my $sfn = "SECURITY.md";
601+
my $policy = Software::Security::Policy::Individual->new ({
602+
maintainer => $self->{h}{author}[0],
603+
program => $self->{name},
604+
timeframe => "10 days",
605+
url => $self->{h}{resources}{repository},
606+
perl_support_years => 5,
607+
});
608+
609+
my $smd = $policy->fulltext;
610+
611+
unless (-s $sfn) {
612+
open my $fh, ">:encoding(utf-8)", $sfn or die "$sfn: $! \n";
613+
print $fh $smd;
614+
close $fh;
615+
616+
if (open $fh, "<", "MANIFEST") {
617+
my @m = <$fh>;
618+
close $fh;
619+
unless (grep m/^$sfn(?:\s|$)/ => @m) {
620+
open $fh, ">>", "MANIFEST" or die "MANIFEST: $!\n";
621+
say $fh "$sfn\t\tGuide for reporting security issues";
622+
close $fh;
623+
}
624+
}
625+
say "$sfn added";
626+
}
627+
628+
open my $fh, "<:encoding(utf-8)", $sfn or die "$sfn: $!\n";
629+
my $old = do { local $/; <$fh> };
630+
close $fh;
631+
632+
$old eq $smd and return;
633+
634+
if ($update) {
635+
open my $fh, ">:encoding(utf-8)", $sfn or die "$sfn: $!\n";
636+
print $fh $smd;
637+
close $fh;
638+
say "$sfn updated";
639+
}
640+
else {
641+
say "$sfn required updates:";
642+
say diff \$old, \$smd;
643+
say "to apply, use $0 --check --update";
644+
}
645+
} # gen_security
646+
596647
1;

0 commit comments

Comments
 (0)