| 1 | package GDPR::IAB::TCFv2::Validator 0.530; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 27 | ▶ | use v5.12; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 27 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 27 | ▶ | use Carp qw<croak>; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 27 | ▶ | use Scalar::Util qw<blessed>; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 27 | ▶ | use GDPR::IAB::TCFv2; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 27 | ▶ | use GDPR::IAB::TCFv2::Constants::RestrictionType qw<:all>; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 27 | ▶ | use GDPR::IAB::TCFv2::Validator::Failure; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 27 | ▶ | use GDPR::IAB::TCFv2::Validator::Reason qw<:all>; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 27 | ▶ | use GDPR::IAB::TCFv2::Validator::Result; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # TCF v2.3 became mandatory on 2026-02-28T00:00:00Z. Strings created strictly | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # after this instant must use policy version >= 5 and carry a disclosed-vendors | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # segment. The strictly-after comparison mirrors the Go validator's | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # created.After(v23Deadline) (note: the parser's is_v23 uses >= for its own | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # strict-parse gate; the Validator deliberately matches Go here). | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 27 | ▶ | use constant TCF_V23_DEADLINE => 1772236800; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 86 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 86 | my ($klass, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 86 | ▶ | my $consent = $args{consent_purpose_ids} || []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'consent_purpose_ids'} || []
MC/DC100%1/1
$args{'consent_purpose_ids'} || []
$args{'consent_purpose_ids'}
Truth table100%2/2
A
A= $args{'consent_purpose_ids'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 86 | ▶ | my $legitimate_interest = $args{legitimate_interest_purpose_ids} || []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'legitimate_interest_purpose_ids'} || []
MC/DC100%1/1
$args{'legitimate_interest_purpose_ids'} || []
$args{'legitimate_interest_purpose_ids'}
Truth table100%2/2
A
A= $args{'legitimate_interest_purpose_ids'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 86 | ▶ | my $flexible = $args{flexible_purpose_ids} || []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'flexible_purpose_ids'} || []
MC/DC100%1/1
$args{'flexible_purpose_ids'} || []
$args{'flexible_purpose_ids'}
Truth table100%2/2
A
A= $args{'flexible_purpose_ids'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 86 | _check_coherence($consent, $legitimate_interest, $flexible); | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # Compute cmp_validator in scalar context so a bare `return` from the | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # coercer correctly yields undef -- a list-context call inside the | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # anonymous-hash construction below would collapse the key/value | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # pair instead. | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 84 | my $cmp_validator = _coerce_cmp_validator($args{cmp_validator}); | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # A policy floor of v2.3+ (>= 5) makes the disclosed-vendors segment | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # mandatory, so verifying it is implied. Mirrors the Go validator's | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # `verifyDisclosedVendors = cfg.VerifyDisclosedVendors || cfg.MinTcfPolicyVersion >= 5`. | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 83 | my $min = $args{min_tcf_policy_version}; | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | 83 | ▶ | my $verify_disclosed = ($args{verify_disclosed_vendors} // 0) || (defined $min && $min >= 5 ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
($args{'verify_disclosed_vendors'} // 0) || (defined $min && $min >= 5 ? 1 : 0)
$args{"verify_disclosed_vendors"} // 0
defined $min and $min >= 5
MC/DC100%3/3
($args{'verify_disclosed_vendors'} // 0) || (defined $min && $min >= 5 ? 1 : 0)
$args{"verify_disclosed_vendors"}
defined $min
$min >= 5
Truth table100%4/4
A || B and C
A= $args{"verify_disclosed_vendors"}B= defined $minC= $min >= 5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | vendor_id => $args{vendor_id}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | consent_purpose_ids => $consent, | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | legitimate_interest_purpose_ids => $legitimate_interest, | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | flexible_purpose_ids => $flexible, | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 8 | ▶ | _flexible_set => {map { $_ => 1 } @{$flexible}}, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | verify_disclosed_vendors => $verify_disclosed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | min_tcf_policy_version => $min, | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | cmp_validator => $cmp_validator, | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 83 | strict_legal_basis => exists $args{strict_legal_basis} ? $args{strict_legal_basis} : 0, | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 83 | return bless $self, $klass; | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Accept either a CMPValidator object, a hashref of constructor args | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # (auto-instantiated lazily on the first call), or undef. Defer the | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # `require` so callers who never opt into the CMP rule never pay for | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # loading JSON::PP / Time::Piece. | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 85 | ▶ | sub _coerce_cmp_validator { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_coerce_cmp_validator: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 85 | my ($spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Bare `return` is fine -- callers always invoke this in scalar | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # context (see the explicit `my $cmp_validator = ...` in `new` and the | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # `my $cmp_validator = ...` in `_run_validation`). | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 85 | ▶ | return unless defined $spec; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 13 | ▶ | return $spec if blessed($spec) && $spec->isa('GDPR::IAB::TCFv2::CMPValidator'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($spec) and $spec->isa("GDPR::IAB::TCFv2::CMPValidator")
MC/DC50%1/2
builtin::blessed($spec) and $spec->isa("GDPR::IAB::TCFv2::CMPValidator")
builtin::blessed($spec)
$spec->isa("GDPR::IAB::TCFv2::CMPValidator")
Truth table66%2/3
A and B
A= builtin::blessed($spec)B= $spec->isa("GDPR::IAB::TCFv2::CMPValidator")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 6 | ▶ | croak "cmp_validator must be a GDPR::IAB::TCFv2::CMPValidator object " . "or a hashref of constructor arguments" | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | unless ref($spec) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 5 | require GDPR::IAB::TCFv2::CMPValidator; | |||||||||||||||||||||||||||||||||||||||||||||
| 75 | 5 | return GDPR::IAB::TCFv2::CMPValidator->new(%{$spec}); | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 86 | ▶ | sub _check_coherence { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_coherence: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 86 | my ($consent, $legitimate_interest, $flexible) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 86 | my %consent_set = map { $_ => 1 } @{$consent}; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | 86 | my %li_set = map { $_ => 1 } @{$legitimate_interest}; | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 86 | foreach my $pid (@{$consent}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | 41 | ▶ | croak "purpose $pid cannot be in both consent_purpose_ids and legitimate_interest_purpose_ids" if $li_set{$pid}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 85 | foreach my $pid (@{$flexible}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | 9 | ▶ | next if $consent_set{$pid} || $li_set{$pid}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$consent_set{$pid} or $li_set{$pid}
MC/DC100%2/2
$consent_set{$pid} or $li_set{$pid}
$consent_set{$pid}
$li_set{$pid}
Truth table100%3/3
A or B
A= $consent_set{$pid}B= $li_set{$pid}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | croak "flexible purpose $pid must also appear in consent_purpose_ids or legitimate_interest_purpose_ids"; | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 84 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 61 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 61 | my ($self, $input, %overrides) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 61 | return $self->_run_validation($input, 1, %overrides); | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 9226 | ▶ | sub validate_all { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_all: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 9226 | my ($self, $input, %overrides) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 9226 | return $self->_run_validation($input, 0, %overrides); | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 9287 | ▶ | sub _run_validation { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_run_validation: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 9287 | my ($self, $input, $stop_on_first, %overrides) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 9287 | ▶ | my $tc = ref($input) eq 'GDPR::IAB::TCFv2' ? $input : GDPR::IAB::TCFv2->Parse($input); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 9284 | my $opt = $self->_resolve_options(%overrides); | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 9284 | ▶ | croak "missing vendor_id" unless defined $opt->{vendor_id}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 9283 | my @failures; | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 9283 | $self->_check_policy_version($tc, $opt->{min_tcf_policy_version}, \@failures); | |||||||||||||||||||||||||||||||||||||||||||||
| 120 | 9283 | ▶ | return $self->_make_result(0, \@failures) if $stop_on_first && @failures; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$stop_on_first and @failures
MC/DC100%2/2
$stop_on_first and @failures
$stop_on_first
@failures
Truth table100%3/3
A and B
A= $stop_on_firstB= @failures
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 9280 | $self->_check_cmp_validator($tc, $opt->{cmp_validator}, \@failures); | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | 9280 | ▶ | return $self->_make_result(0, \@failures) if $stop_on_first && @failures; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$stop_on_first and @failures
MC/DC100%2/2
$stop_on_first and @failures
$stop_on_first
@failures
Truth table100%3/3
A and B
A= $stop_on_firstB= @failures
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 9276 | $self->_check_disclosed($tc, $opt->{vendor_id}, $opt->{verify_disclosed}, $opt->{min_tcf_policy_version}, \@failures); | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 9276 | ▶ | return $self->_make_result(0, \@failures) if $stop_on_first && @failures; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$stop_on_first and @failures
MC/DC100%2/2
$stop_on_first and @failures
$stop_on_first
@failures
Truth table100%3/3
A and B
A= $stop_on_firstB= @failures
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # Global vendor gate: a vendor with neither consent nor legitimate interest | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # at the vendor level can never satisfy any per-purpose check, so fail with | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # ReasonVendorNotAllowed and short-circuit (in both fail-fast and exhaustive | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # modes) before walking the purpose lists. | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 9275 | ▶ | if ($self->_check_vendor_gate($tc, $opt->{vendor_id}, \@failures)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1197 | return $self->_make_result(0, \@failures); | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | $self->_check_consent_purposes($tc, $opt->{vendor_id}, $opt->{strict_legal_basis}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 8078 | \@failures, $stop_on_first, $opt->{consent_ids}, $opt->{flexible_set},); | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | 8077 | ▶ | return $self->_make_result(0, \@failures) if $stop_on_first && @failures; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$stop_on_first and @failures
MC/DC100%2/2
$stop_on_first and @failures
$stop_on_first
@failures
Truth table100%3/3
A and B
A= $stop_on_firstB= @failures
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | $self->_check_li_purposes($tc, $opt->{vendor_id}, $opt->{strict_legal_basis}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 8068 | \@failures, $stop_on_first, $opt->{li_ids}, $opt->{flexible_set},); | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 8068 | ▶ | if (@failures) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 2089 | return $self->_make_result(0, \@failures); | |||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 5979 | return $self->_make_result(1, []); | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # Resolve each tunable from the per-call %overrides, falling back to the | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # constructor value. Returns a hashref consumed by _run_validation. | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # Per-call list overrides do NOT re-validate coherence: orphan flexible | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # purposes (a pid in flexible_purpose_ids that isn't also in | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # consent_purpose_ids or legitimate_interest_purpose_ids) are silently | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # dropped because the rule loops only iterate over the consent/LI lists, | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # so the flex flag for an orphan is unreachable. This keeps per-call | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # overrides forgiving while the constructor remains strict for the static | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # policy. | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 9284 | ▶ | sub _resolve_options { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_options: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 9284 | my ($self, %overrides) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 9284 | my %opt; | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 9284 | ▶ | $opt{vendor_id} = exists $overrides{vendor_id} ? $overrides{vendor_id} : $self->{vendor_id}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $opt{strict_legal_basis} | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 9284 | ▶ | = exists $overrides{strict_legal_basis} ? $overrides{strict_legal_basis} : $self->{strict_legal_basis}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $opt{verify_disclosed} | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | = exists $overrides{verify_disclosed_vendors} | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ? $overrides{verify_disclosed_vendors} | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 9284 | ▶ | : $self->{verify_disclosed_vendors}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | $opt{min_tcf_policy_version} | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 9284 | ▶ | = exists $overrides{min_tcf_policy_version} ? $overrides{min_tcf_policy_version} : $self->{min_tcf_policy_version}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | $opt{cmp_validator} | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 9284 | ▶ | = exists $overrides{cmp_validator} ? _coerce_cmp_validator($overrides{cmp_validator}) : $self->{cmp_validator}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | $opt{consent_ids} | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 9284 | ▶ | = exists $overrides{consent_purpose_ids} ? $overrides{consent_purpose_ids} : $self->{consent_purpose_ids}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $opt{li_ids} | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | = exists $overrides{legitimate_interest_purpose_ids} | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ? $overrides{legitimate_interest_purpose_ids} | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 9284 | ▶ | : $self->{legitimate_interest_purpose_ids}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | $opt{flexible_set} | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | = exists $overrides{flexible_purpose_ids} | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | ? {map { $_ => 1 } @{$overrides{flexible_purpose_ids}}} | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | 9284 | ▶ | : $self->{_flexible_set}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 9284 | return \%opt; | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 9275 | ▶ | sub _check_vendor_gate { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_vendor_gate: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 9275 | my ($self, $tc, $vendor_id, $failures) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 9275 | ▶ | return 0 if $tc->vendor_consent($vendor_id); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1206 | ▶ | return 0 if $tc->vendor_legitimate_interest($vendor_id); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1197 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | code => ReasonVendorNotAllowed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | message => "vendor $vendor_id not allowed (no consent or legitimate interest)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 1197 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 9280 | ▶ | sub _check_cmp_validator { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_cmp_validator: called CC=7 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 9280 | my ($self, $tc, $cmp_validator, $failures) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 9280 | ▶ | return unless defined $cmp_validator; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 1036 | my $cmp_id = $tc->cmp_id; | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # Prefer the lifecycle-aware state() when the provider exposes it; fall back | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # to the boolean is_valid for older/custom providers. | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 1036 | ▶ | if ($cmp_validator->can('state')) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1036 | my $state = $cmp_validator->state($cmp_id); | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 1036 | ▶ | return if $state eq 'active'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 837 | ▶ | my $code = $state eq 'deleted' ? ReasonCMPDeleted : $state eq 'unknown' ? ReasonCMPUnknown : ReasonInvalidCMP; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 837 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 222 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | code => $code, | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | message => "CMP $cmp_id is not valid/disclosed ($state)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | cmp_id => $cmp_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 837 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | unless ($cmp_validator->is_valid($cmp_id)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | code => ReasonInvalidCMP, | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | message => "CMP $cmp_id is not valid/disclosed", | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | cmp_id => $cmp_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # Single policy-version gate mirroring the Go validator's | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # yieldPolicyVersionFailure: the date-based v2.3 rule takes precedence, then | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # the explicit floor. At most one ReasonPolicyVersionTooLow is emitted. | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 9288 | ▶ | sub _check_policy_version { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_policy_version: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 9288 | my ($self, $tc, $min_tcf_policy_version, $failures) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 9288 | my $actual = $tc->policy_version; | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # A TC string created strictly after the TCF v2.3 deadline must use policy | ||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # version >= 5, regardless of explicit configuration. Strictly-after mirrors | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # the Go validator's created.After(v23Deadline). | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 9288 | ▶ | if ($tc->created > TCF_V23_DEADLINE && $actual < 5) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tc->created > 1772236800 and $actual < 5
MC/DC50%1/2
$tc->created > 1772236800 and $actual < 5
$tc->created > 1772236800
$actual < 5
Truth table66%2/3
A and B
A= $tc->created > 1772236800B= $actual < 5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 3 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | code => ReasonPolicyVersionTooLow, | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | message => "post-deadline string requires policy version >= 5", | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 9285 | ▶ | if (defined $min_tcf_policy_version && $actual < $min_tcf_policy_version) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $min_tcf_policy_version and $actual < $min_tcf_policy_version
MC/DC100%2/2
defined $min_tcf_policy_version and $actual < $min_tcf_policy_version
defined $min_tcf_policy_version
$actual < $min_tcf_policy_version
Truth table100%3/3
A and B
A= defined $min_tcf_policy_versionB= $actual < $min_tcf_policy_version
| |||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 17 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 263 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | code => ReasonPolicyVersionTooLow, | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | message => "TC string policy version $actual is below required minimum $min_tcf_policy_version", | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 9285 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 9283 | ▶ | sub _check_disclosed { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_disclosed: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 9283 | my ($self, $tc, $vendor_id, $verify_disclosed, $min_tcf_policy_version, $failures) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 9283 | my $has_disclosure = $tc->has_vendor_disclosure; | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||
| 276 | # Mandatory disclosed-vendors segment. Mirrors the Go validator's | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # yieldMandatoryDisclosedVendors: it runs regardless of verify_disclosed and | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # may fire on either ground (both, when they overlap): | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # (a) any string created on/after the v2.3 deadline; | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # (b) a policy>=5 string under a policy>=5 floor. | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 9283 | ▶ | unless ($has_disclosure) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 8803 | ▶ | if ($tc->created > TCF_V23_DEADLINE) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 284 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | code => ReasonMissingDisclosedVendors, | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | message => "post-deadline string requires disclosed vendors segment", | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 8803 | ▶ | if ($tc->policy_version >= 5 && defined $min_tcf_policy_version && $min_tcf_policy_version >= 5) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$tc->policy_version >= 5 and defined $min_tcf_policy_version and $min_tcf_policy_version >= 5
$tc->policy_version >= 5 and defined $min_tcf_policy_version
MC/DC66%2/3
$tc->policy_version >= 5 and defined $min_tcf_policy_version and $min_tcf_policy_version >= 5
$tc->policy_version >= 5
defined $min_tcf_policy_version
$min_tcf_policy_version >= 5
Truth table75%3/4
A and B and C
A= $tc->policy_version >= 5B= defined $min_tcf_policy_versionC= $min_tcf_policy_version >= 5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 960 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | code => ReasonMissingDisclosedVendors, | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | message => "missing disclosed vendors segment", | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # When the segment is present and verification is on, the vendor must appear | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # in it. An absent segment is handled by the mandatory check above, never | ||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # here (matching Go: verifyDisclosedVendors passes when DisclosedVendors is | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # nil). | ||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 9283 | ▶ | if ($verify_disclosed && $has_disclosure && !$tc->disclosed_vendor($vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$verify_disclosed and $has_disclosure and not $tc->disclosed_vendor($vendor_id)
$verify_disclosed and $has_disclosure
MC/DC100%3/3
$verify_disclosed and $has_disclosure and not $tc->disclosed_vendor($vendor_id)
$verify_disclosed
$has_disclosure
not $tc->disclosed_vendor($vendor_id)
Truth table100%4/4
A and B and not(C)
A= $verify_disclosedB= $has_disclosureC= not $tc->disclosed_vendor($vendor_id)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 4 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 306 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 307 | code => ReasonVendorNotDisclosed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | message => "vendor $vendor_id not disclosed", | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 9283 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 8080 | ▶ | sub _check_consent_purposes { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_consent_purposes: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 8080 | my ($self, $tc, $vendor_id, $strict_legal_basis, $failures, $stop_on_first, $consent_ids, $flexible_set) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 8080 | foreach my $pid (@{$consent_ids}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 320 | 2042 | my $is_flexible = $flexible_set->{$pid}; | |||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # Publisher-restriction inspection runs before the parser | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # delegate so a restriction-driven failure carries the precise | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # Reason* code (and restriction_type) rather than the generic | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # vendor-not-allowed code. Skipped for flexible purposes: the | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # flex API may flip the basis based on the restriction itself, | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # so what looks like a contradiction here can still pass. | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 2042 | ▶ | if (!$is_flexible) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1033 | my $pr_failure = $self->_publisher_restriction_failure($tc, $vendor_id, $pid, 0); | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | 1033 | ▶ | if ($pr_failure) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | push @{$failures}, $pr_failure; | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | ▶ | return if $stop_on_first; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 2041 | ▶ | my $is_allowed | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 338 | = $is_flexible | ||||||||||||||||||||||||||||||||||||||||||||||
| 339 | ? $tc->is_vendor_allowed_for_flexible_purpose($vendor_id, $pid, 0, strict => $strict_legal_basis) | ||||||||||||||||||||||||||||||||||||||||||||||
| 340 | : $tc->is_vendor_consent_allowed($vendor_id, $pid, strict => $strict_legal_basis); | ||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 2040 | ▶ | unless ($is_allowed) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 22 | ▶ | push @{$failures}, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 344 | $is_flexible ? $self->_flexible_failure($tc, $vendor_id, $pid, 0) : GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | code => ReasonVendorNotAllowedConsent, | ||||||||||||||||||||||||||||||||||||||||||||||
| 346 | message => "vendor $vendor_id not allowed for purpose $pid (consent)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 347 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 22 | ▶ | return if $stop_on_first; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 8070 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 8072 | ▶ | sub _check_li_purposes { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_li_purposes: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 8072 | my ($self, $tc, $vendor_id, $strict_legal_basis, $failures, $stop_on_first, $li_ids, $flexible_set) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 8072 | my $policy_version = $tc->policy_version; | |||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 8072 | foreach my $pid (@{$li_ids}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 2026 | my $is_flexible = $flexible_set->{$pid}; | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # TCF carve-out: legitimate interest is never permitted for | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # Purpose 1, and is forbidden for Purposes 3-6 in TCF v2.2+ | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | # (TcfPolicyVersion >= 4). When the configured basis is LI and | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # the purpose is not flexible, this is a configuration the | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # spec cannot satisfy regardless of the vendor's signals; emit | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | # the dedicated reason instead of the generic LI failure so | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # callers can distinguish "spec forbids this" from "vendor | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # missing the LI bit". | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 2026 | ▶ | if (!$is_flexible && _li_carve_out_applies($pid, $policy_version)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $is_flexible and _li_carve_out_applies($pid, $policy_version)
MC/DC100%2/2
not $is_flexible and _li_carve_out_applies($pid, $policy_version)
not $is_flexible
_li_carve_out_applies($pid, $policy_version)
Truth table100%3/3
not(A) and B
A= not $is_flexibleB= _li_carve_out_applies($pid, $policy_version)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 6 | push @{$failures}, | |||||||||||||||||||||||||||||||||||||||||||||
| 374 | GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | code => ReasonLegitimateInterestNotPermittedForPurpose, | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | message => "legitimate interest not permitted for purpose $pid", | ||||||||||||||||||||||||||||||||||||||||||||||
| 377 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 379 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 6 | ▶ | return if $stop_on_first; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # Publisher-restriction inspection: same rationale as on the | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | # consent path. Skipped for flexible purposes (the flex API | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # honors the restriction by flipping bases, so what looks like | ||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # a contradiction here can still pass). | ||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 2020 | ▶ | if (!$is_flexible) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 1011 | my $pr_failure = $self->_publisher_restriction_failure($tc, $vendor_id, $pid, 1); | |||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1011 | ▶ | if ($pr_failure) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 295 | push @{$failures}, $pr_failure; | |||||||||||||||||||||||||||||||||||||||||||||
| 392 | 295 | ▶ | return if $stop_on_first; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 294 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 1725 | ▶ | my $is_allowed | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | = $is_flexible | ||||||||||||||||||||||||||||||||||||||||||||||
| 399 | ? $tc->is_vendor_allowed_for_flexible_purpose($vendor_id, $pid, 1, strict => $strict_legal_basis) | ||||||||||||||||||||||||||||||||||||||||||||||
| 400 | : $tc->is_vendor_legitimate_interest_allowed($vendor_id, $pid, strict => $strict_legal_basis); | ||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 1725 | ▶ | unless ($is_allowed) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 24 | ▶ | push @{$failures}, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 404 | $is_flexible ? $self->_flexible_failure($tc, $vendor_id, $pid, 1) : GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 405 | code => ReasonVendorNotAllowedLegitimateInterest, | ||||||||||||||||||||||||||||||||||||||||||||||
| 406 | message => "vendor $vendor_id not allowed for purpose $pid (legitimate interest)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 407 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 408 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 24 | ▶ | return if $stop_on_first; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 8067 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # Build the failure for a flexible purpose the parser rejected, mirroring the | ||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # Go validator's runFlexibleCheck reason selection. NotAllowed wins outright; | ||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # otherwise the effective legal basis decides the generic reason -- a spec | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # carve-out forces consent, then a Require* publisher restriction overrides | ||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # (RequireConsent => consent, RequireLI => LI). On the LI basis the carve-out | ||||||||||||||||||||||||||||||||||||||||||||||
| 421 | # still outranks the generic LI failure. | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 18 | ▶ | sub _flexible_failure { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flexible_failure: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 18 | my ($self, $tc, $vendor_id, $pid, $default_is_li) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 18 | ▶ | if ($tc->check_publisher_restriction($pid, NotAllowed, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 4 | return GDPR::IAB::TCFv2::Validator::Failure->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 427 | code => ReasonPublisherRestrictionNotAllowed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 428 | message => "publisher restriction: purpose $pid not allowed (vendor $vendor_id)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 430 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | restriction_type => NotAllowed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 14 | my $is_li = $default_is_li; | |||||||||||||||||||||||||||||||||||||||||||||
| 436 | 14 | ▶ | $is_li = 0 if _li_carve_out_applies($pid, $tc->policy_version); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 14 | ▶ | if ($tc->check_publisher_restriction($pid, RequireConsent, $vendor_id)) { $is_li = 0 } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 2 | elsif ($tc->check_publisher_restriction($pid, RequireLegitimateInterest, $vendor_id)) { $is_li = 1 } | |||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 14 | ▶ | if ($is_li && _li_carve_out_applies($pid, $tc->policy_version)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$is_li and _li_carve_out_applies($pid, $tc->policy_version)
MC/DC100%2/2
$is_li and _li_carve_out_applies($pid, $tc->policy_version)
$is_li
_li_carve_out_applies($pid, $tc->policy_version)
Truth table100%3/3
A and B
A= $is_liB= _li_carve_out_applies($pid, $tc->policy_version)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 1 | return GDPR::IAB::TCFv2::Validator::Failure->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 443 | code => ReasonLegitimateInterestNotPermittedForPurpose, | ||||||||||||||||||||||||||||||||||||||||||||||
| 444 | message => "legitimate interest not permitted for purpose $pid", | ||||||||||||||||||||||||||||||||||||||||||||||
| 445 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 446 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 447 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 13 | ▶ | return GDPR::IAB::TCFv2::Validator::Failure->new( | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 451 | code => $is_li ? ReasonVendorNotAllowedLegitimateInterest : ReasonVendorNotAllowedConsent, | ||||||||||||||||||||||||||||||||||||||||||||||
| 452 | message => $is_li | ||||||||||||||||||||||||||||||||||||||||||||||
| 453 | ? "vendor $vendor_id not allowed for purpose $pid (legitimate interest)" | ||||||||||||||||||||||||||||||||||||||||||||||
| 454 | : "vendor $vendor_id not allowed for purpose $pid (consent)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 455 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 456 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 457 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 1041 | ▶ | sub _li_carve_out_applies { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_li_carve_out_applies: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 1041 | my ($pid, $policy_version) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 1041 | ▶ | return 1 if $pid == 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 1033 | ▶ | return 1 if $pid >= 3 && $pid <= 6 && $policy_version >= 4; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$pid >= 3 and $pid <= 6 and $policy_version >= 4
$pid >= 3 and $pid <= 6
MC/DC100%3/3
$pid >= 3 and $pid <= 6 and $policy_version >= 4
$pid >= 3
$pid <= 6
$policy_version >= 4
Truth table100%4/4
A and B and C
A= $pid >= 3B= $pid <= 6C= $policy_version >= 4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 1032 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # Inspect publisher restrictions for ($vendor_id, $pid) and return a | ||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # Failure object when a restriction contradicts the configured basis, | ||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # or undef when no restriction-driven failure applies. | ||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # $basis: 0 = consent, 1 = legitimate interest. | ||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # A NotAllowed restriction always wins (it terminates the rule for | ||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # either basis). Beyond that, only the restriction type that | ||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # contradicts the configured basis is reported here -- the matching | ||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # restriction (e.g. RequireConsent on a consent-basis purpose) is a | ||||||||||||||||||||||||||||||||||||||||||||||
| 478 | # legal coexistence and falls through to the parser delegate. | ||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 2045 | ▶ | sub _publisher_restriction_failure { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_publisher_restriction_failure: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2045 | my ($self, $tc, $vendor_id, $pid, $basis) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 2045 | ▶ | if ($tc->check_publisher_restriction($pid, NotAllowed, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | return GDPR::IAB::TCFv2::Validator::Failure->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 484 | code => ReasonPublisherRestrictionNotAllowed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 485 | message => "publisher restriction: purpose $pid not allowed (vendor $vendor_id)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 486 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 487 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 488 | restriction_type => NotAllowed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 489 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 2043 | ▶ | if ($basis == 0 && $tc->check_publisher_restriction($pid, RequireLegitimateInterest, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$basis == 0 and $tc->check_publisher_restriction($pid, 2, $vendor_id)
MC/DC100%2/2
$basis == 0 and $tc->check_publisher_restriction($pid, 2, $vendor_id)
$basis == 0
$tc->check_publisher_restriction($pid, 2, $vendor_id)
Truth table100%3/3
A and B
A= $basis == 0B= $tc->check_publisher_restriction($pid, 2, $vendor_id)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 1 | return GDPR::IAB::TCFv2::Validator::Failure->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 494 | code => ReasonPublisherRestrictionRequireLegitimateInterest, | ||||||||||||||||||||||||||||||||||||||||||||||
| 495 | message => "publisher restriction: purpose $pid requires legitimate interest (vendor $vendor_id)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 496 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 497 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 498 | restriction_type => RequireLegitimateInterest, | ||||||||||||||||||||||||||||||||||||||||||||||
| 499 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2042 | ▶ | if ($basis == 1 && $tc->check_publisher_restriction($pid, RequireConsent, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$basis == 1 and $tc->check_publisher_restriction($pid, 1, $vendor_id)
MC/DC100%2/2
$basis == 1 and $tc->check_publisher_restriction($pid, 1, $vendor_id)
$basis == 1
$tc->check_publisher_restriction($pid, 1, $vendor_id)
Truth table100%3/3
A and B
A= $basis == 1B= $tc->check_publisher_restriction($pid, 1, $vendor_id)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 294 | return GDPR::IAB::TCFv2::Validator::Failure->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | code => ReasonPublisherRestrictionRequireConsent, | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | message => "publisher restriction: purpose $pid requires consent (vendor $vendor_id)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 506 | purpose_id => $pid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 507 | vendor_id => $vendor_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 508 | restriction_type => RequireConsent, | ||||||||||||||||||||||||||||||||||||||||||||||
| 509 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 1748 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 9282 | ▶ | sub _make_result { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_result: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 9282 | my ($self, $ok, $failures) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 9282 | return GDPR::IAB::TCFv2::Validator::Result->new(ok => $ok, failures => $failures,); | |||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 27 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 523 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||