Adjust conditions for unlawful cookies
This commit is contained in:
parent
2b6346bca0
commit
54e5040348
|
@ -22,6 +22,7 @@ function generateHostPage(
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
title: `Cel ujawnienia danych właścicielowi domeny ${host}`,
|
title: `Cel ujawnienia danych właścicielowi domeny ${host}`,
|
||||||
...defaultValue('present'),
|
...defaultValue('present'),
|
||||||
|
visibleIf: '{popup_type} != "none"',
|
||||||
choices: [
|
choices: [
|
||||||
{
|
{
|
||||||
value: 'not_mentioned',
|
value: 'not_mentioned',
|
||||||
|
@ -140,7 +141,7 @@ function generateHostPage(
|
||||||
...defaultValue('was_processing_necessary'),
|
...defaultValue('was_processing_necessary'),
|
||||||
visibleIf: `{${f('legal_basis_type')}} = "legitimate_interest" or {${f(
|
visibleIf: `{${f('legal_basis_type')}} = "legitimate_interest" or {${f(
|
||||||
'present'
|
'present'
|
||||||
)}} = "not_mentioned"`,
|
)}} = "not_mentioned" or {popup_type} = "none"`,
|
||||||
choices: [
|
choices: [
|
||||||
{ value: 'yes', text: 'Tak, było konieczne' },
|
{ value: 'yes', text: 'Tak, było konieczne' },
|
||||||
{ value: 'no', text: 'Nie, nie było konieczne' },
|
{ value: 'no', text: 'Nie, nie było konieczne' },
|
||||||
|
|
|
@ -3,66 +3,65 @@ import RawAnswers, { BasicRawAnswers, HostRawAnswers } from './raw-answers';
|
||||||
export type RecordValue<T> = T extends Record<any, infer R> ? R : any;
|
export type RecordValue<T> = T extends Record<any, infer R> ? R : any;
|
||||||
|
|
||||||
export type ParsedHostAnswers = ({
|
export type ParsedHostAnswers = ({
|
||||||
present:
|
present:
|
||||||
| 'not_mentioned'
|
| 'not_mentioned'
|
||||||
| 'not_before_making_a_choice'
|
| 'not_before_making_a_choice'
|
||||||
| 'mentioned_in_policy'
|
| 'mentioned_in_policy'
|
||||||
| 'mentioned_in_popup';
|
| 'mentioned_in_popup';
|
||||||
legal_basis_type: 'consent' | 'legitimate_interes' | 'not_mentioned';
|
legal_basis_type: 'consent' | 'legitimate_interes' | 'not_mentioned';
|
||||||
popup_action: 'none' | 'closed_popup' | 'accept_all' | 'deny_all' | 'other';
|
was_processing_necessary: 'yes' | 'no' | 'not_sure';
|
||||||
was_processing_necessary: 'yes' | 'no' | 'not_sure';
|
|
||||||
} & (
|
} & (
|
||||||
| {
|
| {
|
||||||
consent_problems:
|
consent_problems:
|
||||||
| 'claims_consent_but_sends_before_consent'
|
| 'claims_consent_but_sends_before_consent'
|
||||||
| 'claims_consent_but_there_was_no_easy_refuse';
|
| 'claims_consent_but_there_was_no_easy_refuse';
|
||||||
}
|
}
|
||||||
| { consent_problems: 'none'; outside_eu: 'yes' | 'no' | 'not_sure' }
|
| { consent_problems: 'none'; outside_eu: 'yes' | 'no' | 'not_sure' }
|
||||||
)) & {
|
)) & {
|
||||||
legitimate_interest_activity_specified: 'no' | 'precise' | 'vague';
|
legitimate_interest_activity_specified: 'no' | 'precise' | 'vague';
|
||||||
outside_eu: 'yes' | 'no' | 'not_sure';
|
outside_eu: 'yes' | 'no' | 'not_sure';
|
||||||
legitimate_interest_description?: string;
|
legitimate_interest_description?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ParsedAnswers = BasicRawAnswers & { hosts: Record<string, ParsedHostAnswers> };
|
export type ParsedAnswers = BasicRawAnswers & { hosts: Record<string, ParsedHostAnswers> };
|
||||||
|
|
||||||
function parseHostAnswers(
|
function parseHostAnswers(
|
||||||
raw_answers: Record<keyof HostRawAnswers, string>
|
raw_answers: Record<keyof HostRawAnswers, string>
|
||||||
): Record<string, ParsedHostAnswers> {
|
): Record<string, ParsedHostAnswers> {
|
||||||
const result: Record<string, Record<string, string>> = {};
|
const result: Record<string, Record<string, string>> = {};
|
||||||
for (const [key, value] of Object.entries(raw_answers)) {
|
for (const [key, value] of Object.entries(raw_answers)) {
|
||||||
const [masked_host, attr] = key.split('|');
|
const [masked_host, attr] = key.split('|');
|
||||||
const host = masked_host.replace(/_/g, '.');
|
const host = masked_host.replace(/_/g, '.');
|
||||||
if (!result[host]) {
|
if (!result[host]) {
|
||||||
result[host] = {} as ParsedHostAnswers;
|
result[host] = {} as ParsedHostAnswers;
|
||||||
}
|
}
|
||||||
result[host][attr] = value;
|
result[host][attr] = value;
|
||||||
}
|
}
|
||||||
return result as Record<string, ParsedHostAnswers>;
|
return result as Record<string, ParsedHostAnswers>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseAnswers({
|
export function parseAnswers({
|
||||||
zaimek,
|
zaimek,
|
||||||
is_incognito_different,
|
is_incognito_different,
|
||||||
policy_readable,
|
policy_readable,
|
||||||
popup_type,
|
popup_type,
|
||||||
cookie_wall,
|
cookie_wall,
|
||||||
passive_consent_description,
|
passive_consent_description,
|
||||||
mentions_passive_consent,
|
mentions_passive_consent,
|
||||||
rejection_is_hard,
|
rejection_is_hard,
|
||||||
administrator_identity_available_before_choice,
|
administrator_identity_available_before_choice,
|
||||||
...rest
|
...rest
|
||||||
}: RawAnswers): ParsedAnswers {
|
}: RawAnswers): ParsedAnswers {
|
||||||
return {
|
return {
|
||||||
zaimek,
|
zaimek,
|
||||||
is_incognito_different,
|
is_incognito_different,
|
||||||
policy_readable,
|
policy_readable,
|
||||||
popup_type,
|
popup_type,
|
||||||
cookie_wall,
|
cookie_wall,
|
||||||
passive_consent_description,
|
passive_consent_description,
|
||||||
mentions_passive_consent,
|
mentions_passive_consent,
|
||||||
rejection_is_hard,
|
rejection_is_hard,
|
||||||
administrator_identity_available_before_choice,
|
administrator_identity_available_before_choice,
|
||||||
hosts: parseHostAnswers(rest),
|
hosts: parseHostAnswers(rest),
|
||||||
} as ParsedAnswers;
|
} as ParsedAnswers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,22 @@ export class UnlawfulCookieAccess extends Problem {
|
||||||
getNecessaryExplainers(): ExplainerKey[] {
|
getNecessaryExplainers(): ExplainerKey[] {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qualifies(answers: ParsedAnswers, clusters: RequestCluster[]): boolean {
|
||||||
|
// są cookiesy, nie było zgody, nie są konieczne do działania strony
|
||||||
|
const cookie_clusters = Object.values(clusters).filter((c) => c.hasMarkedCookies());
|
||||||
|
return cookie_clusters.some((cluster) => {
|
||||||
|
const hostAnswers = answers.hosts[cluster.id];
|
||||||
|
return (
|
||||||
|
(hostAnswers.present == 'not_mentioned' ||
|
||||||
|
hostAnswers.present == 'not_before_making_a_choice' ||
|
||||||
|
['none', 'closed_popup', 'deny_all'].includes(answers.popup_action) ||
|
||||||
|
answers.popup_type === 'none') &&
|
||||||
|
hostAnswers.was_processing_necessary != 'yes'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getEmailContent() {
|
getEmailContent() {
|
||||||
const cookie_clusters = Object.values(this.clusters).filter((c) => c.hasMarkedCookies());
|
const cookie_clusters = Object.values(this.clusters).filter((c) => c.hasMarkedCookies());
|
||||||
const unnecessary_hosts = Object.entries(this.answers.hosts)
|
const unnecessary_hosts = Object.entries(this.answers.hosts)
|
||||||
|
@ -152,17 +168,4 @@ export class UnlawfulCookieAccess extends Problem {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
static qualifies(answers: ParsedAnswers, clusters: RequestCluster[]): boolean {
|
|
||||||
// są cookiesy, nie było zgody, nie są konieczne do działania strony
|
|
||||||
const cookie_clusters = Object.values(clusters).filter((c) => c.hasMarkedCookies());
|
|
||||||
return cookie_clusters.some((cluster) => {
|
|
||||||
const hostAnswers = answers.hosts[cluster.id];
|
|
||||||
return (
|
|
||||||
(hostAnswers.present == 'not_mentioned' ||
|
|
||||||
hostAnswers.present == 'not_before_making_a_choice' ||
|
|
||||||
['none', 'closed_popup', 'deny_all'].includes(hostAnswers.popup_action)) &&
|
|
||||||
hostAnswers.was_processing_necessary != 'yes'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
export type HostRawAnswers = {
|
export type HostRawAnswers = {
|
||||||
[key: `${string}|present`]:
|
[key: `${string}|present`]:
|
||||||
| 'not_mentioned'
|
| 'not_mentioned'
|
||||||
| 'not_before_making_a_choice'
|
| 'not_before_making_a_choice'
|
||||||
| 'mentioned_in_policy'
|
| 'mentioned_in_policy'
|
||||||
| 'mentioned_in_popup';
|
| 'mentioned_in_popup';
|
||||||
[key: `${string}|legal_basis_type`]: 'consent' | 'legitimate_interest' | 'not_mentioned';
|
[key: `${string}|legal_basis_type`]: 'consent' | 'legitimate_interest' | 'not_mentioned';
|
||||||
[key: `${string}|consent`]:
|
[key: `${string}|consent`]:
|
||||||
| 'claims_consent_but_sends_before_consent'
|
| 'claims_consent_but_sends_before_consent'
|
||||||
| 'claims_consent_but_there_was_no_easy_refuse'
|
| 'claims_consent_but_there_was_no_easy_refuse'
|
||||||
| 'none';
|
| 'none';
|
||||||
[key: `${string}|legitimate_interest_activity_specified`]: 'precise' | 'vague' | 'no';
|
[key: `${string}|legitimate_interest_activity_specified`]: 'precise' | 'vague' | 'no';
|
||||||
[key: `${string}|legitimate_interest_description`]: string;
|
[key: `${string}|legitimate_interest_description`]: string;
|
||||||
[key: `${string}|outside_eu`]: 'yes' | 'no' | 'not_sure';
|
[key: `${string}|outside_eu`]: 'yes' | 'no' | 'not_sure';
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BasicRawAnswers = {
|
export type BasicRawAnswers = {
|
||||||
zaimek: 0 | 1 | 2 | 3;
|
zaimek: 0 | 1 | 2 | 3;
|
||||||
is_incognito_different: [] | ['incognito_is_the_same'];
|
is_incognito_different: [] | ['incognito_is_the_same'];
|
||||||
policy_readable: 'yes' | 'vague' | 'cant_find';
|
policy_readable: 'yes' | 'vague' | 'cant_find';
|
||||||
popup_action: 'none' | 'closed_popup' | 'accept_all' | 'deny_all' | 'other';
|
popup_action: 'none' | 'closed_popup' | 'accept_all' | 'deny_all' | 'other';
|
||||||
popup_closed_how: string;
|
popup_closed_how: string;
|
||||||
popup_deny_all_how: string;
|
popup_deny_all_how: string;
|
||||||
} & (
|
} & (
|
||||||
| ({
|
| ({
|
||||||
popup_type: 'passive_popup';
|
popup_type: 'passive_popup';
|
||||||
cookie_wall: 'yes' | 'no';
|
cookie_wall: 'yes' | 'no';
|
||||||
rejection_is_hard: undefined;
|
rejection_is_hard: undefined;
|
||||||
administrator_identity_available_before_choice: undefined;
|
administrator_identity_available_before_choice: undefined;
|
||||||
} & (
|
} & (
|
||||||
| {
|
| {
|
||||||
mentions_passive_consent?: 'yes';
|
mentions_passive_consent?: 'yes';
|
||||||
passive_consent_description: string;
|
passive_consent_description: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
mentions_passive_consent?: 'no';
|
mentions_passive_consent?: 'no';
|
||||||
passive_consent_description: undefined;
|
passive_consent_description: undefined;
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
| {
|
| {
|
||||||
popup_type: 'some_choice';
|
popup_type: 'some_choice';
|
||||||
rejection_is_hard: 'yes' | 'no';
|
rejection_is_hard: 'yes' | 'no';
|
||||||
administrator_identity_available_before_choice: 'yes' | 'no';
|
administrator_identity_available_before_choice: 'yes' | 'no';
|
||||||
cookie_wall: undefined;
|
cookie_wall: undefined;
|
||||||
passive_consent_description: undefined;
|
passive_consent_description: undefined;
|
||||||
mentions_passive_consent: undefined;
|
mentions_passive_consent: undefined;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
popup_type: 'none' | 'page';
|
popup_type: 'none' | 'page';
|
||||||
cookie_wall: undefined;
|
cookie_wall: undefined;
|
||||||
passive_consent_description: undefined;
|
passive_consent_description: undefined;
|
||||||
mentions_passive_consent: undefined;
|
mentions_passive_consent: undefined;
|
||||||
rejection_is_hard: undefined;
|
rejection_is_hard: undefined;
|
||||||
administrator_identity_available_before_choice: undefined;
|
administrator_identity_available_before_choice: undefined;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
type RawAnswers = BasicRawAnswers & HostRawAnswers;
|
type RawAnswers = BasicRawAnswers & HostRawAnswers;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user