blib/lib/Lemonldap/NG/Manager/Conf/Tests.pm

filter: Statementstmt 59.4% 349 / 587 Branchbran 38.8% 178 / 458 Conditioncond 36.2% 105 / 290 MC/DCmcdc 14.6% 25 / 171 Subroutinesub 100% 91 / 91 Podpod 0.0% 0 / 1 totaltotal 46.8% 748 / 1598 CC 379 SCAR 32.0
CC
379
Cov
47%
__ANON__
128.2
__ANON__
111.3
__ANON__
102.7
CRAP 24.6
« blib/lib/Lemonldap/NG/Manager.pm ↑ Summary blib/lib/Lemonldap/NG/Manager/Build/OpenApi.pm »
1 package Lemonldap::NG::Manager::Conf::Tests;
2  
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use Lemonldap::NG::Common::Regexp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 13 ▶use Lemonldap::NG::Handler::Main;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 13 ▶use Lemonldap::NG::Common::Util qw(getSameSite);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 13 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 13 our $VERSION = '2.23.3';
12  
13 13 ▶use constant validPartnerName => qr/^[\w-]+$/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 ## @method hashref tests(hashref conf)
16 # Return a hash ref where keys are the names of the tests and values
17 # subroutines to execute.
18 #
19 # Subroutines can return one of the followings :
20 # - (1) : everything is OK
21 # - (1,message) : OK with a warning
22 # - (0,message) : NOK
23 # - (-1,message) : OK, but must be confirmed (ignored if confirm parameter is
24 # set)
25 #
26 # Those subroutines can also modify configuration.
27 #
28 # @param $conf Configuration to test
29 # @return hash ref where keys are the names of the tests and values
30 47 ▶sub tests {
Subroutine tests: called CC=1 SCAR=1.4
Pod undocumented
31 47 my $conf = shift;
32 return {
33  
34 # 1. CHECKS
35  
36 # Check if portal is in domain
37 47 ▶ portalIsInDomain => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
38  
39 # Looks like a sub, user knows what they are doing
40 47 ▶ if ( $conf->{portal} =~ /[\$\(&\|"']/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"portal"} =~ /[\$\(&\|"']/) 0 47 47
41 0 return 1;
42 }
43  
44 return (
45 1,
46 (
47 47 ▶ index( $conf->{portal}, $conf->{domain} ) > 0
Branch: 1 branch
BranchTrueFalseTotal
index($conf->{'portal'}, $conf->{'domain'}) > 0 ? : 47 0 47
48 ? ''
49 : "Portal seems not to be in the domain $conf->{domain}"
50 )
51 );
52 },
53  
54 # Check if portal URL is well formated
55 47 ▶ portalURL => sub {
Subroutine __ANON__: called CC=3 SCAR=12.5
56 47 my $url = $conf->{portal};
57  
58 # Looks like a sub, user knows what they are doing
59 47 ▶ if ( $url =~ /[\$\(&\|"']/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($url =~ /[\$\(&\|"']/) { } 0 47 47
60 0 return 1;
61 }
62 else {
63 return (
64 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
$url =~ m[/$] ? : 47 0 47
65 (
66 ( $url =~ m%/$% )
67 ? ''
68 : "Portal URL should end with a /"
69 )
70 );
71 }
72 },
73  
74 # Check if virtual hosts are in the domain
75 47 ▶ vhostInDomainOrCDA => sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
76 47 ▶ return 1 if ( $conf->{cda} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"cda"} 0 47 47
77 47 my @pb;
78 47 foreach my $vh ( keys %{ $conf->{locationRules} } ) {
79 144 ▶ push @pb, $vh unless ( index( $vh, $conf->{domain} ) >= 0 );
Branch: 1 branch
BranchTrueFalseTotal
unless (index($vh, $conf->{"domain"}) != -1) 3 141 144
80 }
81 return (
82 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
@pb ? : 3 44 47
83 (
84 @pb
85 ? 'Virtual hosts '
86 . join( ', ', @pb )
87 . " are not in $conf->{domain} and cross-domain-authentication is not set"
88 : undef
89 )
90 );
91 },
92  
93 # Check if automatically displayed menu applications have VH configuration
94 47 ▶ menuAutoDisplayedVhostsHaveConf => sub {
Subroutine __ANON__: called CC=11 SCAR=25.4
95 47 my @pb;
96  
97 # Known hosts: locationRules keys + every vhostAliases entry
98 my %known;
99 47 ▶ $known{ lc $_ } = 1 for keys %{ $conf->{locationRules} || {} };
Condition50%1/2
$conf->{'locationRules'} || {}
l!l
470
MC/DC0%0/1
$conf->{'locationRules'} || {}
$conf->{'locationRules'}
Truth table50%1/2
A
A= $conf->{'locationRules'}
Aresult
11
00
100 47 ▶ foreach my $vh ( keys %{ $conf->{vhostOptions} || {} } ) {
Condition100%2/2
$conf->{'vhostOptions'} || {}
l!l
452
MC/DC100%1/1
$conf->{'vhostOptions'} || {}
$conf->{'vhostOptions'}
Truth table100%2/2
A
A= $conf->{'vhostOptions'}
Aresult
11
00
101 22 my $aliases = $conf->{vhostOptions}->{$vh}->{vhostAliases};
102 22 ▶ next unless defined $aliases and length $aliases;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $aliases and length $aliases 22 0 22
Condition33%1/3
defined $aliases and length $aliases
!ll&&!rl&&r
2200
MC/DC0%0/2
defined $aliases and length $aliases
defined $aliases length $aliases
Truth table33%1/3
A and B
A= defined $aliasesB= length $aliases
ABresult
0X0
100
111
103 0 $known{ lc $_ } = 1 for split /\s+/, $aliases;
104 }
105  
106 # Walk applicationList recursively (categories may be nested)
107 47 my %entries;
108 my $walk;
109 203 ▶ $walk = sub {
Subroutine __ANON__: called CC=14 SCAR=28.9
110 203 my $node = shift;
111 203 ▶ return unless ref $node eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node eq "HASH" 0 203 203
112 203 foreach my $key ( keys %$node ) {
113 960 ▶ next if $key =~ /^(?:catname|type|options|order)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /^(?:catname|type|options|order)$/ 462 498 960
114 498 my $child = $node->{$key};
115 498 ▶ next unless ref $child eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $child eq "HASH" 0 498 498
116 498 ▶ if ( ( $child->{type} // '' ) eq 'category' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (($child->{'type'} // '') eq 'category') { } 156 342 498
elsif (($child->{'options'}{'display'} // '') eq 'auto') { } 241 101 342
Condition50%1/2
$child->{"type"} // ""
l!l
4980
MC/DC0%0/1
$child->{"type"} // ""
$child->{"type"}
Truth table50%1/2
A
A= $child->{"type"}
Aresult
11
00
117 156 $walk->($child);
118 }
119 ▶ elsif ( ( $child->{options}->{display} // '' ) eq 'auto' ) {
Condition50%1/2
$child->{"options"}{"display"} // ""
l!l
3420
MC/DC0%0/1
$child->{"options"}{"display"} // ""
$child->{"options"}{"display"}
Truth table50%1/2
A
A= $child->{"options"}{"display"}
Aresult
11
00
120 241 my $uri = $child->{options}->{uri};
121 241 ▶ next unless defined $uri and length $uri;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $uri and length $uri 0 241 241
Condition33%1/3
defined $uri and length $uri
!ll&&!rl&&r
00241
MC/DC0%0/2
defined $uri and length $uri
defined $uri length $uri
Truth table33%1/3
A and B
A= defined $uriB= length $uri
ABresult
0X0
100
111
122 241 my $u = URI->new($uri);
123 241 ▶ next unless $u->can('host');
Branch: 1 branch
BranchTrueFalseTotal
unless $u->can("host") 0 241 241
124 241 my $h = $u->host;
125 241 ▶ $entries{ lc $h } = 1 if defined $h and length $h;
Branch: 1 branch
BranchTrueFalseTotal
if defined $h and length $h 241 0 241
Condition33%1/3
defined $h and length $h
!ll&&!rl&&r
00241
MC/DC0%0/2
defined $h and length $h
defined $h length $h
Truth table33%1/3
A and B
A= defined $hB= length $h
ABresult
0X0
100
111
126 }
127 }
128 47 };
129 47 $walk->( $conf->{applicationList} );
130  
131 47 foreach ( sort keys %entries ) {
132 147 ▶ push @pb, $_ unless $known{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $known{$_} 11 136 147
133 }
134  
135 return (
136 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
@pb ? : 8 39 47
137 (
138 @pb
139 ? 'Menu applications '
140 . join( ', ', @pb )
141 . ' are automatically displayed but have no configuration'
142 : undef
143 )
144 );
145 },
146  
147 # Check if virtual host do not contain a port
148 47 ▶ vhostWithPort => sub {
Subroutine __ANON__: called CC=4 SCAR=14.3
149 47 my @pb;
150 47 foreach my $vh ( keys %{ $conf->{locationRules} } ) {
151 144 ▶ push @pb, $vh if ( $vh =~ /:/ );
Branch: 1 branch
BranchTrueFalseTotal
if $vh =~ /:/ 0 144 144
152 }
153 return @pb
154 47 ▶ ? (
Branch: 1 branch
BranchTrueFalseTotal
@pb ? : 0 47 47
155 0,
156 'Virtual hosts '
157 . join( ', ', @pb )
158 . ' contain a port, this is not allowed'
159 )
160 : 1;
161 },
162  
163 # Force vhost to be lowercase
164 47 ▶ vhostUpperCase => sub {
Subroutine __ANON__: called CC=4 SCAR=14.3
165 47 my @pb;
166 47 foreach my $vh ( keys %{ $conf->{locationRules} } ) {
167 144 ▶ push @pb, $vh if ( $vh ne lc $vh );
Branch: 1 branch
BranchTrueFalseTotal
if $vh ne lc $vh 0 144 144
168 }
169 return @pb
170 47 ▶ ? (
Branch: 1 branch
BranchTrueFalseTotal
@pb ? : 0 47 47
171 0,
172 'Virtual hosts ' . join( ', ', @pb ) . ' must be in lower case'
173 )
174 : 1;
175 },
176  
177 47 ▶ vhostNotAnAlias => sub {
Subroutine __ANON__: called CC=5 SCAR=16.5
178 47 my ( @pb, @aliases, @all_aliases );
179  
180 @aliases =
181 22 map { $conf->{vhostOptions}->{$_}->{vhostAliases} }
182 47 keys %{ $conf->{vhostOptions} };
183  
184 47 foreach my $alias (@aliases) {
185 22 push @all_aliases, split( /\s+/, $alias );
186 }
187  
188 47 foreach my $vh ( keys %{ $conf->{locationRules} } ) {
189 0 ▶ push @pb, $vh if ( grep { lc($_) eq lc($vh) } @all_aliases );
Branch: 1 branch
BranchTrueFalseTotal
if grep {lc $_ eq lc $vh;} @all_aliases 0 144 144
190 }
191 return @pb
192 47 ▶ ? ( 0, 'Virtual hosts ' . join( ', ', @pb ) . ' match an alias' )
Branch: 1 branch
BranchTrueFalseTotal
@pb ? : 0 47 47
193 : 1;
194 },
195  
196 # Check if "userDB" and "authentication" are consistent
197 47 ▶ authAndUserDBConsistency => sub {
Subroutine __ANON__: called CC=4 SCAR=15.8
198 47 foreach
199 my $type (qw(Facebook Google OpenID OpenIDConnect SAML WebID))
200 {
201 return ( 0,
202 "\"$type\" can not be used as user database without using \"$type\" for authentication"
203 )
204 if ( $conf->{userDB} =~ /$type/
205 282 ▶ and $conf->{authentication} !~ /$type/ );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"userDB"} =~ /$type/ and not $conf->{"authentication"} =~ /$type/ 0 282 282
Condition33%1/3
$conf->{"userDB"} =~ /$type/ and not $conf->{"authentication"} =~ /$type/
!ll&&!rl&&r
28200
MC/DC0%0/2
$conf->{"userDB"} =~ /$type/ and not $conf->{"authentication"} =~ /$type/
$conf->{"userDB"} =~ /$type/ not $conf->{"authentication"} =~ /$type/
Truth table33%1/3
A and not(B)
A= $conf->{"userDB"} =~ /$type/B= not $conf->{"authentication"} =~ /$type/
ABresult
0X0
100
111
206 }
207 47 return 1;
208 },
209  
210 47 ▶ checkSelfReferentialMacros => sub {
Subroutine __ANON__: called CC=4 SCAR=14.2
211 47 my @tmp;
212 47 foreach my $macro ( keys %{$conf->{macros}} ) {
213 47 my $code = $conf->{macros}->{$macro};
214 47 ▶ push @tmp, $macro if $code =~ /\$\Q$macro\E\b/;
Branch: 1 branch
BranchTrueFalseTotal
if $code =~ /\$\Q$macro\E\b/ 0 47 47
215 }
216 return (
217 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
@tmp ? : 0 47 47
218 (
219 @tmp
220 ? 'Macro definitions for "'
221 . join( ', ', @tmp )
222 . '" refer to themselves'
223 : ''
224 )
225 );
226 },
227  
228 # Check that OpenID macros exists
229 47 ▶ checkAttrAndMacros => sub {
Subroutine __ANON__: called CC=7 SCAR=20.1
230 47 my @tmp;
231 47 foreach my $k ( keys %$conf ) {
232 10333 ▶ if ( $k =~
Branch: 1 branch
BranchTrueFalseTotal
if ($k =~ /^(?:openIdSreg_(?:(?:(?:full|nick)nam|languag|postcod|timezon)e|country|gender|email|dob)|whatToTrace)$/) 83 10250 10333
233 /^(?:openIdSreg_(?:(?:(?:full|nick)nam|languag|postcod|timezon)e|country|gender|email|dob)|whatToTrace)$/
234 )
235 {
236 83 my $v = $conf->{$k};
237 83 $v =~ s/^$//;
238 83 ▶ next if ( $v =~ /^_/ );
Branch: 1 branch
BranchTrueFalseTotal
if $v =~ /^_/ 56 27 83
239 push @tmp,
240 $k
241 unless (
242 defined(
243 $conf->{exportedVars}->{$v}
244 27 ▶ or defined( $conf->{macros}->{$v} )
Branch: 1 branch
BranchTrueFalseTotal
unless defined($conf->{"exportedVars"}{$v} || defined $conf->{"macros"}{$v}) 0 27 27
Condition33%1/3
$conf->{'exportedVars'}{$v} || defined $conf->{'macros'}{$v}
l!l&&r!l&&!r
0027
MC/DC0%0/2
$conf->{'exportedVars'}{$v} || defined $conf->{'macros'}{$v}
$conf->{'exportedVars'}{$v} defined $conf->{'macros'}{$v}
Truth table33%1/3
A || B
A= $conf->{'exportedVars'}{$v}B= defined $conf->{'macros'}{$v}
ABresult
1X1
011
000
245 )
246 );
247 }
248 }
249 return (
250 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
@tmp ? : 0 47 47
251 (
252 @tmp
253 ? 'Values of parameter(s) "'
254 . join( ', ', @tmp )
255 . '" are not defined in exported attributes or macros'
256 : ''
257 )
258 );
259 },
260  
261 # Test that variables are exported if Google is used as UserDB
262 47 ▶ checkUserDBGoogleAXParams => sub {
Subroutine __ANON__: called CC=5 SCAR=24.5
263 47 my @tmp;
264 47 ▶ if ( $conf->{userDB} =~ /^Google$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"userDB"} =~ /^Google$/) 0 47 47
265 0 foreach my $k ( keys %{ $conf->{exportedVars} } ) {
266 0 my $v = $conf->{exportedVars}->{$k};
267 0 ▶ if ( $v !~ Lemonldap::NG::Common::Regexp::GOOGLEAXATTR() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($v =~ Lemonldap::NG::Common::Regexp::GOOGLEAXATTR()) 0 0 0
268 0 push @tmp, $v;
269 }
270 }
271 }
272 return (
273 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
@tmp ? : 0 47 47
274 (
275 @tmp
276 ? 'Values of parameter(s) "'
277 . join( ', ', @tmp )
278 . '" are not exported by Google'
279 : ''
280 )
281 );
282 },
283  
284 # Test that variables are exported if OpenID is used as UserDB
285 47 ▶ checkUserDBOpenIDParams => sub {
Subroutine __ANON__: called CC=5 SCAR=24.5
286 47 my @tmp;
287 47 ▶ if ( $conf->{userDB} =~ /^OpenID$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"userDB"} =~ /^OpenID$/) 0 47 47
288 0 foreach my $k ( keys %{ $conf->{exportedVars} } ) {
289 0 my $v = $conf->{exportedVars}->{$k};
290 0 ▶ if ( $v !~ Lemonldap::NG::Common::Regexp::OPENIDSREGATTR() )
Branch: 1 branch
BranchTrueFalseTotal
unless ($v =~ Lemonldap::NG::Common::Regexp::OPENIDSREGATTR()) 0 0 0
291 {
292 0 push @tmp, $v;
293 }
294 }
295 }
296 return (
297 47 ▶ 1,
Branch: 1 branch
BranchTrueFalseTotal
@tmp ? : 0 47 47
298 (
299 @tmp
300 ? 'Values of parameter(s) "'
301 . join( ', ', @tmp )
302 . '" are not exported by OpenID SREG'
303 : ''
304 )
305 );
306 },
307  
308 # Try to use Apache::Session module
309 47 ▶ testApacheSession => sub {
Subroutine __ANON__: called CC=13 SCAR=48.5
310 47 my ( $id, %h );
311 47 my $gc = Lemonldap::NG::Handler::Main->tsv->{sessionStorageModule};
312 return 1
313 if ( ( $gc and $gc eq $conf->{globalStorage} )
314 or $conf->{globalStorage} =~
315 47 ▶ /^Lemonldap::NG::Common::Apache::Session::/ );
Branch: 1 branch
BranchTrueFalseTotal
if $gc and $gc eq $conf->{"globalStorage"} or $conf->{"globalStorage"} =~ /^Lemonldap::NG::Common::Apache::Session::/ 47 0 47
Condition33%2/6
$gc and $gc eq $conf->{"globalStorage"} or $conf->{"globalStorage"} =~ /^Lemonldap::NG::Common::Apache::Session::/
l!l&&r!l&&!r
4700
$gc and $gc eq $conf->{"globalStorage"}
!ll&&!rl&&r
0047
MC/DC0%0/3
$gc and $gc eq $conf->{"globalStorage"} or $conf->{"globalStorage"} =~ /^Lemonldap::NG::Common::Apache::Session::/
$gc $gc eq $conf->{"globalStorage"} $conf->{"globalStorage"} =~ /^Lemonldap::NG::Common::Apache::Session::/
Truth table20%1/5
A and B or C
A= $gcB= $gc eq $conf->{"globalStorage"}C= $conf->{"globalStorage"} =~ /^Lemonldap::NG::Common::Apache::Session::/
ABCresult
11X1
0X11
1011
0X00
1000
316 0 eval "use $conf->{globalStorage}";
317 0 ▶ return ( -1, "Unknown package $conf->{globalStorage}" ) if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
318 0 eval {
319 tie %h, 'Lemonldap::NG::Common::Apache::Session', undef,
320 {
321 0 %{ $conf->{globalStorageOptions} },
322 backend => $conf->{globalStorage}
323 0 };
324 };
325 0 ▶ return ( -1, "Unable to create a session ($@)" )
Branch: 1 branch
BranchTrueFalseTotal
if $@ or not tied %h 0 0 0
Condition0%0/3
$@ or not tied %h
l!l&&r!l&&!r
000
MC/DC0%0/2
$@ or not tied %h
$@ not tied %h
Truth table0%0/3
A or not(B)
A= $@B= not tied %h
ABresult
1X1
011
000
326 if ( $@ or not tied(%h) );
327 0 eval {
328 0 $h{a} = 1;
329 0 ▶ $id = $h{_session_id} or return ( -1, 'No _session_id' );
Branch: 1 branch
BranchTrueFalseTotal
$id = $h{"_session_id"} or return -1, "No _session_id" 0 0 0
330 0 untie(%h);
331 tie %h, 'Lemonldap::NG::Common::Apache::Session', $id,
332 {
333 0 %{ $conf->{globalStorageOptions} },
334 backend => $conf->{globalStorage}
335 0 };
336 };
337 0 ▶ return ( -1, "Unable to insert data ($@)" ) if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
338 return ( -1, "Unable to recover data stored" )
339 0 ▶ unless ( $h{a} == 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless $h{"a"} == 1 0 0 0
340 0 eval { tied(%h)->delete; };
341 0 ▶ return ( -1, "Unable to delete session ($@)" ) if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
342 return ( -1,
343 'All sessions may be lost and you must restart all your web servers'
344 0 ▶ ) if ( $gc and $conf->{globalStorage} ne $gc );
Branch: 1 branch
BranchTrueFalseTotal
if $gc and $conf->{"globalStorage"} ne $gc 0 0 0
Condition0%0/3
$gc and $conf->{"globalStorage"} ne $gc
!ll&&!rl&&r
000
MC/DC0%0/2
$gc and $conf->{"globalStorage"} ne $gc
$gc $conf->{"globalStorage"} ne $gc
Truth table0%0/3
A and B
A= $gcB= $conf->{"globalStorage"} ne $gc
ABresult
0X0
100
111
345 0 return 1;
346 },
347  
348 # Warn if cookie name has changed
349 47 ▶ cookieNameChanged => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
350 47 my $cn = Lemonldap::NG::Handler::Main->tsv->{cookieName};
351 return (
352 1,
353 (
354 $cn
355 and $cn ne $conf->{cookieName}
356 47 ▶ ? 'Cookie name has changed, you must restart all your web servers'
Branch: 1 branch
BranchTrueFalseTotal
$cn ne $conf->{'cookieName'} ? : 0 47 47
Condition33%1/3
$cn && ($cn ne $conf->{'cookieName'} ? 'Cookie name has changed, you must restart all your web servers' : ())
!ll&&!rl&&r
0047
MC/DC0%0/2
$cn && ($cn ne $conf->{'cookieName'} ? 'Cookie name has changed, you must restart all your web servers' : ())
$cn ($cn ne $conf->{'cookieName'} ? 'Cookie name has changed, you must restart all your web servers' : ())
Truth table33%1/3
A && B
A= $cnB= ($cn ne $conf->{'cookieName'} ? 'Cookie name has changed, you must restart all your web servers' : ())
ABresult
0X0
100
111
357 : ()
358 )
359 );
360 },
361  
362 # Warn if cookie TTL is equal or lower than one hour
363 1 ▶ cookieTTL => sub {
Subroutine __ANON__: called CC=6 SCAR=34.1
364 1 ▶ return 1 unless ( defined $conf->{cookieExpiration} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"cookieExpiration"} 1 0 1
365 return ( 0, "Cookie TTL must be higher than one minute" )
366 unless ( $conf->{cookieExpiration} == 0
367 0 ▶ || $conf->{cookieExpiration} > 60 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"cookieExpiration"} == 0 or $conf->{"cookieExpiration"} > 60 0 0 0
Condition0%0/3
$conf->{"cookieExpiration"} == 0 or $conf->{"cookieExpiration"} > 60
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"cookieExpiration"} == 0 or $conf->{"cookieExpiration"} > 60
$conf->{"cookieExpiration"} == 0 $conf->{"cookieExpiration"} > 60
Truth table0%0/3
A or B
A= $conf->{"cookieExpiration"} == 0B= $conf->{"cookieExpiration"} > 60
ABresult
1X1
011
000
368 return ( 1, "Cookie TTL should be higher or equal than one hour" )
369 unless ( $conf->{cookieExpiration} >= 3600
370 0 ▶ || $conf->{cookieExpiration} == 0 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"cookieExpiration"} >= 3600 or $conf->{"cookieExpiration"} == 0 0 0 0
Condition0%0/3
$conf->{"cookieExpiration"} >= 3600 or $conf->{"cookieExpiration"} == 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"cookieExpiration"} >= 3600 or $conf->{"cookieExpiration"} == 0
$conf->{"cookieExpiration"} >= 3600 $conf->{"cookieExpiration"} == 0
Truth table0%0/3
A or B
A= $conf->{"cookieExpiration"} >= 3600B= $conf->{"cookieExpiration"} == 0
ABresult
1X1
011
000
371 0 return 1;
372 },
373  
374 # Warn if session timeout is lower than 10 minutes
375 47 ▶ sessionTimeout => sub {
Subroutine __ANON__: called CC=4 SCAR=16.1
376 47 ▶ return 1 unless ( defined $conf->{timeout} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"timeout"} 0 47 47
377 return ( -1, "Session timeout should be higher than ten minutes" )
378 unless ( $conf->{timeout} > 600
379 47 ▶ || $conf->{timeout} == 0 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"timeout"} > 600 or $conf->{"timeout"} == 0 0 47 47
Condition33%1/3
$conf->{"timeout"} > 600 or $conf->{"timeout"} == 0
l!l&&r!l&&!r
4700
MC/DC0%0/2
$conf->{"timeout"} > 600 or $conf->{"timeout"} == 0
$conf->{"timeout"} > 600 $conf->{"timeout"} == 0
Truth table33%1/3
A or B
A= $conf->{"timeout"} > 600B= $conf->{"timeout"} == 0
ABresult
1X1
011
000
380 47 return 1;
381 },
382  
383 # Error if session Activity Timeout is equal or lower than one minute
384 47 ▶ sessionTimeoutActivity => sub {
Subroutine __ANON__: called CC=4 SCAR=16.1
385 47 ▶ return 1 unless ( defined $conf->{timeoutActivity} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"timeoutActivity"} 0 47 47
386 return ( 0,
387 "Session activity timeout must be higher or equal than one minute"
388 )
389 unless ( $conf->{timeoutActivity} > 59
390 47 ▶ || $conf->{timeoutActivity} == 0 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"timeoutActivity"} > 59 or $conf->{"timeoutActivity"} == 0 0 47 47
Condition33%1/3
$conf->{"timeoutActivity"} > 59 or $conf->{"timeoutActivity"} == 0
l!l&&r!l&&!r
0470
MC/DC0%0/2
$conf->{"timeoutActivity"} > 59 or $conf->{"timeoutActivity"} == 0
$conf->{"timeoutActivity"} > 59 $conf->{"timeoutActivity"} == 0
Truth table33%1/3
A or B
A= $conf->{"timeoutActivity"} > 59B= $conf->{"timeoutActivity"} == 0
ABresult
1X1
011
000
391 47 return 1;
392 },
393  
394 # Error if activity timeout interval is higher than session activity timeout
395 47 ▶ timeoutActivityInterval => sub {
Subroutine __ANON__: called CC=4 SCAR=14.9
396 47 ▶ return 1 unless ( defined $conf->{timeoutActivityInterval} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"timeoutActivityInterval"} 13 34 47
397 return ( 0,
398 "Activity timeout interval must be lower than session activity timeout"
399 )
400 if ( $conf->{timeoutActivity}
401 and $conf->{timeoutActivity} <=
402 34 ▶ $conf->{timeoutActivityInterval} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"timeoutActivity"} and $conf->{"timeoutActivity"} <= $conf->{"timeoutActivityInterval"} 0 34 34
Condition33%1/3
$conf->{"timeoutActivity"} and $conf->{"timeoutActivity"} <= $conf->{"timeoutActivityInterval"}
!ll&&!rl&&r
3400
MC/DC0%0/2
$conf->{"timeoutActivity"} and $conf->{"timeoutActivity"} <= $conf->{"timeoutActivityInterval"}
$conf->{"timeoutActivity"} $conf->{"timeoutActivity"} <= $conf->{"timeoutActivityInterval"}
Truth table33%1/3
A and B
A= $conf->{"timeoutActivity"}B= $conf->{"timeoutActivity"} <= $conf->{"timeoutActivityInterval"}
ABresult
0X0
100
111
403 34 return 1;
404 },
405  
406 # Warn if manager seems to be unprotected
407 47 ▶ managerProtection => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
408 return (
409 1,
410 (
411 47 ▶ $conf->{cfgAuthor} eq 'anonymous'
Branch: 1 branch
BranchTrueFalseTotal
$conf->{'cfgAuthor'} eq 'anonymous' ? : 15 32 47
412 ? 'Your manager seems to be unprotected'
413 : ''
414 )
415 );
416 },
417  
418 # Test support of timeouts for LDAPS connections
419 47 ▶ ldapsNoTimeout => sub {
Subroutine __ANON__: called CC=6 SCAR=28.1
420  
421 # Skip test if no SMTP configuration
422 47 ▶ return (1) unless ( $conf->{ldapServer} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"ldapServer"} 42 5 47
423  
424 5 ▶ if ( $conf->{ldapServer} =~ /ldaps:/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"ldapServer"} =~ /ldaps:/) 0 5 5
425  
426 0 ▶ if ( eval "require IO::Socket::SSL; require IO::Socket::IP;" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (eval "require IO::Socket::SSL; require IO::Socket::IP;") 0 0 0
427 0 ▶ if ( IO::Socket::SSL->isa('IO::Socket::IP') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("IO::Socket::SSL"->isa("IO::Socket::IP")) 0 0 0
428 0 ▶ unless ( eval { IO::Socket::IP->VERSION(0.31) } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { "IO::Socket::IP"->VERSION("0.31") } }) 0 0 0
429 0 return ( 1,
430 "Your version of IO::Socket::IP is too old to enforce "
431 . "connection timeouts on ldaps:// URLs. Use ldap+tls:// instead"
432 );
433 }
434 }
435 }
436 }
437 5 return (1);
438 },
439  
440 # Test SMTP connection and authentication (warning only)
441 47 ▶ smtpConfiguration => sub {
Subroutine __ANON__: called CC=3 SCAR=19.2
442  
443 # Skip test if no SMTP configuration
444 47 ▶ return 1 unless ( $conf->{SMTPServer} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"SMTPServer"} 47 0 47
445  
446 # Use SMTP
447 0 eval "use Lemonldap::NG::Common::EmailTransport";
448 0 ▶ return ( 1, "Could not load Lemonldap::NG::Common::EmailTransport" )
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
449 if ($@);
450  
451 0 return Lemonldap::NG::Common::EmailTransport->configTest($conf);
452 },
453  
454 # SAML entity ID must be unique
455 47 ▶ samlIDPEntityIdUniqueness => sub {
Subroutine __ANON__: called CC=6 SCAR=31.7
456 return 1
457 unless ( $conf->{samlIDPMetaDataXML}
458 47 ▶ and %{ $conf->{samlIDPMetaDataXML} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"samlIDPMetaDataXML"} and %{$conf->{"samlIDPMetaDataXML"};} 47 0 47
Condition66%2/3
$conf->{"samlIDPMetaDataXML"} and %{$conf->{"samlIDPMetaDataXML"};}
!ll&&!rl&&r
3440
MC/DC0%0/2
$conf->{"samlIDPMetaDataXML"} and %{$conf->{"samlIDPMetaDataXML"};}
$conf->{"samlIDPMetaDataXML"} %{$conf->{"samlIDPMetaDataXML"};}
Truth table66%2/3
A and B
A= $conf->{"samlIDPMetaDataXML"}B= %{$conf->{"samlIDPMetaDataXML"};}
ABresult
0X0
100
111
459 0 my @msg;
460 0 my $res = 1;
461 0 my %entityIds;
462 0 foreach my $idpId ( keys %{ $conf->{samlIDPMetaDataXML} } ) {
463 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"samlIDPMetaDataXML"}{$idpId}{"samlIDPMetaDataXML"} =~ /entityID=(['"])(.+?)\1/is) 0 0 0
464 $conf->{samlIDPMetaDataXML}->{$idpId}->{samlIDPMetaDataXML}
465 =~ /entityID=(['"])(.+?)\1/si )
466 {
467 0 my $eid = $2;
468 0 ▶ if ( defined $entityIds{$eid} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $entityIds{$eid}) 0 0 0
469 0 push @msg,
470 "$idpId and $entityIds{$eid} have the same SAML EntityID";
471 0 $res = 0;
472 0 next;
473 }
474 0 $entityIds{$eid} = $idpId;
475 }
476 }
477 0 return ( $res, join( ', ', @msg ) );
478 },
479 47 ▶ samlSPEntityIdUniqueness => sub {
Subroutine __ANON__: called CC=6 SCAR=18.2
480 return 1
481 unless ( $conf->{samlSPMetaDataXML}
482 47 ▶ and %{ $conf->{samlSPMetaDataXML} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"samlSPMetaDataXML"} and %{$conf->{"samlSPMetaDataXML"};} 37 10 47
Condition100%3/3
$conf->{"samlSPMetaDataXML"} and %{$conf->{"samlSPMetaDataXML"};}
!ll&&!rl&&r
32510
MC/DC100%2/2
$conf->{"samlSPMetaDataXML"} and %{$conf->{"samlSPMetaDataXML"};}
$conf->{"samlSPMetaDataXML"} %{$conf->{"samlSPMetaDataXML"};}
Truth table100%3/3
A and B
A= $conf->{"samlSPMetaDataXML"}B= %{$conf->{"samlSPMetaDataXML"};}
ABresult
0X0
100
111
483 10 my @msg;
484 10 my $res = 1;
485 10 my %entityIds;
486 10 foreach my $spId ( keys %{ $conf->{samlSPMetaDataXML} } ) {
487 14 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"samlSPMetaDataXML"}{$spId}{"samlSPMetaDataXML"} =~ /entityID=(['"])(.+?)\1/is) 8 6 14
488 $conf->{samlSPMetaDataXML}->{$spId}->{samlSPMetaDataXML} =~
489 /entityID=(['"])(.+?)\1/si )
490 {
491 8 my $eid = $2;
492 8 ▶ if ( defined $entityIds{$eid} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $entityIds{$eid}) 0 8 8
493 0 push @msg,
494 "$spId and $entityIds{$eid} have the same SAML EntityID";
495 0 $res = 0;
496 0 next;
497 }
498 8 $entityIds{$eid} = $spId;
499 }
500 }
501 10 return ( $res, join( ', ', @msg ) );
502 },
503  
504 # Test if SAML private and public keys signature keys are set
505 47 ▶ samlSecretKeys => sub {
Subroutine __ANON__: called CC=6 SCAR=34.4
506 47 ▶ return 1 unless ( $conf->{issuerDBSAMLActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"issuerDBSAMLActivation"} 47 0 47
507  
508 0 ▶ if ( $conf->{samlServicePrivateKeySig}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'samlServicePrivateKeySig'} and $conf->{'samlServicePublicKeySig'}) { } 0 0 0
Condition0%0/3
$conf->{"samlServicePrivateKeySig"} and $conf->{"samlServicePublicKeySig"}
!ll&&!rl&&r
000
MC/DC0%0/2
$conf->{"samlServicePrivateKeySig"} and $conf->{"samlServicePublicKeySig"}
$conf->{"samlServicePrivateKeySig"} $conf->{"samlServicePublicKeySig"}
Truth table0%0/3
A and B
A= $conf->{"samlServicePrivateKeySig"}B= $conf->{"samlServicePublicKeySig"}
ABresult
0X0
100
111
509 && $conf->{samlServicePublicKeySig} )
510 {
511 0 return 1;
512 }
513 else {
514 my ($key) = split( /\s*,\s*/,
515 0 ▶ ( $conf->{samlServiceSignatureKey} || "" ) );
Condition0%0/2
$conf->{'samlServiceSignatureKey'} || ''
l!l
00
MC/DC0%0/1
$conf->{'samlServiceSignatureKey'} || ''
$conf->{'samlServiceSignatureKey'}
Truth table0%0/2
A
A= $conf->{'samlServiceSignatureKey'}
Aresult
11
00
516 0 ▶ if ( $conf->{keys}->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"keys"}{$key}) 0 0 0
517 0 return 1;
518 }
519 }
520  
521 0 return ( 0,
522 'SAML service private and public keys signature must be set' );
523 },
524  
525 1 ▶ samlSignatureUnsupportedAlg => sub {
Subroutine __ANON__: called CC=11 SCAR=47.1
526 1 ▶ return 1 unless $conf->{issuerDBSAMLActivation};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"issuerDBSAMLActivation"} 1 0 1
527 0 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
unless eval "use Lasso; Lasso::check_version( 2, 5, 1, Lasso::Constants::CHECK_VERSION_NUMERIC) ? 0 : 1" 0 0 0
528 unless eval
529 'use Lasso; Lasso::check_version( 2, 5, 1, Lasso::Constants::CHECK_VERSION_NUMERIC) ? 0 : 1';
530  
531 0 my $allsha1 = 1;
532 undef $allsha1
533 0 ▶ unless $conf->{samlServiceSignatureMethod} eq "RSA_SHA1";
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"samlServiceSignatureMethod"} eq "RSA_SHA1" 0 0 0
534  
535 0 for my $idp ( keys %{ $conf->{samlIDPMetaDataOptions} } ) {
536 0 ▶ if ( $conf->{samlIDPMetaDataOptions}->{$idp}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"samlIDPMetaDataOptions"}{$idp}{"samlIDPMetaDataOptionsSignatureMethod"}) 0 0 0
537 ->{samlIDPMetaDataOptionsSignatureMethod} )
538 {
539 0 ▶ if ( $conf->{samlIDPMetaDataOptions}->{$idp}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"samlIDPMetaDataOptions"}{$idp}{"samlIDPMetaDataOptionsSignatureMethod"} ne "RSA_SHA1") 0 0 0
540 ->{samlIDPMetaDataOptionsSignatureMethod} ne
541 "RSA_SHA1" )
542 {
543 0 undef $allsha1;
544 0 last;
545 }
546 }
547 }
548 0 for my $sp ( keys %{ $conf->{samlSPMetaDataOptions} } ) {
549 0 ▶ if ( $conf->{samlSPMetaDataOptions}->{$sp}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"samlSPMetaDataOptions"}{$sp}{"samlSPMetaDataOptionsSignatureMethod"}) 0 0 0
550 ->{samlSPMetaDataOptionsSignatureMethod} )
551 {
552 0 ▶ if ( $conf->{samlSPMetaDataOptions}->{$sp}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"samlSPMetaDataOptions"}{$sp}{"samlSPMetaDataOptionsSignatureMethod"} ne "RSA_SHA1") 0 0 0
553 ->{samlSPMetaDataOptionsSignatureMethod} ne "RSA_SHA1" )
554 {
555 0 undef $allsha1;
556 0 last;
557 }
558 }
559 }
560 0 ▶ return $allsha1
Branch: 1 branch
BranchTrueFalseTotal
$allsha1 ? : 0 0 0
561 ? 1
562 : (
563 0,
564 "Algorithms other than SHA1 are only supported on Lasso>=2.5.1"
565 );
566 },
567  
568 47 ▶ samlIssuerNotEnabled => sub {
Subroutine __ANON__: called CC=4 SCAR=14.0
569 47 ▶ if ( keys %{ $conf->{samlSPMetaDataXML} || {} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$conf->{"samlSPMetaDataXML"} or {};}) 10 37 47
Condition100%2/2
$conf->{'samlSPMetaDataXML'} || {}
l!l
1532
MC/DC100%1/1
$conf->{'samlSPMetaDataXML'} || {}
$conf->{'samlSPMetaDataXML'}
Truth table100%2/2
A
A= $conf->{'samlSPMetaDataXML'}
Aresult
11
00
570 10 ▶ if ( $conf->{issuerDBSAMLActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'issuerDBSAMLActivation'}) { } 0 10 10
571 0 return 1;
572 }
573 else {
574 10 return ( 1,
575 "SAML service providers require enabling the SAML Issuer in General Parameters"
576 );
577 }
578 }
579 37 return 1;
580 },
581  
582 # Try to parse combination with declared modules
583 47 ▶ checkCombinations => sub {
Subroutine __ANON__: called CC=8 SCAR=21.7
584 47 ▶ return 1 unless ( $conf->{authentication} eq 'Combination' );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"authentication"} eq "Combination" 46 1 47
585 1 require Lemonldap::NG::Common::Combination::Parser;
586 return ( 0, 'No module declared for combination' )
587 1 ▶ unless ( $conf->{combModules} and %{ $conf->{combModules} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"combModules"} and %{$conf->{"combModules"};} 0 1 1
Condition33%1/3
$conf->{"combModules"} and %{$conf->{"combModules"};}
!ll&&!rl&&r
001
MC/DC0%0/2
$conf->{"combModules"} and %{$conf->{"combModules"};}
$conf->{"combModules"} %{$conf->{"combModules"};}
Truth table33%1/3
A and B
A= $conf->{"combModules"}B= %{$conf->{"combModules"};}
ABresult
0X0
100
111
588 1 my $moduleList;
589 1 foreach my $md ( keys %{ $conf->{combModules} } ) {
590 2 my $entry = $conf->{combModules}->{$md};
591 $moduleList->{$md} = (
592 $entry->{for} == 2 ? [ undef, {} ]
593 2 ▶ : $entry->{for} == 1 ? [ {}, undef ]
Branch: 2 branches
BranchTrueFalseTotal
$entry->{'for'} == 2 ? : 0 2 2
$entry->{'for'} == 1 ? : 0 2 2
594 : [ {}, {} ]
595 );
596 }
597 1 eval {
598 Lemonldap::NG::Common::Combination::Parser->parse( $moduleList,
599 1 $conf->{combination} );
600 };
601 1 ▶ return ( 0, $@ ) if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
602  
603 # Return
604 1 return 1;
605 },
606  
607 # Check Combination parameters
608 47 ▶ combinationParameters => sub {
Subroutine __ANON__: called CC=4 SCAR=14.2
609 47 ▶ return 1 unless ( $conf->{authentication} eq "Combination" );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"authentication"} eq "Combination" 46 1 47
610 return ( 0, "Combination rule must be defined" )
611 1 ▶ unless ( $conf->{combination} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"combination"} 0 1 1
612 return ( 0, 'userDB must be set to "Same" to enable Combination' )
613 1 ▶ unless ( $conf->{userDB} eq "Same" );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"userDB"} eq "Same" 0 1 1
614 1 return 1;
615 },
616  
617 # Warn if 2F dependencies seem missing
618 47 ▶ sfaDependencies => sub {
Subroutine __ANON__: called CC=13 SCAR=46.3
619 47 my $ok = 0;
620 47 foreach (qw(totp yubikey)) {
621 94 ▶ $ok ||= $conf->{ $_ . '2fActivation' };
Condition33%1/3
$ok ||= $$conf{$_ . '2fActivation'}
l!l&&r!l&&!r
0094
MC/DC0%0/2
$ok ||= $$conf{$_ . '2fActivation'}
$ok $$conf{$_ . '2fActivation'}
Truth table33%1/3
A ||= B
A= $okB= $$conf{$_ . '2fActivation'}
ABresult
1X1
011
000
622 94 ▶ last if ($ok);
Branch: 1 branch
BranchTrueFalseTotal
if $ok 0 94 94
623 }
624 47 ▶ return 1 unless ($ok);
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 47 0 47
625  
626 # Use TOTP
627 0 ▶ if ( $conf->{totp2fActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"totp2fActivation"}) 0 0 0
628 0 eval "use Convert::Base32";
629 0 ▶ return ( 1,
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
630 "Convert::Base32 module is required to enable TOTP" )
631 if ($@);
632 }
633  
634 # Use WebAuthn
635 0 ▶ if ( $conf->{webauthn2fActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"webauthn2fActivation"}) 0 0 0
636 0 eval "use Authen::WebAuthn";
637 0 ▶ return ( 1,
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
638 "Authen::WebAuthn module is required to enable WebAuthn" )
639 if ($@);
640 }
641  
642 # WebAuthn requires https://
643 0 ▶ if ( $conf->{webauthn2fActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"webauthn2fActivation"}) 0 0 0
644 0 my $portal_uri = URI->new( $conf->{portal} );
645 0 ▶ unless ( $portal_uri->scheme eq "https" ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($portal_uri->scheme eq "https") 0 0 0
646 0 return ( 1, "WebAuthn requires HTTPS" );
647 }
648 }
649  
650 # Use Yubikey
651 0 ▶ if ( $conf->{yubikey2fActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"yubikey2fActivation"}) 0 0 0
652 0 eval "use Auth::Yubikey_WebClient";
653 0 ▶ return ( 1,
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
654 "Auth::Yubikey_WebClient module is required to enable Yubikey"
655 ) if ($@);
656 }
657 0 return 1;
658 },
659  
660 # Warn if TOTP not 6 or 8 digits long
661 47 ▶ totp2fDigits => sub {
Subroutine __ANON__: called CC=5 SCAR=29.7
662 47 ▶ return 1 unless ( $conf->{totp2fActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"totp2fActivation"} 47 0 47
663 0 ▶ return 1 unless ( defined $conf->{totp2fDigits} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"totp2fDigits"} 0 0 0
664 return (
665 1,
666 ( (
667 $conf->{totp2fDigits} == 6
668 0 ▶ or $conf->{totp2fDigits} == 8
Branch: 1 branch
BranchTrueFalseTotal
$conf->{'totp2fDigits'} == 6 || $conf->{'totp2fDigits'} == 8 ? : 0 0 0
Condition0%0/3
$conf->{"totp2fDigits"} == 6 or $conf->{"totp2fDigits"} == 8
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"totp2fDigits"} == 6 or $conf->{"totp2fDigits"} == 8
$conf->{"totp2fDigits"} == 6 $conf->{"totp2fDigits"} == 8
Truth table0%0/3
A or B
A= $conf->{"totp2fDigits"} == 6B= $conf->{"totp2fDigits"} == 8
ABresult
1X1
011
000
669 )
670 ? ''
671 : 'TOTP should be 6 or 8 digits long'
672 )
673 );
674 },
675  
676 # Test TOTP params
677 47 ▶ totp2fParams => sub {
Subroutine __ANON__: called CC=4 SCAR=25.0
678 47 ▶ return 1 unless ( $conf->{totp2fActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"totp2fActivation"} 47 0 47
679 return ( 0, 'TOTP range must be defined' )
680 0 ▶ unless ( $conf->{totp2fRange} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"totp2fRange"} 0 0 0
681 return ( 1, "TOTP interval should be higher than 10s" )
682 0 ▶ unless ( $conf->{totp2fInterval} > 10 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"totp2fInterval"} > 10 0 0 0
683 0 return 1;
684 },
685  
686 # Error if Yubikey client ID and secret key are missing
687 # Warn if Yubikey public ID size is not 12 digits long
688 47 ▶ yubikey2fParams => sub {
Subroutine __ANON__: called CC=5 SCAR=29.7
689 47 ▶ return 1 unless ( $conf->{yubikey2fActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"yubikey2fActivation"} 47 0 47
690 return ( 0, "Yubikey client ID and secret key must be set" )
691 unless ( defined $conf->{yubikey2fSecretKey}
692 0 ▶ && defined $conf->{yubikey2fClientID} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"yubikey2fSecretKey"} and defined $conf->{"yubikey2fClientID"} 0 0 0
Condition0%0/3
defined $conf->{"yubikey2fSecretKey"} and defined $conf->{"yubikey2fClientID"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $conf->{"yubikey2fSecretKey"} and defined $conf->{"yubikey2fClientID"}
defined $conf->{"yubikey2fSecretKey"} defined $conf->{"yubikey2fClientID"}
Truth table0%0/3
A and B
A= defined $conf->{"yubikey2fSecretKey"}B= defined $conf->{"yubikey2fClientID"}
ABresult
0X0
100
111
693 return (
694 1,
695 (
696 0 ▶ ( $conf->{yubikey2fPublicIDSize} == 12 )
Branch: 1 branch
BranchTrueFalseTotal
$conf->{'yubikey2fPublicIDSize'} == 12 ? : 0 0 0
697 ? ''
698 : 'Yubikey public ID size should be 12 digits long'
699 )
700 );
701 },
702  
703 # Error if REST 2F verify URL is missing
704 47 ▶ rest2fVerifyUrl => sub {
Subroutine __ANON__: called CC=3 SCAR=18.4
705 47 ▶ return 1 unless ( $conf->{rest2fActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"rest2fActivation"} 47 0 47
706 return ( 0, "REST 2F Verify URL must be set" )
707 0 ▶ unless ( defined $conf->{rest2fVerifyUrl} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"rest2fVerifyUrl"} 0 0 0
708  
709 # Return
710 0 return 1;
711 },
712  
713 # Warn if 2FA is required without a registrable 2F module enabled
714 47 ▶ required2FA => sub {
Subroutine __ANON__: called CC=6 SCAR=34.3
715 47 ▶ return 1 unless ( $conf->{sfRequired} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"sfRequired"} 47 0 47
716  
717 0 my $msg = '';
718 0 my $ok = 0;
719 0 foreach (qw(u totp yubikey webauthn)) {
720 $ok ||= $conf->{ $_ . '2fActivation' }
721 0 ▶ && $conf->{ $_ . '2fSelfRegistration' };
Condition0%0/6
$ok ||= $$conf{$_ . '2fActivation'} && $$conf{$_ . '2fSelfRegistration'}
l!l&&r!l&&!r
000
$$conf{$_ . '2fActivation'} && $$conf{$_ . '2fSelfRegistration'}
!ll&&!rl&&r
000
MC/DC0%0/3
$ok ||= $$conf{$_ . '2fActivation'} && $$conf{$_ . '2fSelfRegistration'}
$ok $$conf{$_ . '2fActivation'} $$conf{$_ . '2fSelfRegistration'}
Truth table0%0/4
A ||= B && C
A= $okB= $$conf{$_ . '2fActivation'}C= $$conf{$_ . '2fSelfRegistration'}
ABCresult
1XX1
0111
00X0
0100
722 0 ▶ last if ($ok);
Branch: 1 branch
BranchTrueFalseTotal
if $ok 0 0 0
723 }
724 0 return ( 1, $msg );
725 },
726  
727 # Error if external 2F Send or Validate command is missing
728 47 ▶ ext2fCommands => sub {
Subroutine __ANON__: called CC=5 SCAR=30.0
729 47 ▶ return 1 unless ( $conf->{ext2fActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"ext2fActivation"} 47 0 47
730 return ( 0, "External 2F Send command must be set" )
731 0 ▶ unless ( defined $conf->{ext2FSendCommand} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"ext2FSendCommand"} 0 0 0
732 0 ▶ unless ( defined $conf->{ext2fCodeActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $conf->{"ext2fCodeActivation"}) 0 0 0
733 return ( 0, "External 2F Validate command must be set" )
734 0 ▶ unless ( defined $conf->{ext2FValidateCommand} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"ext2FValidateCommand"} 0 0 0
735 }
736 0 return 1;
737 },
738  
739 # Warn if XSRF token TTL is higher than 30s
740 47 ▶ formTimeout => sub {
Subroutine __ANON__: called CC=4 SCAR=14.2
741 47 ▶ return 1 unless ( defined $conf->{formTimeout} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"formTimeout"} 13 34 47
742 return ( 0, "XSRF form token TTL must be higher than 30s" )
743 34 ▶ unless ( $conf->{formTimeout} > 30 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"formTimeout"} > 30 0 34 34
744 return ( 1, "XSRF form token TTL should not be higher than 2mn" )
745 34 ▶ if ( $conf->{formTimeout} > 120 );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"formTimeout"} > 120 0 34 34
746 34 return 1;
747 },
748  
749 # Warn if issuers token TTL is higher than 30s
750 47 ▶ issuersTimeout => sub {
Subroutine __ANON__: called CC=4 SCAR=14.2
751 47 ▶ return 1 unless ( defined $conf->{issuersTimeout} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"issuersTimeout"} 15 32 47
752 return ( 0, "Issuers token TTL must be higher than 30s" )
753 32 ▶ unless ( $conf->{issuersTimeout} > 30 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"issuersTimeout"} > 30 0 32 32
754  
755 # because of issue #2186
756 return ( 1, "Issuers token TTL should not be higher than 10mn" )
757 32 ▶ if ( $conf->{issuersTimeout} > 600 );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"issuersTimeout"} > 600 0 32 32
758 32 return 1;
759 },
760  
761 # Warn if number of password reset retries is null
762 47 ▶ passwordResetRetries => sub {
Subroutine __ANON__: called CC=3 SCAR=11.7
763 47 ▶ return 1 unless ( $conf->{portalDisplayResetPassword} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"portalDisplayResetPassword"} 45 2 47
764 return ( 1, "Number of reset password retries should not be null" )
765 2 ▶ unless ( $conf->{passwordResetAllowedRetries} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"passwordResetAllowedRetries"} 2 0 2
766 0 return 1;
767 },
768  
769 # Warn if ldapPpolicyControl is used with AD (#2007)
770 47 ▶ ppolicyAd => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
771 return ( 1,
772 "LDAP password policy control should be disabled when using AD authentication"
773 )
774 if ( $conf->{ldapPpolicyControl}
775 47 ▶ and $conf->{authentication} eq "AD" );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"ldapPpolicyControl"} and $conf->{"authentication"} eq "AD" 0 47 47
Condition33%1/3
$conf->{"ldapPpolicyControl"} and $conf->{"authentication"} eq "AD"
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"ldapPpolicyControl"} and $conf->{"authentication"} eq "AD"
$conf->{"ldapPpolicyControl"} $conf->{"authentication"} eq "AD"
Truth table33%1/3
A and B
A= $conf->{"ldapPpolicyControl"}B= $conf->{"authentication"} eq "AD"
ABresult
0X0
100
111
776 47 return 1;
777 },
778  
779 # Warn if bruteForceProtection enabled without History
780 47 ▶ bruteForceProtection => sub {
Subroutine __ANON__: called CC=10 SCAR=36.1
781 my @lockTimes =
782 256 sort { $a <=> $b }
783 160 map { abs(s/\D//r) }
784 160 ▶ grep { /\d+/ }
Condition100%2/2
$conf->{'bruteForceProtectionLockTimes'} || ''
l!l
3215
MC/DC100%1/1
$conf->{'bruteForceProtectionLockTimes'} || ''
$conf->{'bruteForceProtectionLockTimes'}
Truth table100%2/2
A
A= $conf->{'bruteForceProtectionLockTimes'}
Aresult
11
00
785 47 split /\s*,\s*/, $conf->{bruteForceProtectionLockTimes} || '';
786 47 ▶ $conf->{bruteForceProtectionLockTimes} = join ', ', @lockTimes
Branch: 1 branch
BranchTrueFalseTotal
if scalar @lockTimes 32 15 47
787 if scalar @lockTimes;
788 47 ▶ return 1 unless ( $conf->{bruteForceProtection} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"bruteForceProtection"} 47 0 47
789 return ( 0,
790 '"History" plugin is required to enable "BruteForceProtection" plugin'
791 0 ▶ ) unless ( $conf->{loginHistoryEnabled} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"loginHistoryEnabled"} 0 0 0
792 return ( 0,
793 'Number of failed logins must be higher than 1 to enable "BruteForceProtection" plugin'
794 0 ▶ ) unless ( $conf->{failedLoginNumber} > 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"failedLoginNumber"} > 1 0 0 0
795 return ( 0,
796 'Number of allowed failed logins must be higher than 0 to enable "BruteForceProtection" plugin'
797 0 ▶ ) unless ( $conf->{bruteForceProtectionMaxFailed} > 0 );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"bruteForceProtectionMaxFailed"} > 0 0 0 0
798 return ( 0,
799 'Number of failed logins history must be higher or equal than allowed failed logins plus lock time values'
800 )
801 if ( $conf->{bruteForceProtectionIncrementalTempo}
802 && $conf->{failedLoginNumber} <
803 0 ▶ $conf->{bruteForceProtectionMaxFailed} + scalar @lockTimes );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"bruteForceProtectionIncrementalTempo"} and $conf->{"failedLoginNumber"} < $conf->{"bruteForceProtectionMaxFailed"} + scalar(@lockTimes) 0 0 0
Condition0%0/3
$conf->{"bruteForceProtectionIncrementalTempo"} and $conf->{"failedLoginNumber"} < $conf->{"bruteForceProtectionMaxFailed"} + scalar(@lockTimes)
!ll&&!rl&&r
000
MC/DC0%0/2
$conf->{"bruteForceProtectionIncrementalTempo"} and $conf->{"failedLoginNumber"} < $conf->{"bruteForceProtectionMaxFailed"} + scalar(@lockTimes)
$conf->{"bruteForceProtectionIncrementalTempo"} $conf->{"failedLoginNumber"} < $conf->{"bruteForceProtectionMaxFailed"} + scalar(@lockTimes)
Truth table0%0/3
A and B
A= $conf->{"bruteForceProtectionIncrementalTempo"}B= $conf->{"failedLoginNumber"} < $conf->{"bruteForceProtectionMaxFailed"} + scalar(@lockTimes)
ABresult
0X0
100
111
804 return ( 0,
805 'Number of failed logins history must be higher or equal than allowed failed logins'
806 )
807 unless ( $conf->{failedLoginNumber} >=
808 0 ▶ $conf->{bruteForceProtectionMaxFailed} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"failedLoginNumber"} >= $conf->{"bruteForceProtectionMaxFailed"} 0 0 0
809 0 return 1;
810 },
811  
812 # Warn if Mailrest plugin is enabled without Token or Captcha
813 47 ▶ checkMailResetSecurity => sub {
Subroutine __ANON__: called CC=4 SCAR=16.1
814 47 ▶ return 1 unless ( $conf->{portalDisplayResetPassword} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"portalDisplayResetPassword"} 45 2 47
815 return ( -1,
816 '"passwordMailReset" plugin is enabled without CSRF Token neither Captcha required'
817 )
818 unless ( $conf->{requireToken}
819 2 ▶ or $conf->{captcha_mail_enabled} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"requireToken"} or $conf->{"captcha_mail_enabled"} 2 0 2
Condition33%1/3
$conf->{"requireToken"} or $conf->{"captcha_mail_enabled"}
l!l&&r!l&&!r
002
MC/DC0%0/2
$conf->{"requireToken"} or $conf->{"captcha_mail_enabled"}
$conf->{"requireToken"} $conf->{"captcha_mail_enabled"}
Truth table33%1/3
A or B
A= $conf->{"requireToken"}B= $conf->{"captcha_mail_enabled"}
ABresult
1X1
011
000
820 0 return 1;
821 },
822  
823 # Warn if Impersonation and ContextSwitching are simultaneously enabled
824 47 ▶ impersonation => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
825 return ( 1,
826 "Impersonation and ContextSwitching are simultaneously enabled"
827 )
828 if ( $conf->{impersonationRule}
829 47 ▶ and $conf->{contextSwitchingRule} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"impersonationRule"} and $conf->{"contextSwitchingRule"} 0 47 47
Condition33%1/3
$conf->{"impersonationRule"} and $conf->{"contextSwitchingRule"}
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"impersonationRule"} and $conf->{"contextSwitchingRule"}
$conf->{"impersonationRule"} $conf->{"contextSwitchingRule"}
Truth table33%1/3
A and B
A= $conf->{"impersonationRule"}B= $conf->{"contextSwitchingRule"}
ABresult
0X0
100
111
830 47 return 1;
831 },
832  
833 # Warn if persistent storage is disabled with 2FA, History, OIDCConsents, Notifications or BruteForce protection
834 47 ▶ persistentStorage => sub {
Subroutine __ANON__: called CC=8 SCAR=40.3
835 47 ▶ return 1 unless ( $conf->{disablePersistentStorage} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"disablePersistentStorage"} 47 0 47
836 return ( 1, "2FA enabled WITHOUT persistent session storage" )
837 if ( $conf->{totp2fActivation}
838 0 ▶ || $conf->{yubikey2fActivation} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"totp2fActivation"} or $conf->{"yubikey2fActivation"} 0 0 0
Condition0%0/3
$conf->{"totp2fActivation"} or $conf->{"yubikey2fActivation"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"totp2fActivation"} or $conf->{"yubikey2fActivation"}
$conf->{"totp2fActivation"} $conf->{"yubikey2fActivation"}
Truth table0%0/3
A or B
A= $conf->{"totp2fActivation"}B= $conf->{"yubikey2fActivation"}
ABresult
1X1
011
000
839 return ( 1,
840 "History plugin enabled WITHOUT persistent session storage" )
841 0 ▶ if ( $conf->{loginHistoryEnabled} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"loginHistoryEnabled"} 0 0 0
842 return ( 1,
843 "OIDC consents enabled WITHOUT persistent session storage" )
844 0 ▶ if ( $conf->{portalDisplayOidcConsents} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"portalDisplayOidcConsents"} 0 0 0
845 return ( 1,
846 "Notifications enabled WITHOUT persistent session storage" )
847 0 ▶ if ( $conf->{notification} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"notification"} 0 0 0
848 return ( 1,
849 "BruteForceProtection plugin enabled WITHOUT persistent session storage"
850 0 ▶ ) if ( $conf->{bruteForceProtection} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"bruteForceProtection"} 0 0 0
851 0 return 1;
852 },
853  
854 # Warn if XML dependencies seem missing
855 47 ▶ xmlDependencies => sub {
Subroutine __ANON__: called CC=4 SCAR=25.8
856 47 ▶ return 1 unless ( $conf->{oldNotifFormat} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oldNotifFormat"} 47 0 47
857 0 eval "use XML::LibXML";
858 0 ▶ return ( 1,
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
859 "XML::LibXML module is required to enable old format notifications"
860 ) if ($@);
861 0 eval "use XML::LibXSLT";
862 0 ▶ return ( 1,
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
863 "XML::LibXSLT module is required to enable old format notifications"
864 ) if ($@);
865 0 return 1;
866 },
867  
868 # Warn if CertificateResetByMail dependencies seem missing
869 47 ▶ certResetByMailDependencies => sub {
Subroutine __ANON__: called CC=4 SCAR=25.5
870 47 ▶ return 1 unless ( $conf->{portalDisplayCertificateResetByMail} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"portalDisplayCertificateResetByMail"} 47 0 47
871 return ( 0,
872 "LDAP RegisterDB is required to enable CertificateResetByMail plugin"
873 0 ▶ ) unless ( $conf->{registerDB} eq 'LDAP' );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"registerDB"} eq "LDAP" 0 0 0
874 0 eval "use DateTime::Format::RFC3339";
875 0 ▶ return ( 1,
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
876 "DateTime::Format::RFC3339 module is required to enable CertificateResetByMail plugin"
877 ) if ($@);
878 0 return 1;
879 },
880  
881 # OIDC redirect URI must not be empty
882 47 ▶ oidcRPRedirectURINotEmpty => sub {
Subroutine __ANON__: called CC=5 SCAR=16.6
883 return 1
884 unless ( $conf->{oidcRPMetaDataOptions}
885 47 ▶ and %{ $conf->{oidcRPMetaDataOptions} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};} 43 4 47
Condition100%3/3
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
!ll&&!rl&&r
31124
MC/DC100%2/2
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
$conf->{"oidcRPMetaDataOptions"} %{$conf->{"oidcRPMetaDataOptions"};}
Truth table100%3/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= %{$conf->{"oidcRPMetaDataOptions"};}
ABresult
0X0
100
111
886 4 my @msg;
887 4 my $res = 1;
888 4 foreach my $oidcRpId ( keys %{ $conf->{oidcRPMetaDataOptions} } ) {
889 6 ▶ unless ( $conf->{oidcRPMetaDataOptions}->{$oidcRpId}
Branch: 1 branch
BranchTrueFalseTotal
unless ($conf->{"oidcRPMetaDataOptions"}{$oidcRpId}{"oidcRPMetaDataOptionsRedirectUris"}) 0 6 6
890 ->{oidcRPMetaDataOptionsRedirectUris} )
891 {
892 0 push @msg,
893 "$oidcRpId: OIDC Relying Party has no redirect URI defined";
894 0 $res = 0;
895 0 next;
896 }
897 }
898 4 return ( $res, join( ', ', @msg ) );
899 },
900  
901 # OIDC public RP should implement PKCE
902 47 ▶ oidcRPpublicClientWithPKCE => sub {
Subroutine __ANON__: called CC=6 SCAR=19.1
903 return 1
904 unless ( $conf->{oidcRPMetaDataOptions}
905 47 ▶ and %{ $conf->{oidcRPMetaDataOptions} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};} 43 4 47
Condition100%3/3
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
!ll&&!rl&&r
31124
MC/DC100%2/2
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
$conf->{"oidcRPMetaDataOptions"} %{$conf->{"oidcRPMetaDataOptions"};}
Truth table100%3/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= %{$conf->{"oidcRPMetaDataOptions"};}
ABresult
0X0
100
111
906 4 my @msg;
907 4 foreach my $oidcRpId ( keys %{ $conf->{oidcRPMetaDataOptions} } ) {
908 6 ▶ if ( $conf->{oidcRPMetaDataOptions}->{$oidcRpId}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"oidcRPMetaDataOptions"}{$oidcRpId}{"oidcRPMetaDataOptionsPublic"}) 0 6 6
909 ->{oidcRPMetaDataOptionsPublic} )
910 {
911 push @msg,
912 "$oidcRpId: requiring PKCE is recommended for public OIDC Relying Parties"
913 unless $conf->{oidcRPMetaDataOptions}->{$oidcRpId}
914 0 ▶ ->{oidcRPMetaDataOptionsRequirePKCE};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"}{$oidcRpId}{"oidcRPMetaDataOptionsRequirePKCE"} 0 0 0
915 0 next;
916 }
917 }
918 4 return ( 1, join( ', ', @msg ) );
919 },
920  
921 # Test if OIDC private and public keys signature keys are set
922 47 ▶ oidcSecretKeys => sub {
Subroutine __ANON__: called CC=6 SCAR=34.4
923 47 ▶ return 1 unless ( $conf->{issuerDBOpenIDConnectActivation} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"issuerDBOpenIDConnectActivation"} 47 0 47
924  
925 0 ▶ if ( $conf->{oidcServicePrivateKeySig}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'oidcServicePrivateKeySig'} and $conf->{'oidcServicePublicKeySig'}) { } 0 0 0
Condition0%0/3
$conf->{"oidcServicePrivateKeySig"} and $conf->{"oidcServicePublicKeySig"}
!ll&&!rl&&r
000
MC/DC0%0/2
$conf->{"oidcServicePrivateKeySig"} and $conf->{"oidcServicePublicKeySig"}
$conf->{"oidcServicePrivateKeySig"} $conf->{"oidcServicePublicKeySig"}
Truth table0%0/3
A and B
A= $conf->{"oidcServicePrivateKeySig"}B= $conf->{"oidcServicePublicKeySig"}
ABresult
0X0
100
111
926 && $conf->{oidcServicePublicKeySig} )
927 {
928 0 return 1;
929 }
930 else {
931 my ($key) = split( /\s*,\s*/,
932 0 ▶ ( $conf->{oidcServiceSignatureKey} || "" ) );
Condition0%0/2
$conf->{'oidcServiceSignatureKey'} || ''
l!l
00
MC/DC0%0/1
$conf->{'oidcServiceSignatureKey'} || ''
$conf->{'oidcServiceSignatureKey'}
Truth table0%0/2
A
A= $conf->{'oidcServiceSignatureKey'}
Aresult
11
00
933 0 ▶ if ( $conf->{keys}->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"keys"}{$key}) 0 0 0
934 0 return 1;
935 }
936 }
937  
938 0 return ( 1,
939 'OIDC service private and public keys signature should be set'
940 );
941 },
942  
943 # RS* OIDC algs require a signing key
944 1 ▶ oidcRPNeedRSAKey => sub {
Subroutine __ANON__: called CC=10 SCAR=44.7
945 return 1
946 unless ( $conf->{oidcRPMetaDataOptions}
947 0 ▶ and %{ $conf->{oidcRPMetaDataOptions} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};} 1 0 1
Condition33%1/3
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
!ll&&!rl&&r
100
MC/DC0%0/2
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
$conf->{"oidcRPMetaDataOptions"} %{$conf->{"oidcRPMetaDataOptions"};}
Truth table33%1/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= %{$conf->{"oidcRPMetaDataOptions"};}
ABresult
0X0
100
111
948 my @usingRSA =
949 grep {
950 $conf->{oidcRPMetaDataOptions}->{$_}
951 ->{oidcRPMetaDataOptionsIDTokenSignAlg}
952 and $conf->{oidcRPMetaDataOptions}->{$_}
953 0 ▶ ->{oidcRPMetaDataOptionsIDTokenSignAlg} =~ /^RS/
Condition0%0/3
$conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} && $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} =~ /^RS/
!ll&&!rl&&r
000
MC/DC0%0/2
$conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} && $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} =~ /^RS/
$conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} =~ /^RS/
Truth table0%0/3
A && B
A= $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'}B= $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsIDTokenSignAlg'} =~ /^RS/
ABresult
0X0
100
111
954 0 } keys %{ $conf->{oidcRPMetaDataOptions} }, grep {
955 $conf->{oidcRPMetaDataOptions}->{$_}
956 ->{oidcRPMetaDataOptionsAccessTokenSignAlg}
957 and $conf->{oidcRPMetaDataOptions}->{$_}
958 ->{oidcRPMetaDataOptionsAccessTokenSignAlg} =~ /^RS/
959 and $conf->{oidcRPMetaDataOptions}->{$_}
960 ->{oidcRPMetaDataOptionsAccessTokenJWT}
961 0 ▶ } keys %{ $conf->{oidcRPMetaDataOptions} };
Condition0%0/6
$conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenSignAlg'} && $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenSignAlg'} =~ /^RS/ && $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenJWT'}
!ll&&!rl&&r
000
$conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsAccessTokenSignAlg"} and $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsAccessTokenSignAlg"} =~ /^RS/
!ll&&!rl&&r
000
MC/DC0%0/3
$conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenSignAlg'} && $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenSignAlg'} =~ /^RS/ && $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenJWT'}
$conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsAccessTokenSignAlg"} $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsAccessTokenSignAlg"} =~ /^RS/ $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenJWT'}
Truth table0%0/4
A and B && C
A= $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsAccessTokenSignAlg"}B= $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsAccessTokenSignAlg"} =~ /^RS/C= $conf->{'oidcRPMetaDataOptions'}{$_}{'oidcRPMetaDataOptionsAccessTokenJWT'}
ABCresult
0XX0
10X0
1100
1111
962  
963 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (@usingRSA and not $conf->{"oidcServicePrivateKeySig"} || %{$conf->{"keys"} or {};}) 0 0 0
Condition0%0/6
@usingRSA and not $conf->{"oidcServicePrivateKeySig"} || %{$conf->{"keys"} or {};}
!ll&&!rl&&r
000
$conf->{'oidcServicePrivateKeySig'} || %{$conf->{'keys'} or {};}
l!l&&r!l&&!r
000
MC/DC0%0/3
@usingRSA and not $conf->{"oidcServicePrivateKeySig"} || %{$conf->{"keys"} or {};}
@usingRSA $conf->{'oidcServicePrivateKeySig'} %{$conf->{'keys'} or {};}
Truth table0%0/4
A and not(B || C)
A= @usingRSAB= $conf->{'oidcServicePrivateKeySig'}C= %{$conf->{'keys'} or {};}
ABCresult
0XX0
11X0
1010
1001
964 @usingRSA
965 and not( $conf->{oidcServicePrivateKeySig}
966 0 ▶ or %{ $conf->{keys} || {} } )
Condition0%0/2
$conf->{'keys'} || {}
l!l
00
MC/DC0%0/1
$conf->{'keys'} || {}
$conf->{'keys'}
Truth table0%0/2
A
A= $conf->{'keys'}
Aresult
11
00
967 )
968 {
969 0 my $msg =
970 join( ", ", @usingRSA )
971 . ": using RS-type encryption, but no RSA key is defined in global OIDC configuration";
972 0 return ( 0, $msg );
973 }
974 0 return 1;
975 },
976  
977 # Public OIDC clients require a public key algorithm
978 47 ▶ oidcRPPublicNeedPubAlg => sub {
Subroutine __ANON__: called CC=9 SCAR=24.8
979 return 1
980 unless ( $conf->{oidcRPMetaDataOptions}
981 47 ▶ and %{ $conf->{oidcRPMetaDataOptions} || {} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"} or {};} 43 4 47
Condition80%4/5
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"} or {};}
!ll&&!rl&&r
31124
$conf->{'oidcRPMetaDataOptions'} || {}
l!l
160
MC/DC100%2/2
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"} or {};}
$conf->{"oidcRPMetaDataOptions"} %{$conf->{"oidcRPMetaDataOptions"} or {};}
MC/DC0%0/1
$conf->{'oidcRPMetaDataOptions'} || {}
$conf->{'oidcRPMetaDataOptions'}
Truth table100%3/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= %{$conf->{"oidcRPMetaDataOptions"} or {};}
ABresult
0X0
100
111
Truth table50%1/2
A
A= $conf->{'oidcRPMetaDataOptions'}
Aresult
11
00
982 4 my @clients;
983 4 ▶ for ( keys %{ $conf->{oidcRPMetaDataOptions} || {} } ) {
Condition50%1/2
$conf->{'oidcRPMetaDataOptions'} || {}
l!l
40
MC/DC0%0/1
$conf->{'oidcRPMetaDataOptions'} || {}
$conf->{'oidcRPMetaDataOptions'}
Truth table50%1/2
A
A= $conf->{'oidcRPMetaDataOptions'}
Aresult
11
00
984 6 ▶ if ( $conf->{oidcRPMetaDataOptions}->{$_}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsPublic"} and $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsIDTokenSignAlg"} =~ /^HS/) 0 6 6
Condition33%1/3
$conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsPublic"} and $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsIDTokenSignAlg"} =~ /^HS/
!ll&&!rl&&r
600
MC/DC0%0/2
$conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsPublic"} and $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsIDTokenSignAlg"} =~ /^HS/
$conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsPublic"} $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsIDTokenSignAlg"} =~ /^HS/
Truth table33%1/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsPublic"}B= $conf->{"oidcRPMetaDataOptions"}{$_}{"oidcRPMetaDataOptionsIDTokenSignAlg"} =~ /^HS/
ABresult
0X0
100
111
985 ->{oidcRPMetaDataOptionsPublic}
986 and $conf->{oidcRPMetaDataOptions}->{$_}
987 ->{oidcRPMetaDataOptionsIDTokenSignAlg} =~ /^HS/ )
988 {
989 0 push @clients, $_;
990 }
991 }
992 4 ▶ if (@clients) {
Branch: 1 branch
BranchTrueFalseTotal
if (@clients) { } 0 4 4
993 0 my $msg =
994 join( ", ", @clients )
995 . ": public clients should use a public key algorithm"
996 . " for ID token signature";
997 0 return 1, $msg;
998 }
999 else {
1000 4 return 1;
1001 }
1002 },
1003  
1004 # OIDC RP Client ID must exist and be unique
1005 47 ▶ oidcRPClientIdUniqueness => sub {
Subroutine __ANON__: called CC=6 SCAR=19.4
1006 return 1
1007 unless ( $conf->{oidcRPMetaDataOptions}
1008 47 ▶ and %{ $conf->{oidcRPMetaDataOptions} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};} 43 4 47
Condition100%3/3
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
!ll&&!rl&&r
31124
MC/DC100%2/2
$conf->{"oidcRPMetaDataOptions"} and %{$conf->{"oidcRPMetaDataOptions"};}
$conf->{"oidcRPMetaDataOptions"} %{$conf->{"oidcRPMetaDataOptions"};}
Truth table100%3/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= %{$conf->{"oidcRPMetaDataOptions"};}
ABresult
0X0
100
111
1009 4 my @msg;
1010 4 my $res = 1;
1011 4 my %clientIds;
1012 4 foreach
1013 4 my $clientConfKey ( keys %{ $conf->{oidcRPMetaDataOptions} } )
1014 {
1015 my $clientId =
1016 $conf->{oidcRPMetaDataOptions}->{$clientConfKey}
1017 6 ->{oidcRPMetaDataOptionsClientID};
1018 6 ▶ unless ($clientId) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($clientId) 0 6 6
1019 0 push @msg,
1020 "$clientConfKey: OIDC Relying Party has no Client ID";
1021 0 $res = 0;
1022 0 next;
1023 }
1024  
1025 6 ▶ if ( defined $clientIds{$clientId} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $clientIds{$clientId}) 0 6 6
1026 0 push @msg,
1027 "$clientConfKey and $clientIds{$clientId} have the same Client ID";
1028 0 $res = 0;
1029 0 next;
1030 }
1031 6 $clientIds{$clientId} = $clientConfKey;
1032 }
1033 4 return ( $res, join( ', ', @msg ) );
1034 },
1035  
1036 47 ▶ oidcIssuerNotEnabled => sub {
Subroutine __ANON__: called CC=4 SCAR=14.0
1037 47 ▶ if ( keys %{ $conf->{oidcRPMetaDataOptions} || {} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$conf->{"oidcRPMetaDataOptions"} or {};}) 4 43 47
Condition100%2/2
$conf->{'oidcRPMetaDataOptions'} || {}
l!l
1631
MC/DC100%1/1
$conf->{'oidcRPMetaDataOptions'} || {}
$conf->{'oidcRPMetaDataOptions'}
Truth table100%2/2
A
A= $conf->{'oidcRPMetaDataOptions'}
Aresult
11
00
1038 4 ▶ if ( $conf->{issuerDBOpenIDConnectActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'issuerDBOpenIDConnectActivation'}) { } 0 4 4
1039 0 return 1;
1040 }
1041 else {
1042 4 return ( 1,
1043 "OIDC relying parties require enabling the OpenID Connect Issuer in General Parameters"
1044 );
1045 }
1046 }
1047 43 return 1;
1048 },
1049  
1050 # CAS APP URL must be defined and unique
1051 47 ▶ casAppHostnameUniqueness => sub {
Subroutine __ANON__: called CC=8 SCAR=21.1
1052 return 1
1053 unless ( $conf->{casAppMetaDataOptions}
1054 47 ▶ and %{ $conf->{casAppMetaDataOptions} } );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"casAppMetaDataOptions"} and %{$conf->{"casAppMetaDataOptions"};} 42 5 47
Condition100%3/3
$conf->{"casAppMetaDataOptions"} and %{$conf->{"casAppMetaDataOptions"};}
!ll&&!rl&&r
4115
MC/DC100%2/2
$conf->{"casAppMetaDataOptions"} and %{$conf->{"casAppMetaDataOptions"};}
$conf->{"casAppMetaDataOptions"} %{$conf->{"casAppMetaDataOptions"};}
Truth table100%3/3
A and B
A= $conf->{"casAppMetaDataOptions"}B= %{$conf->{"casAppMetaDataOptions"};}
ABresult
0X0
100
111
1055 5 my @msg;
1056 5 my $res = 1;
1057 5 my %casUrl;
1058 5 foreach my $casConfKey ( keys %{ $conf->{casAppMetaDataOptions} } )
1059 {
1060 8 for my $appUrl (
1061 split(
1062 /\s+/,
1063 $conf->{casAppMetaDataOptions}->{$casConfKey}
1064 ->{casAppMetaDataOptionsService}
1065 )
1066 )
1067 {
1068 9 ▶ $appUrl ||= "";
Condition50%1/2
$appUrl ||= ""
l!l
90
MC/DC0%0/1
$appUrl ||= ""
$appUrl
Truth table50%1/2
A
A= $appUrl
Aresult
11
00
1069 9 my ($appHost) = $appUrl =~ m#^(https?://[^/]+)(/.*)?$#;
1070 9 ▶ unless ($appHost) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($appHost) 1 8 9
1071 1 push @msg,
1072 "$casConfKey: CAS Application has no Service URL";
1073 1 $res = 0;
1074 1 next;
1075 }
1076  
1077 8 ▶ if ( defined $casUrl{$appUrl} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $casUrl{$appUrl}) 0 8 8
1078 0 push @msg,
1079 "$casConfKey and $casUrl{$appUrl} have the same Service URL";
1080 0 $res = 0;
1081 0 next;
1082 }
1083 8 $casUrl{$appUrl} = $casConfKey;
1084 }
1085 }
1086 5 return ( $res, join( ', ', @msg ) );
1087 },
1088  
1089 47 ▶ casIssuerNotEnabled => sub {
Subroutine __ANON__: called CC=4 SCAR=14.0
1090 47 ▶ if ( keys %{ $conf->{casAppMetaDataOptions} || {} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$conf->{"casAppMetaDataOptions"} or {};}) 5 42 47
Condition100%2/2
$conf->{'casAppMetaDataOptions'} || {}
l!l
641
MC/DC100%1/1
$conf->{'casAppMetaDataOptions'} || {}
$conf->{'casAppMetaDataOptions'}
Truth table100%2/2
A
A= $conf->{'casAppMetaDataOptions'}
Aresult
11
00
1091 5 ▶ if ( $conf->{issuerDBCASActivation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'issuerDBCASActivation'}) { } 0 5 5
1092 0 return 1;
1093 }
1094 else {
1095 5 return ( 1,
1096 "CAS applications require enabling the CAS Issuer in General Parameters"
1097 );
1098 }
1099 }
1100 42 return 1;
1101 },
1102  
1103 # Relying Party / Service Provider / CAS Application names must
1104 # contain only word characters (letters, digits, underscore)
1105 47 ▶ spNameNoWhitespace => sub {
Subroutine __ANON__: called CC=11 SCAR=25.6
1106 47 my @msg;
1107 47 ▶ foreach my $rpId ( keys %{ $conf->{oidcRPMetaDataOptions} || {} } )
Condition100%2/2
$conf->{'oidcRPMetaDataOptions'} || {}
l!l
1631
MC/DC100%1/1
$conf->{'oidcRPMetaDataOptions'} || {}
$conf->{'oidcRPMetaDataOptions'}
Truth table100%2/2
A
A= $conf->{'oidcRPMetaDataOptions'}
Aresult
11
00
1108 {
1109 6 ▶ if ( $rpId !~ validPartnerName ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($rpId =~ /^[\w-]+$/) 0 6 6
1110 0 push @msg,
1111 "OIDC Relying Party name '$rpId' must contain only word characters (letters, digits, underscore)";
1112 }
1113 }
1114 47 ▶ foreach my $spId ( keys %{ $conf->{samlSPMetaDataXML} || {} } ) {
Condition100%2/2
$conf->{'samlSPMetaDataXML'} || {}
l!l
1532
MC/DC100%1/1
$conf->{'samlSPMetaDataXML'} || {}
$conf->{'samlSPMetaDataXML'}
Truth table100%2/2
A
A= $conf->{'samlSPMetaDataXML'}
Aresult
11
00
1115 14 ▶ if ( $spId !~ validPartnerName ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($spId =~ /^[\w-]+$/) 0 14 14
1116 0 push @msg,
1117 "SAML Service Provider name '$spId' must contain only word characters (letters, digits, underscore)";
1118 }
1119 }
1120 47 ▶ foreach my $casId ( keys %{ $conf->{casAppMetaDataOptions} || {} } )
Condition100%2/2
$conf->{'casAppMetaDataOptions'} || {}
l!l
641
MC/DC100%1/1
$conf->{'casAppMetaDataOptions'} || {}
$conf->{'casAppMetaDataOptions'}
Truth table100%2/2
A
A= $conf->{'casAppMetaDataOptions'}
Aresult
11
00
1121 {
1122 8 ▶ if ( $casId !~ validPartnerName ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($casId =~ /^[\w-]+$/) 0 8 8
1123 0 push @msg,
1124 "CAS Application name '$casId' must contain only word characters (letters, digits, underscore)";
1125 }
1126 }
1127 47 ▶ return @msg ? ( 0, join( ', ', @msg ) ) : 1;
Branch: 1 branch
BranchTrueFalseTotal
@msg ? : 0 47 47
1128 },
1129  
1130 # Identity Provider / OpenID Provider / CAS Server names must
1131 # contain only word characters (letters, digits, underscore)
1132 47 ▶ idpNameNoWhitespace => sub {
Subroutine __ANON__: called CC=11 SCAR=31.4
1133 47 my @msg;
1134 47 ▶ foreach my $idpId ( keys %{ $conf->{samlIDPMetaDataXML} || {} } ) {
Condition100%2/2
$conf->{'samlIDPMetaDataXML'} || {}
l!l
407
MC/DC100%1/1
$conf->{'samlIDPMetaDataXML'} || {}
$conf->{'samlIDPMetaDataXML'}
Truth table100%2/2
A
A= $conf->{'samlIDPMetaDataXML'}
Aresult
11
00
1135 0 ▶ if ( $idpId !~ validPartnerName ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($idpId =~ /^[\w-]+$/) 0 0 0
1136 0 push @msg,
1137 "SAML Identity Provider name '$idpId' must contain only word characters (letters, digits, underscore)";
1138 }
1139 }
1140 47 ▶ foreach my $opId ( keys %{ $conf->{oidcOPMetaDataOptions} || {} } )
Condition100%2/2
$conf->{'oidcOPMetaDataOptions'} || {}
l!l
245
MC/DC100%1/1
$conf->{'oidcOPMetaDataOptions'} || {}
$conf->{'oidcOPMetaDataOptions'}
Truth table100%2/2
A
A= $conf->{'oidcOPMetaDataOptions'}
Aresult
11
00
1141 {
1142 0 ▶ if ( $opId !~ validPartnerName ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($opId =~ /^[\w-]+$/) 0 0 0
1143 0 push @msg,
1144 "OIDC OpenID Provider name '$opId' must contain only word characters (letters, digits, underscore)";
1145 }
1146 }
1147 47 foreach
1148 47 ▶ my $casSrvId ( keys %{ $conf->{casSrvMetaDataOptions} || {} } )
Condition100%2/2
$conf->{'casSrvMetaDataOptions'} || {}
l!l
146
MC/DC100%1/1
$conf->{'casSrvMetaDataOptions'} || {}
$conf->{'casSrvMetaDataOptions'}
Truth table100%2/2
A
A= $conf->{'casSrvMetaDataOptions'}
Aresult
11
00
1149 {
1150 0 ▶ if ( $casSrvId !~ validPartnerName ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($casSrvId =~ /^[\w-]+$/) 0 0 0
1151 0 push @msg,
1152 "CAS Server name '$casSrvId' must contain only word characters (letters, digits, underscore)";
1153 }
1154 }
1155 47 ▶ return @msg ? ( 0, join( ', ', @msg ) ) : 1;
Branch: 1 branch
BranchTrueFalseTotal
@msg ? : 0 47 47
1156 },
1157  
1158 # Notification system required with removed SF notification
1159 47 ▶ sfRemovedNotification => sub {
Subroutine __ANON__: called CC=4 SCAR=25.0
1160 47 ▶ return 1 unless ( $conf->{sfRemovedMsgRule} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"sfRemovedMsgRule"} 47 0 47
1161 return ( 1,
1162 'Notification system must be enabled to display a notification if a SF is removed'
1163 )
1164 if ( $conf->{sfRemovedUseNotif}
1165 0 ▶ and not $conf->{notification} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"sfRemovedUseNotif"} and not $conf->{"notification"} 0 0 0
Condition0%0/3
$conf->{"sfRemovedUseNotif"} and not $conf->{"notification"}
!ll&&!rl&&r
000
MC/DC0%0/2
$conf->{"sfRemovedUseNotif"} and not $conf->{"notification"}
$conf->{"sfRemovedUseNotif"} not $conf->{"notification"}
Truth table0%0/3
A and not(B)
A= $conf->{"sfRemovedUseNotif"}B= not $conf->{"notification"}
ABresult
0X0
100
111
1166 0 return 1;
1167 },
1168  
1169 # noAjaxHook and krbByJs are incompatible (#2237)
1170 47 ▶ noAjaxHookwithKrb => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
1171 return ( 1,
1172 'noAjaxHook is not compatible with'
1173 . ' AJAX Kerberos authentication' )
1174 47 ▶ if ( $conf->{noAjaxHook} and $conf->{krbByJs} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"noAjaxHook"} and $conf->{"krbByJs"} 0 47 47
Condition33%1/3
$conf->{"noAjaxHook"} and $conf->{"krbByJs"}
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"noAjaxHook"} and $conf->{"krbByJs"}
$conf->{"noAjaxHook"} $conf->{"krbByJs"}
Truth table33%1/3
A and B
A= $conf->{"noAjaxHook"}B= $conf->{"krbByJs"}
ABresult
0X0
100
111
1175 47 return 1;
1176 },
1177  
1178 # Cookie SameSite=None requires Secure flag
1179 # Same with SameSite=(auto) and SAML issuer in use
1180 47 ▶ SameSiteNoneWithSecure => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
1181 return ( -1, 'SameSite value = None requires the secured flag' )
1182 if ( getSameSite($conf) eq 'None'
1183 47 ▶ and !$conf->{securedCookie} );
Branch: 1 branch
BranchTrueFalseTotal
if getSameSite($conf) eq "None" and not $conf->{"securedCookie"} 0 47 47
Condition33%1/3
getSameSite($conf) eq "None" and not $conf->{"securedCookie"}
!ll&&!rl&&r
4700
MC/DC0%0/2
getSameSite($conf) eq "None" and not $conf->{"securedCookie"}
getSameSite($conf) eq "None" not $conf->{"securedCookie"}
Truth table33%1/3
A and not(B)
A= getSameSite($conf) eq "None"B= not $conf->{"securedCookie"}
ABresult
0X0
100
111
1184 47 return 1;
1185 },
1186  
1187 # Secure cookies require HTTPS
1188 47 ▶ SecureCookiesRequireHttps => sub {
Subroutine __ANON__: called CC=4 SCAR=17.9
1189 return ( -1, 'Secure cookies require a HTTPS portal URL' )
1190 if ( $conf->{securedCookie} == 1
1191 and $conf->{portal}
1192 47 ▶ and $conf->{portal} !~ /^https:/ );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"securedCookie"} == 1 and $conf->{"portal"} and not $conf->{"portal"} =~ /^https:/ 0 47 47
Condition33%2/6
$conf->{"securedCookie"} == 1 and $conf->{"portal"} and not $conf->{"portal"} =~ /^https:/
!ll&&!rl&&r
4700
$conf->{"securedCookie"} == 1 and $conf->{"portal"}
!ll&&!rl&&r
4700
MC/DC0%0/3
$conf->{"securedCookie"} == 1 and $conf->{"portal"} and not $conf->{"portal"} =~ /^https:/
$conf->{"securedCookie"} == 1 $conf->{"portal"} not $conf->{"portal"} =~ /^https:/
Truth table25%1/4
A and B and not(C)
A= $conf->{"securedCookie"} == 1B= $conf->{"portal"}C= not $conf->{"portal"} =~ /^https:/
ABCresult
0XX0
10X0
1100
1111
1193 47 return 1;
1194 },
1195  
1196 # Password module requires a password backend
1197 47 ▶ passwordModuleNeedsBackend => sub {
Subroutine __ANON__: called CC=10 SCAR=38.4
1198 return ( -1, 'Password module is enabled without password backend' )
1199 if ( $conf->{portalDisplayChangePassword}
1200 47 ▶ and $conf->{passwordDB} eq 'Null' );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Null" 0 47 47
Condition33%1/3
$conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Null"
!ll&&!rl&&r
0470
MC/DC0%0/2
$conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Null"
$conf->{"portalDisplayChangePassword"} $conf->{"passwordDB"} eq "Null"
Truth table33%1/3
A and B
A= $conf->{"portalDisplayChangePassword"}B= $conf->{"passwordDB"} eq "Null"
ABresult
0X0
100
111
1201 47 ▶ if ( $conf->{portalDisplayChangePassword}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Choice" and $conf->{"authChoiceModules"}) 0 47 47
Condition33%2/6
$conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Choice" and $conf->{"authChoiceModules"}
!ll&&!rl&&r
4700
$conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Choice"
!ll&&!rl&&r
0470
MC/DC0%0/3
$conf->{"portalDisplayChangePassword"} and $conf->{"passwordDB"} eq "Choice" and $conf->{"authChoiceModules"}
$conf->{"portalDisplayChangePassword"} $conf->{"passwordDB"} eq "Choice" $conf->{"authChoiceModules"}
Truth table25%1/4
A and B and C
A= $conf->{"portalDisplayChangePassword"}B= $conf->{"passwordDB"} eq "Choice"C= $conf->{"authChoiceModules"}
ABCresult
0XX0
10X0
1100
1111
1202 and $conf->{passwordDB} eq 'Choice'
1203 and $conf->{authChoiceModules} )
1204 {
1205 0 my $hasPwdBE = 0;
1206 0 foreach ( keys %{ $conf->{authChoiceModules} } ) {
1207 0 my @mods = split /;\s*/, $conf->{authChoiceModules}->{$_};
1208 0 ▶ $hasPwdBE ||= 1 unless $mods[2] eq 'Null';
Branch: 1 branch
BranchTrueFalseTotal
unless $mods[2] eq "Null" 0 0 0
Condition0%0/2
$hasPwdBE ||= 1
l!l
00
MC/DC0%0/1
$hasPwdBE ||= 1
$hasPwdBE
Truth table0%0/2
A
A= $hasPwdBE
Aresult
11
00
1209 }
1210 0 ▶ return ( -1,
Branch: 1 branch
BranchTrueFalseTotal
unless $hasPwdBE 0 0 0
1211 'Password module is enabled without AuthChoice password backend'
1212 ) unless $hasPwdBE;
1213 }
1214 47 return 1;
1215 },
1216  
1217 47 ▶ webAuthnRequiresToken => sub {
Subroutine __ANON__: called CC=4 SCAR=23.3
1218 47 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_->[0] eq "WebAuthn";} map({[split(/;\s*/, $_, 0)];} values %{$$conf{"authChoiceModules"};})) 0 47 47
1219 0 grep { $_->[0] eq "WebAuthn" }
1220 0 map { [ split( /;\s*/, $_ ) ] }
1221 47 values %{ $conf->{authChoiceModules} }
1222 )
1223 {
1224 0 ▶ if ( $conf->{requireToken} == 0 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($conf->{'requireToken'} == 0) { } 0 0 0
elsif ($conf->{'requireToken'} == 1) { } 0 0 0
1225 0 return ( 0,
1226 "WebAuthn authentication requires using a token" );
1227 }
1228 elsif ( $conf->{requireToken} == 1 ) {
1229 0 return 1;
1230 }
1231 else {
1232 0 return ( 1,
1233 "WebAuthn authentication requires a token"
1234 . " but a rule was defined for token use."
1235 . " WebAuthn might not work in some situations" );
1236 }
1237 }
1238 47 return 1;
1239 },
1240  
1241 # FindUser requires Impersonation and attributes
1242 47 ▶ findUserWithoutImpersonationOrAttributes => sub {
Subroutine __ANON__: called CC=5 SCAR=20.9
1243 return ( -1,
1244 '"Impersonation" plugin is required to enable "FindUser" plugin'
1245 )
1246 if ( $conf->{findUser}
1247 47 ▶ and !$conf->{impersonationRule} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"findUser"} and not $conf->{"impersonationRule"} 0 47 47
Condition33%1/3
$conf->{"findUser"} and not $conf->{"impersonationRule"}
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"findUser"} and not $conf->{"impersonationRule"}
$conf->{"findUser"} not $conf->{"impersonationRule"}
Truth table33%1/3
A and not(B)
A= $conf->{"findUser"}B= not $conf->{"impersonationRule"}
ABresult
0X0
100
111
1248 return ( 1,
1249 '"FindUser" plugin enabled without searching attributes' )
1250 if ( $conf->{findUser}
1251 and scalar
1252 0 ▶ keys %{ $conf->{findUserSearchingAttributes} } == 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"findUser"} and scalar keys %{$$conf{"findUserSearchingAttributes"};} == 0 0 47 47
Condition33%1/3
$conf->{"findUser"} and scalar keys %{$$conf{"findUserSearchingAttributes"};} == 0
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"findUser"} and scalar keys %{$$conf{"findUserSearchingAttributes"};} == 0
$conf->{"findUser"} scalar keys %{$$conf{"findUserSearchingAttributes"};} == 0
Truth table33%1/3
A and B
A= $conf->{"findUser"}B= scalar keys %{$$conf{"findUserSearchingAttributes"};} == 0
ABresult
0X0
100
111
1253 47 return 1;
1254 },
1255  
1256 # FindUser wildcard must be allowed
1257 47 ▶ findUserWildcard => sub {
Subroutine __ANON__: called CC=5 SCAR=25.9
1258 return 1
1259 unless ( $conf->{findUser}
1260 and $conf->{findUserWildcard}
1261 47 ▶ and $conf->{findUserControl} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"findUser"} and $conf->{"findUserWildcard"} and $conf->{"findUserControl"} 47 0 47
Condition33%2/6
$conf->{"findUser"} and $conf->{"findUserWildcard"} and $conf->{"findUserControl"}
!ll&&!rl&&r
4700
$conf->{"findUser"} and $conf->{"findUserWildcard"}
!ll&&!rl&&r
4700
MC/DC0%0/3
$conf->{"findUser"} and $conf->{"findUserWildcard"} and $conf->{"findUserControl"}
$conf->{"findUser"} $conf->{"findUserWildcard"} $conf->{"findUserControl"}
Truth table25%1/4
A and B and C
A= $conf->{"findUser"}B= $conf->{"findUserWildcard"}C= $conf->{"findUserControl"}
ABCresult
0XX0
10X0
1100
1111
1262 return ( 1,
1263 'FindUser wildcard should be allowed by parameters control' )
1264 unless (
1265 0 ▶ $conf->{findUserWildcard} =~ /$conf->{findUserControl}/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"findUserWildcard"} =~ /$conf->{"findUserControl"}/ 0 0 0
1266 0 return 1;
1267 },
1268  
1269 # AuthChoice parameters must exist
1270 47 ▶ AuthChoiceParams => sub {
Subroutine __ANON__: called CC=10 SCAR=41.3
1271 return 1
1272 unless ( $conf->{authChoiceModules}
1273 27 and %{ $conf->{authChoiceModules} }
1274 47 ▶ and $conf->{authentication} eq 'Choice' );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};} and $conf->{"authentication"} eq "Choice" 47 0 47
Condition50%3/6
$conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};} and $conf->{"authentication"} eq "Choice"
!ll&&!rl&&r
4700
$conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};}
!ll&&!rl&&r
20270
MC/DC0%0/3
$conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};} and $conf->{"authentication"} eq "Choice"
$conf->{"authChoiceModules"} %{$conf->{"authChoiceModules"};} $conf->{"authentication"} eq "Choice"
Truth table50%2/4
A and B and C
A= $conf->{"authChoiceModules"}B= %{$conf->{"authChoiceModules"};}C= $conf->{"authentication"} eq "Choice"
ABCresult
0XX0
10X0
1100
1111
1275 0 foreach (qw(AuthBasic FindUser)) {
1276 0 ▶ if ( $conf->{"authChoice$_"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$conf{"authChoice$_"}) 0 0 0
1277 0 my $test = $conf->{"authChoice$_"};
1278 my $param = grep /^$test$/,
1279 0 keys %{ $conf->{authChoiceModules} };
1280 0 ▶ return ( -1, "Choice $_ parameter does not exist" )
Branch: 1 branch
BranchTrueFalseTotal
unless $param 0 0 0
1281 unless $param;
1282 }
1283 }
1284 0 foreach my $k ( sort keys %{ $conf->{authChoiceModules} } ) {
1285 0 my $v = $conf->{authChoiceModules}->{$k};
1286 0 my ( $a, $u, $p, $url ) = split ';', $v;
1287 0 ▶ return ( 0, "Choice $k has an invalid URL" )
Branch: 1 branch
BranchTrueFalseTotal
if $url and not $url =~ m[^https?://] 0 0 0
Condition0%0/3
$url and not $url =~ m[^https?://]
!ll&&!rl&&r
000
MC/DC0%0/2
$url and not $url =~ m[^https?://]
$url not $url =~ m[^https?://]
Truth table0%0/3
A and not(B)
A= $urlB= not $url =~ m[^https?://]
ABresult
0X0
100
111
1288 if $url and $url !~ m#^https?://#;
1289 }
1290 0 return 1;
1291 },
1292  
1293 # When auth is choice, userDB should be choice also
1294 47 ▶ userdbChoice => sub {
Subroutine __ANON__: called CC=6 SCAR=27.6
1295 return 1
1296 unless ( $conf->{authChoiceModules}
1297 31 and %{ $conf->{authChoiceModules} }
1298 47 ▶ and $conf->{authentication} eq 'Choice' );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};} and $conf->{"authentication"} eq "Choice" 47 0 47
Condition50%3/6
$conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};} and $conf->{"authentication"} eq "Choice"
!ll&&!rl&&r
4700
$conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};}
!ll&&!rl&&r
16310
MC/DC0%0/3
$conf->{"authChoiceModules"} and %{$conf->{"authChoiceModules"};} and $conf->{"authentication"} eq "Choice"
$conf->{"authChoiceModules"} %{$conf->{"authChoiceModules"};} $conf->{"authentication"} eq "Choice"
Truth table50%2/4
A and B and C
A= $conf->{"authChoiceModules"}B= %{$conf->{"authChoiceModules"};}C= $conf->{"authentication"} eq "Choice"
ABCresult
0XX0
10X0
1100
1111
1299 return ( 1, 'UserDB should be Same when authentication is Choice' )
1300 unless $conf->{userDB} eq 'Same'
1301 0 ▶ or $conf->{userDB} eq 'Choice';
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"userDB"} eq "Same" or $conf->{"userDB"} eq "Choice" 0 0 0
Condition0%0/3
$conf->{"userDB"} eq "Same" or $conf->{"userDB"} eq "Choice"
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"userDB"} eq "Same" or $conf->{"userDB"} eq "Choice"
$conf->{"userDB"} eq "Same" $conf->{"userDB"} eq "Choice"
Truth table0%0/3
A or B
A= $conf->{"userDB"} eq "Same"B= $conf->{"userDB"} eq "Choice"
ABresult
1X1
011
000
1302 0 return 1;
1303 },
1304  
1305 # FindUser authChoice parameter must be defined
1306 47 ▶ findUserChoiceParam => sub {
Subroutine __ANON__: called CC=5 SCAR=21.9
1307 return ( -1, 'FindUser choice parameter must be defined' )
1308 if ( $conf->{findUser}
1309 and $conf->{impersonationRule}
1310 and $conf->{authentication} eq 'Choice'
1311 47 ▶ and !$conf->{authChoiceFindUser} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"findUser"} and $conf->{"impersonationRule"} and $conf->{"authentication"} eq "Choice" and not $conf->{"authChoiceFindUser"} 0 47 47
Condition33%3/9
$conf->{"findUser"} and $conf->{"impersonationRule"} and $conf->{"authentication"} eq "Choice" and not $conf->{"authChoiceFindUser"}
!ll&&!rl&&r
4700
$conf->{"findUser"} and $conf->{"impersonationRule"} and $conf->{"authentication"} eq "Choice"
!ll&&!rl&&r
4700
$conf->{"findUser"} and $conf->{"impersonationRule"}
!ll&&!rl&&r
4700
MC/DC0%0/4
$conf->{"findUser"} and $conf->{"impersonationRule"} and $conf->{"authentication"} eq "Choice" and not $conf->{"authChoiceFindUser"}
$conf->{"findUser"} $conf->{"impersonationRule"} $conf->{"authentication"} eq "Choice" not $conf->{"authChoiceFindUser"}
Truth table20%1/5
A and B and C and not(D)
A= $conf->{"findUser"}B= $conf->{"impersonationRule"}C= $conf->{"authentication"} eq "Choice"D= not $conf->{"authChoiceFindUser"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1312 47 return 1;
1313 },
1314  
1315 # Chain must be defined with AuthChoice
1316 47 ▶ authChoiceChains => sub {
Subroutine __ANON__: called CC=3 SCAR=14.2
1317 return ( -1, 'Authentication choice enabled without chain' )
1318 if ( $conf->{authentication} eq 'Choice'
1319 0 ▶ and scalar keys %{ $conf->{authChoiceModules} } == 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"authentication"} eq "Choice" and scalar keys %{$$conf{"authChoiceModules"};} == 0 0 47 47
Condition33%1/3
$conf->{"authentication"} eq "Choice" and scalar keys %{$$conf{"authChoiceModules"};} == 0
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"authentication"} eq "Choice" and scalar keys %{$$conf{"authChoiceModules"};} == 0
$conf->{"authentication"} eq "Choice" scalar keys %{$$conf{"authChoiceModules"};} == 0
Truth table33%1/3
A and B
A= $conf->{"authentication"} eq "Choice"B= scalar keys %{$$conf{"authChoiceModules"};} == 0
ABresult
0X0
100
111
1320 47 return 1;
1321 },
1322  
1323 # Internal portal URL must be defined with Proxy authentication
1324 47 ▶ authProxy => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
1325 return ( 0,
1326 'Proxy authentication enabled without internal portal URL' )
1327 if ( $conf->{authentication} eq 'Proxy'
1328 47 ▶ and !$conf->{proxyAuthService} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"authentication"} eq "Proxy" and not $conf->{"proxyAuthService"} 0 47 47
Condition33%1/3
$conf->{"authentication"} eq "Proxy" and not $conf->{"proxyAuthService"}
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"authentication"} eq "Proxy" and not $conf->{"proxyAuthService"}
$conf->{"authentication"} eq "Proxy" not $conf->{"proxyAuthService"}
Truth table33%1/3
A and not(B)
A= $conf->{"authentication"} eq "Proxy"B= not $conf->{"proxyAuthService"}
ABresult
0X0
100
111
1329 47 return 1;
1330 },
1331  
1332 # Warn if Impersonation and proxyAuthServiceImpersonation are simultaneously enabled
1333 47 ▶ impersonationProxy => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
1334 return ( -1,
1335 'Impersonation and internal portal Impersonation are simultaneously enabled'
1336 )
1337 if ( $conf->{impersonationRule}
1338 47 ▶ and $conf->{proxyAuthServiceImpersonation} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"impersonationRule"} and $conf->{"proxyAuthServiceImpersonation"} 0 47 47
Condition33%1/3
$conf->{"impersonationRule"} and $conf->{"proxyAuthServiceImpersonation"}
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"impersonationRule"} and $conf->{"proxyAuthServiceImpersonation"}
$conf->{"impersonationRule"} $conf->{"proxyAuthServiceImpersonation"}
Truth table33%1/3
A and B
A= $conf->{"impersonationRule"}B= $conf->{"proxyAuthServiceImpersonation"}
ABresult
0X0
100
111
1339 47 return 1;
1340 },
1341  
1342 # CheckDevOps requires Safe jail
1343 47 ▶ checkDevOpsWithSafeJail => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
1344 return ( 0, 'Safe jail must be enabled with CheckDevOps plugin' )
1345 if ( $conf->{checkDevOps}
1346 47 ▶ and !$conf->{useSafeJail} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"checkDevOps"} and not $conf->{"useSafeJail"} 0 47 47
Condition33%1/3
$conf->{"checkDevOps"} and not $conf->{"useSafeJail"}
!ll&&!rl&&r
4700
MC/DC0%0/2
$conf->{"checkDevOps"} and not $conf->{"useSafeJail"}
$conf->{"checkDevOps"} not $conf->{"useSafeJail"}
Truth table33%1/3
A and not(B)
A= $conf->{"checkDevOps"}B= not $conf->{"useSafeJail"}
ABresult
0X0
100
111
1347 47 return 1;
1348 },
1349  
1350 # Work around for #1740
1351 47 ▶ corruptApplicationConfig => sub {
Subroutine __ANON__: called CC=8 SCAR=23.0
1352 47 ▶ for my $cat ( keys %{ $conf->{applicationList} || {} } ) {
Condition50%1/2
$conf->{'applicationList'} || {}
l!l
470
MC/DC0%0/1
$conf->{'applicationList'} || {}
$conf->{'applicationList'}
Truth table50%1/2
A
A= $conf->{'applicationList'}
Aresult
11
00
1353 156 ▶ if ( ref( $conf->{applicationList}->{$cat} ) eq "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $conf->{"applicationList"}{$cat} eq "HASH") 156 0 156
1354 156 for my $app (
1355 156 ▶ keys %{ $conf->{applicationList}->{$cat} || {} } )
Condition50%1/2
$conf->{'applicationList'}{$cat} || {}
l!l
1560
MC/DC0%0/1
$conf->{'applicationList'}{$cat} || {}
$conf->{'applicationList'}{$cat}
Truth table50%1/2
A
A= $conf->{'applicationList'}{$cat}
Aresult
11
00
1356 {
1357 804 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (ref $conf->{"applicationList"}{$cat}{$app} eq "HASH" and $conf->{"applicationList"}{$cat}{$app}{"type"} eq "menuApp") 0 804 804
Condition66%2/3
ref $conf->{"applicationList"}{$cat}{$app} eq "HASH" and $conf->{"applicationList"}{$cat}{$app}{"type"} eq "menuApp"
!ll&&!rl&&r
4623420
MC/DC0%0/2
ref $conf->{"applicationList"}{$cat}{$app} eq "HASH" and $conf->{"applicationList"}{$cat}{$app}{"type"} eq "menuApp"
ref $conf->{"applicationList"}{$cat}{$app} eq "HASH" $conf->{"applicationList"}{$cat}{$app}{"type"} eq "menuApp"
Truth table66%2/3
A and B
A= ref $conf->{"applicationList"}{$cat}{$app} eq "HASH"B= $conf->{"applicationList"}{$cat}{$app}{"type"} eq "menuApp"
ABresult
0X0
100
111
1358 ref( $conf->{applicationList}->{$cat}->{$app} ) eq
1359 "HASH"
1360 and
1361 $conf->{applicationList}->{$cat}->{$app}->{type} eq
1362 "menuApp" )
1363 {
1364 0 return ( 0,
1365 'Error saving application list.'
1366 . ' Reload the manager and try again' );
1367 }
1368 }
1369 }
1370 }
1371 47 return 1;
1372 },
1373  
1374 # Warn if both oidcRPMetaDataOptionsJwks and oidcRPMetaDataOptionsJwksUri is set
1375 47 ▶ noJwksDuplication => sub {
Subroutine __ANON__: called CC=7 SCAR=21.5
1376 return 1
1377 unless $conf->{oidcRPMetaDataOptions}
1378 47 ▶ and ref $conf->{oidcRPMetaDataOptions};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and ref $conf->{"oidcRPMetaDataOptions"} 31 16 47
Condition66%2/3
$conf->{"oidcRPMetaDataOptions"} and ref $conf->{"oidcRPMetaDataOptions"}
!ll&&!rl&&r
31016
MC/DC50%1/2
$conf->{"oidcRPMetaDataOptions"} and ref $conf->{"oidcRPMetaDataOptions"}
$conf->{"oidcRPMetaDataOptions"} ref $conf->{"oidcRPMetaDataOptions"}
Truth table66%2/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= ref $conf->{"oidcRPMetaDataOptions"}
ABresult
0X0
100
111
1379 16 my @pb;
1380 16 for my $rp ( keys %{ $conf->{oidcRPMetaDataOptions} } ) {
1381 push @pb, $rp
1382 if $conf->{oidcRPMetaDataOptions}->{$rp}
1383 ->{oidcRPMetaDataOptionsJwks}
1384 and $conf->{oidcRPMetaDataOptions}->{$rp}
1385 6 ▶ ->{oidcRPMetaDataOptionsJwksUri};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwks"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwksUri"} 0 6 6
Condition33%1/3
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwks"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwksUri"}
!ll&&!rl&&r
600
MC/DC0%0/2
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwks"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwksUri"}
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwks"} $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwksUri"}
Truth table33%1/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwks"}B= $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsJwksUri"}
ABresult
0X0
100
111
1386 }
1387 16 ▶ return 1 unless @pb;
Branch: 1 branch
BranchTrueFalseTotal
unless @pb 16 0 16
1388 0 return ( 1,
1389 "JWKS URI defined while JWKS document is fixed: "
1390 . join( ', ', @pb ) );
1391 },
1392  
1393 # If oidcRPMetaDataOptionsAuthRequiredForAuthorize is set, oidcRPMetaDataOptionsAuthMethod should be compatible
1394 47 ▶ oidcCompatAuth => sub {
Subroutine __ANON__: called CC=8 SCAR=24.0
1395 return 1
1396 unless $conf->{oidcRPMetaDataOptions}
1397 47 ▶ and ref $conf->{oidcRPMetaDataOptions};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcRPMetaDataOptions"} and ref $conf->{"oidcRPMetaDataOptions"} 31 16 47
Condition66%2/3
$conf->{"oidcRPMetaDataOptions"} and ref $conf->{"oidcRPMetaDataOptions"}
!ll&&!rl&&r
31016
MC/DC50%1/2
$conf->{"oidcRPMetaDataOptions"} and ref $conf->{"oidcRPMetaDataOptions"}
$conf->{"oidcRPMetaDataOptions"} ref $conf->{"oidcRPMetaDataOptions"}
Truth table66%2/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}B= ref $conf->{"oidcRPMetaDataOptions"}
ABresult
0X0
100
111
1398 16 my @pb;
1399 16 for my $rp ( keys %{ $conf->{oidcRPMetaDataOptions} } ) {
1400 push @pb, $rp
1401 if $conf->{oidcRPMetaDataOptions}->{$rp}
1402 ->{oidcRPMetaDataOptionsAuthRequiredForAuthorize}
1403 and $conf->{oidcRPMetaDataOptions}->{$rp}
1404 ->{oidcRPMetaDataOptionsAuthMethod}
1405 and $conf->{oidcRPMetaDataOptions}->{$rp}
1406 ->{oidcRPMetaDataOptionsAuthMethod} !~
1407 6 ▶ /^(?:client_secret|private_key)_jwt$/;
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthRequiredForAuthorize"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} and not $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} =~ /^(?:client_secret|private_key)_jwt$/ 0 6 6
Condition33%2/6
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthRequiredForAuthorize"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} and not $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} =~ /^(?:client_secret|private_key)_jwt$/
!ll&&!rl&&r
600
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthRequiredForAuthorize"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"}
!ll&&!rl&&r
600
MC/DC0%0/3
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthRequiredForAuthorize"} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} and not $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} =~ /^(?:client_secret|private_key)_jwt$/
$conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthRequiredForAuthorize"} $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} not $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} =~ /^(?:client_secret|private_key)_jwt$/
Truth table25%1/4
A and B and not(C)
A= $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthRequiredForAuthorize"}B= $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"}C= not $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsAuthMethod"} =~ /^(?:client_secret|private_key)_jwt$/
ABCresult
0XX0
10X0
1100
1111
1408 }
1409 16 ▶ return 1 unless @pb;
Branch: 1 branch
BranchTrueFalseTotal
unless @pb 16 0 16
1410 0 return ( 1,
1411 'Incompatible required authentication methods in RP '
1412 . '(only client_secret_jwt and private_key_jwt are allowed '
1413 . 'when authentication is required on authorization endpoint: '
1414 . join( ', ', @pb ) );
1415 },
1416  
1417 # Test password length policy if enabled
1418 47 ▶ ppMaxSizeGreaterThanMinSize => sub {
Subroutine __ANON__: called CC=4 SCAR=17.9
1419 return ( 1,
1420 'Password maximum size should be greater than minimal size' )
1421 if ( (
1422 $conf->{passwordPolicyMinSize} >=
1423 $conf->{passwordPolicyMaxSize}
1424 )
1425 and $conf->{passwordPolicyMaxSize}
1426 and $conf->{passwordPolicyActivation}
1427 47 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"passwordPolicyMinSize"} >= $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyActivation"} 0 47 47
Condition33%2/6
$conf->{"passwordPolicyMinSize"} >= $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyActivation"}
!ll&&!rl&&r
4700
$conf->{"passwordPolicyMinSize"} >= $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyMaxSize"}
!ll&&!rl&&r
0470
MC/DC0%0/3
$conf->{"passwordPolicyMinSize"} >= $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyMaxSize"} and $conf->{"passwordPolicyActivation"}
$conf->{"passwordPolicyMinSize"} >= $conf->{"passwordPolicyMaxSize"} $conf->{"passwordPolicyMaxSize"} $conf->{"passwordPolicyActivation"}
Truth table25%1/4
A and B and C
A= $conf->{"passwordPolicyMinSize"} >= $conf->{"passwordPolicyMaxSize"}B= $conf->{"passwordPolicyMaxSize"}C= $conf->{"passwordPolicyActivation"}
ABCresult
0XX0
10X0
1100
1111
1428 47 return 1;
1429 },
1430  
1431 # Test password minimal size policy if enabled
1432 47 ▶ ppMinSize => sub {
Subroutine __ANON__: called CC=6 SCAR=21.2
1433 47 my $total;
1434 47 foreach (qw(Lower Upper Digit SpeChar)) {
1435 $total += $conf->{"passwordPolicyMin$_"}
1436 188 ▶ if $conf->{"passwordPolicyMin$_"} > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $$conf{"passwordPolicyMin$_"} > 0 0 188 188
1437 }
1438 return ( 1,
1439 'Password minimal size should be greater than total of minimal sizes'
1440 )
1441 if ( ( $conf->{passwordPolicyMinSize} < $total )
1442 and $conf->{passwordPolicyMinSize}
1443 47 ▶ and $conf->{passwordPolicyActivation} );
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"passwordPolicyMinSize"} < $total and $conf->{"passwordPolicyMinSize"} and $conf->{"passwordPolicyActivation"} 0 47 47
Condition33%2/6
$conf->{"passwordPolicyMinSize"} < $total and $conf->{"passwordPolicyMinSize"} and $conf->{"passwordPolicyActivation"}
!ll&&!rl&&r
4700
$conf->{"passwordPolicyMinSize"} < $total and $conf->{"passwordPolicyMinSize"}
!ll&&!rl&&r
4700
MC/DC0%0/3
$conf->{"passwordPolicyMinSize"} < $total and $conf->{"passwordPolicyMinSize"} and $conf->{"passwordPolicyActivation"}
$conf->{"passwordPolicyMinSize"} < $total $conf->{"passwordPolicyMinSize"} $conf->{"passwordPolicyActivation"}
Truth table25%1/4
A and B and C
A= $conf->{"passwordPolicyMinSize"} < $totalB= $conf->{"passwordPolicyMinSize"}C= $conf->{"passwordPolicyActivation"}
ABCresult
0XX0
10X0
1100
1111
1444 47 return 1;
1445 },
1446 47 ▶ accessTokenConsistency => sub {
Subroutine __ANON__: called CC=7 SCAR=37.4
1447 return 1
1448 47 ▶ unless $conf->{issuerDBOpenIDConnectActivation};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"issuerDBOpenIDConnectActivation"} 47 0 47
1449 0 my @pb;
1450 0 ▶ foreach my $rp ( keys %{ $conf->{oidcRPMetaDataOptions} || {} } ) {
Condition0%0/2
$conf->{'oidcRPMetaDataOptions'} || {}
l!l
00
MC/DC0%0/1
$conf->{'oidcRPMetaDataOptions'} || {}
$conf->{'oidcRPMetaDataOptions'}
Truth table0%0/2
A
A= $conf->{'oidcRPMetaDataOptions'}
Aresult
11
00
1451 0 my $opts = $conf->{oidcRPMetaDataOptions}->{$rp};
1452 push @pb, $rp
1453 if $opts->{oidcRPMetaDataOptionsAccessTokenClaims}
1454 0 ▶ and not $opts->{oidcRPMetaDataOptionsAccessTokenJWT};
Branch: 1 branch
BranchTrueFalseTotal
if $opts->{"oidcRPMetaDataOptionsAccessTokenClaims"} and not $opts->{"oidcRPMetaDataOptionsAccessTokenJWT"} 0 0 0
Condition0%0/3
$opts->{"oidcRPMetaDataOptionsAccessTokenClaims"} and not $opts->{"oidcRPMetaDataOptionsAccessTokenJWT"}
!ll&&!rl&&r
000
MC/DC0%0/2
$opts->{"oidcRPMetaDataOptionsAccessTokenClaims"} and not $opts->{"oidcRPMetaDataOptionsAccessTokenJWT"}
$opts->{"oidcRPMetaDataOptionsAccessTokenClaims"} not $opts->{"oidcRPMetaDataOptionsAccessTokenJWT"}
Truth table0%0/3
A and not(B)
A= $opts->{"oidcRPMetaDataOptionsAccessTokenClaims"}B= not $opts->{"oidcRPMetaDataOptionsAccessTokenJWT"}
ABresult
0X0
100
111
1455 }
1456 0 ▶ return 1 unless @pb;
Branch: 1 branch
BranchTrueFalseTotal
unless @pb 0 0 0
1457 0 return ( 0,
1458 'access_token cannot be opaque with claims in access_token ('
1459 . join( ', ', @pb )
1460 . ')' );
1461 },
1462 47 ▶ oidcNoneConsistency => sub {
Subroutine __ANON__: called CC=7 SCAR=35.9
1463 47 my @pb;
1464 47 ▶ return 1 unless $conf->{oidcServiceMetaDataDisallowNoneAlg};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"oidcServiceMetaDataDisallowNoneAlg"} 47 0 47
1465 0 ▶ foreach my $rp ( keys %{ $conf->{oidcRPMetaDataOptions} || {} } ) {
Condition0%0/2
$conf->{'oidcRPMetaDataOptions'} || {}
l!l
00
MC/DC0%0/1
$conf->{'oidcRPMetaDataOptions'} || {}
$conf->{'oidcRPMetaDataOptions'}
Truth table0%0/2
A
A= $conf->{'oidcRPMetaDataOptions'}
Aresult
11
00
1466 0 my $opts = $conf->{oidcRPMetaDataOptions}->{$rp};
1467 push @pb, $rp
1468 if $opts->{oidcRPMetaDataOptionsIDTokenSignAlg} eq 'none'
1469 0 ▶ or $opts->{oidcRPMetaDataOptionsUserInfoSignAlg} eq 'none';
Branch: 1 branch
BranchTrueFalseTotal
if $opts->{"oidcRPMetaDataOptionsIDTokenSignAlg"} eq "none" or $opts->{"oidcRPMetaDataOptionsUserInfoSignAlg"} eq "none" 0 0 0
Condition0%0/3
$opts->{"oidcRPMetaDataOptionsIDTokenSignAlg"} eq "none" or $opts->{"oidcRPMetaDataOptionsUserInfoSignAlg"} eq "none"
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts->{"oidcRPMetaDataOptionsIDTokenSignAlg"} eq "none" or $opts->{"oidcRPMetaDataOptionsUserInfoSignAlg"} eq "none"
$opts->{"oidcRPMetaDataOptionsIDTokenSignAlg"} eq "none" $opts->{"oidcRPMetaDataOptionsUserInfoSignAlg"} eq "none"
Truth table0%0/3
A or B
A= $opts->{"oidcRPMetaDataOptionsIDTokenSignAlg"} eq "none"B= $opts->{"oidcRPMetaDataOptionsUserInfoSignAlg"} eq "none"
ABresult
1X1
011
000
1470 }
1471 0 ▶ return 1 unless @pb;
Branch: 1 branch
BranchTrueFalseTotal
unless @pb 0 0 0
1472 0 return ( 1,
1473 'Signature algorithm is not allowed but set for: '
1474 . join( ', ', @pb ) );
1475 },
1476 47 ▶ crowdSecBouncer => sub {
Subroutine __ANON__: called CC=3 SCAR=18.4
1477 47 ▶ return 1 unless $conf->{crowdsec};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"crowdsec"} 47 0 47
1478 0 ▶ return 1 if $conf->{crowdsecKey};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"crowdsecKey"} 0 0 0
1479 0 return ( 0, 'Crowdsec Bouncer enabled without API key' );
1480 },
1481 47 ▶ crowdSecAgent => sub {
Subroutine __ANON__: called CC=4 SCAR=25.0
1482 47 ▶ return 1 unless $conf->{crowdsecAgent};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"crowdsecAgent"} 47 0 47
1483 return 1
1484 0 ▶ if $conf->{crowdsecMachineId} and $conf->{crowdsecPassword};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"crowdsecMachineId"} and $conf->{"crowdsecPassword"} 0 0 0
Condition0%0/3
$conf->{"crowdsecMachineId"} and $conf->{"crowdsecPassword"}
!ll&&!rl&&r
000
MC/DC0%0/2
$conf->{"crowdsecMachineId"} and $conf->{"crowdsecPassword"}
$conf->{"crowdsecMachineId"} $conf->{"crowdsecPassword"}
Truth table0%0/3
A and B
A= $conf->{"crowdsecMachineId"}B= $conf->{"crowdsecPassword"}
ABresult
0X0
100
111
1485 0 return ( 0,
1486 'Crowdsec Agent enabled without machine_id and password' );
1487 },
1488  
1489 # External menu URL must be a valid URL
1490 47 ▶ externalMenuUrl => sub {
Subroutine __ANON__: called CC=3 SCAR=18.4
1491 47 ▶ return 1 unless $conf->{externalMenu};
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"externalMenu"} 47 0 47
1492 return ( 0, 'External menu URL looks invalid' )
1493 0 ▶ unless $conf->{externalMenu} =~ m#^(\w+)://#;
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"externalMenu"} =~ m[^(\w+)://] 0 0 0
1494 0 return 1;
1495 },
1496 47 };
1497 }
1498  
1499 13 1;
« blib/lib/Lemonldap/NG/Manager.pm ↑ Summary blib/lib/Lemonldap/NG/Manager/Build/OpenApi.pm »