@simmalugnt-se/payload-consent 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +8 -4
- package/dist/access.d.ts +1 -1
- package/dist/access.js +4 -3
- package/dist/admin/ScanPanel.js +8 -8
- package/dist/evaluate.d.ts +3 -2
- package/dist/evaluate.js +7 -1
- package/dist/records.js +2 -1
- package/dist/scans.js +18 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
- Another site contacted before a choice no longer needs action, whatever its service's category:
|
|
6
|
+
it stores nothing in the visitor's device, which is what the Swedish cookie rule covers, as PTS
|
|
7
|
+
describes it. It is still listed, and still goes in a service, for the cookie table and the
|
|
8
|
+
privacy policy. Cookies and localStorage are judged as before.
|
|
9
|
+
|
|
10
|
+
## 0.8.0
|
|
11
|
+
|
|
12
|
+
- The consent log's Allowed categories and a scan's Status show English and Swedish names instead
|
|
13
|
+
of their stored values (`necessary`, `queued`), and a scan's start and finish times have labels.
|
|
14
|
+
Stored values are unchanged, so no migration.
|
|
15
|
+
- `access.manage` defaults to users signed in to Admin (the config's `admin.user`). Any signed-in
|
|
16
|
+
user could manage cookies and read the consent log, a site member or customer from another auth
|
|
17
|
+
collection too. A site that passes `access.manage` is unaffected.
|
|
18
|
+
|
|
3
19
|
## 0.7.1
|
|
4
20
|
|
|
5
21
|
- A scan after one that found nothing marks everything it finds as new, and so sends its email.
|
package/README.md
CHANGED
|
@@ -164,12 +164,15 @@ everything and why, in words rather than the scanner's errors. It counts the pag
|
|
|
164
164
|
states, cookies, localStorage keys and other sites, and lists the pages. Below it, the tab shows
|
|
165
165
|
every cookie, localStorage key and third-party host:
|
|
166
166
|
|
|
167
|
-
- **Needs action**: a service seen in a state that does not allow its
|
|
168
|
-
before consent.
|
|
167
|
+
- **Needs action**: a service's cookie or localStorage key seen in a state that does not allow its
|
|
168
|
+
category, such as analytics before consent. Another site never needs action: the Swedish cookie
|
|
169
|
+
rule, as PTS describes it, covers storing or reading information in the visitor's device, and
|
|
170
|
+
contacting another site stores nothing there. Other sites still go in the services, so the cookie
|
|
171
|
+
table and the privacy policy can name who receives data.
|
|
169
172
|
- **Not in the Cookie services**: nothing explains it. Each comes with a suggestion from the Open
|
|
170
173
|
Cookie Database where there is one; Add to service puts it in a new or existing service (with
|
|
171
174
|
`_ga_*` rather than one property's `_ga_G123`), and the scan is judged again.
|
|
172
|
-
- **In order**: explained
|
|
175
|
+
- **In order**: explained, with storage seen only where allowed.
|
|
173
176
|
|
|
174
177
|
The Scan tab says how to handle each group, using c15t's own ways: a tool in the list under Loaded
|
|
175
178
|
by is picked there, an embed goes in `ConsentFrame`, and other code goes in `scripts`, so c15t loads
|
|
@@ -304,7 +307,8 @@ banner's own consent storage first: `c15t` (the choice), `c15t-sid` (the visitor
|
|
|
304
307
|
The global and the services are public to read by default (`access.read`), since the site shows
|
|
305
308
|
them to everyone. `access.manage` says who works with cookies in Admin: changing the texts and
|
|
306
309
|
services, reading the consent log, the policies, the scans and their evidence, starting a scan and
|
|
307
|
-
adding its findings, and seeing the dashboard widget. It defaults to signed
|
|
310
|
+
adding its findings, and seeing the dashboard widget. It defaults to users signed in to Admin
|
|
311
|
+
(the config's `admin.user`), not users of another auth collection such as site members; with roles,
|
|
308
312
|
pass the project's:
|
|
309
313
|
|
|
310
314
|
```ts
|
package/dist/access.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Access, PayloadRequest } from "payload";
|
|
2
2
|
import type { ConsentPluginOptions } from "./types.ts";
|
|
3
|
-
/** Who works with cookies in Admin (`access.manage`);
|
|
3
|
+
/** Who works with cookies in Admin (`access.manage`); Admin's users unless the host says. */
|
|
4
4
|
export declare function manageAccess(options: ConsentPluginOptions): Access;
|
|
5
5
|
/** Whether `manage` lets this request through; a query result counts as yes. */
|
|
6
6
|
export declare function canManage(options: ConsentPluginOptions, req: PayloadRequest): Promise<boolean>;
|
package/dist/access.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** Signed in to Admin: a user of the config's `admin.user`, not of another auth collection. */
|
|
2
|
+
const adminUser = ({ req }) => Boolean(req.user && req.user.collection === req.payload.config.admin.user);
|
|
3
|
+
/** Who works with cookies in Admin (`access.manage`); Admin's users unless the host says. */
|
|
3
4
|
export function manageAccess(options) {
|
|
4
|
-
return options.access?.manage ??
|
|
5
|
+
return options.access?.manage ?? adminUser;
|
|
5
6
|
}
|
|
6
7
|
/** Whether `manage` lets this request through; a query result counts as yes. */
|
|
7
8
|
export async function canManage(options, req) {
|
package/dist/admin/ScanPanel.js
CHANGED
|
@@ -45,10 +45,10 @@ const COPY = {
|
|
|
45
45
|
choosing: "Choosing the pages to visit…",
|
|
46
46
|
finishing: "The scan is done. Its result is on its way to this site.",
|
|
47
47
|
late: "The result has not arrived. If the scanner could not reach this site, the scan is marked as failed within a day.",
|
|
48
|
-
action: "Services
|
|
48
|
+
action: "Services store cookies or other data where the visitor has not allowed their category.",
|
|
49
49
|
unknown: "The scan found storage or other sites that no Cookie service explains.",
|
|
50
50
|
incomplete: "It may have missed something. Scan again once this is fixed:",
|
|
51
|
-
ok: "Everything the scan found is in the Cookie services and
|
|
51
|
+
ok: "Everything the scan found is in the Cookie services, and stores data only where its category is allowed.",
|
|
52
52
|
clean: "The scan found no cookies, no storage and no requests to other sites.",
|
|
53
53
|
},
|
|
54
54
|
stage: (state, stage) => [
|
|
@@ -85,9 +85,9 @@ const COPY = {
|
|
|
85
85
|
ok: "In order",
|
|
86
86
|
},
|
|
87
87
|
explain: {
|
|
88
|
-
action: "
|
|
88
|
+
action: "Stored where their category is not allowed. A tool in the list under Loaded by: pick “This plugin, after consent” on the service. An embed: wrap it in ConsentFrame. Other code: pass it to ConsentProvider's scripts, so c15t loads it after consent.",
|
|
89
89
|
unknown: "Add each to a service: Necessary if the site cannot work without it, otherwise the category that fits. Or remove it from the site.",
|
|
90
|
-
ok: "In a Cookie service
|
|
90
|
+
ok: "In a Cookie service. Cookies and storage appear only where their category is allowed; other sites store nothing, so they only need to be in the services, for the cookie table and the privacy policy.",
|
|
91
91
|
},
|
|
92
92
|
// What the finding is, leading the sentence of when it was seen.
|
|
93
93
|
seen: {
|
|
@@ -164,10 +164,10 @@ const COPY = {
|
|
|
164
164
|
choosing: "Väljer vilka sidor som ska besökas…",
|
|
165
165
|
finishing: "Skanningen är klar. Resultatet är på väg till webbplatsen.",
|
|
166
166
|
late: "Resultatet har inte kommit. Om skannern inte nådde webbplatsen markeras skanningen som misslyckad inom ett dygn.",
|
|
167
|
-
action: "Tjänster
|
|
167
|
+
action: "Tjänster lagrar cookies eller annan data där besökaren inte har tillåtit kategorin.",
|
|
168
168
|
unknown: "Skanningen hittade lagring eller andra webbplatser som ingen Cookietjänst förklarar.",
|
|
169
169
|
incomplete: "Den kan ha missat något. Skanna igen när det här är åtgärdat:",
|
|
170
|
-
ok: "Allt skanningen hittade finns bland Cookietjänsterna och
|
|
170
|
+
ok: "Allt skanningen hittade finns bland Cookietjänsterna och lagrar bara data där kategorin är tillåten.",
|
|
171
171
|
clean: "Skanningen hittade inga cookies, ingen lagring och inga anrop till andra webbplatser.",
|
|
172
172
|
},
|
|
173
173
|
stage: (state, stage) => [
|
|
@@ -204,9 +204,9 @@ const COPY = {
|
|
|
204
204
|
ok: "I ordning",
|
|
205
205
|
},
|
|
206
206
|
explain: {
|
|
207
|
-
action: "
|
|
207
|
+
action: "Lagras där kategorin inte är tillåten. Ett verktyg i listan under Laddas av: välj ”Det här pluginet, efter samtycke” i tjänsten. En inbäddning: lägg den i ConsentFrame. Annan kod: skicka den till ConsentProviders scripts, så laddar c15t den efter samtycke.",
|
|
208
208
|
unknown: "Lägg var och en i en tjänst: Nödvändig om webbplatsen inte fungerar utan den, annars den kategori som passar. Eller ta bort den från webbplatsen.",
|
|
209
|
-
ok: "Finns i en Cookietjänst och syns bara där kategorin är tillåten.",
|
|
209
|
+
ok: "Finns i en Cookietjänst. Cookies och lagring syns bara där kategorin är tillåten; andra webbplatser lagrar inget och behöver bara finnas bland tjänsterna, för cookietabellen och integritetspolicyn.",
|
|
210
210
|
},
|
|
211
211
|
seen: {
|
|
212
212
|
cookie: "Cookie som sätts",
|
package/dist/evaluate.d.ts
CHANGED
|
@@ -59,8 +59,9 @@ export type ScanResultState = {
|
|
|
59
59
|
};
|
|
60
60
|
export type FindingKind = "cookie" | "localStorage" | "host";
|
|
61
61
|
/**
|
|
62
|
-
* `ok`: explained and only where its category is allowed. `action`: a service seen in a
|
|
63
|
-
* that does not allow its category
|
|
62
|
+
* `ok`: explained and only where its category is allowed. `action`: storage of a service seen in a
|
|
63
|
+
* state that does not allow its category; another site never needs action, since it stores
|
|
64
|
+
* nothing. `unknown`: nothing in the services explains it.
|
|
64
65
|
*/
|
|
65
66
|
export type FindingStatus = "ok" | "action" | "unknown";
|
|
66
67
|
export type Finding = {
|
package/dist/evaluate.js
CHANGED
|
@@ -114,7 +114,13 @@ export function evaluateScan({ states, results, services, previousKeys, }) {
|
|
|
114
114
|
const category = service.category;
|
|
115
115
|
finding.service = service.name ?? undefined;
|
|
116
116
|
finding.category = category;
|
|
117
|
-
|
|
117
|
+
// Only storage needs consent: the Swedish cookie rule, as PTS describes it, covers storing or
|
|
118
|
+
// reading information in the visitor's device. Another site contacted stores nothing there,
|
|
119
|
+
// so it is listed, for the privacy policy, but never needs action.
|
|
120
|
+
finding.withoutConsent =
|
|
121
|
+
finding.kind === "host"
|
|
122
|
+
? []
|
|
123
|
+
: finding.states.filter((stateId) => category !== "necessary" && !allowedIn.get(stateId)?.has(category));
|
|
118
124
|
finding.status = finding.withoutConsent.length ? "action" : "ok";
|
|
119
125
|
}
|
|
120
126
|
const order = { action: 0, unknown: 1, ok: 2 };
|
package/dist/records.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { manageAccess } from "./access.js";
|
|
2
2
|
import { CATEGORIES } from "./defaults.js";
|
|
3
|
+
import { categoryLabels } from "./global.js";
|
|
3
4
|
import { allowedOrigin, clientKey, createRateLimit, MAX_RECORD_BYTES } from "./record-guard.js";
|
|
4
5
|
import { readConsent, toConsentConfig } from "./site-config.js";
|
|
5
6
|
import { CONSENT_POLICIES, CONSENT_RECORDS, DEFAULT_RETENTION_DAYS, } from "./types.js";
|
|
@@ -204,7 +205,7 @@ export function recordsCollection(options) {
|
|
|
204
205
|
type: "select",
|
|
205
206
|
hasMany: true,
|
|
206
207
|
label: { en: "Allowed", sv: "Tillåtna" },
|
|
207
|
-
options: CATEGORIES.map((value) => ({ value, label: value })),
|
|
208
|
+
options: CATEGORIES.map((value) => ({ value, label: categoryLabels[value] })),
|
|
208
209
|
},
|
|
209
210
|
{ name: "choices", type: "json", label: { en: "Choices", sv: "Val" } },
|
|
210
211
|
{
|
package/dist/scans.js
CHANGED
|
@@ -568,7 +568,12 @@ export function scansCollection(options) {
|
|
|
568
568
|
name: "status",
|
|
569
569
|
type: "select",
|
|
570
570
|
label: { en: "Status", sv: "Status" },
|
|
571
|
-
options: [
|
|
571
|
+
options: [
|
|
572
|
+
{ value: "queued", label: { en: "Queued", sv: "I kö" } },
|
|
573
|
+
{ value: "running", label: { en: "Running", sv: "Pågår" } },
|
|
574
|
+
{ value: "done", label: { en: "Done", sv: "Klar" } },
|
|
575
|
+
{ value: "failed", label: { en: "Failed", sv: "Misslyckades" } },
|
|
576
|
+
],
|
|
572
577
|
},
|
|
573
578
|
{
|
|
574
579
|
name: "trigger",
|
|
@@ -581,8 +586,18 @@ export function scansCollection(options) {
|
|
|
581
586
|
},
|
|
582
587
|
{ name: "scanId", type: "text", index: true, admin: { hidden: true } },
|
|
583
588
|
{ name: "error", type: "text", label: { en: "Error", sv: "Fel" } },
|
|
584
|
-
{
|
|
585
|
-
|
|
589
|
+
{
|
|
590
|
+
name: "startedAt",
|
|
591
|
+
type: "date",
|
|
592
|
+
label: { en: "Start time", sv: "Starttid" },
|
|
593
|
+
admin: { date: { pickerAppearance: "dayAndTime" } },
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: "finishedAt",
|
|
597
|
+
type: "date",
|
|
598
|
+
label: { en: "Finish time", sv: "Sluttid" },
|
|
599
|
+
admin: { date: { pickerAppearance: "dayAndTime" } },
|
|
600
|
+
},
|
|
586
601
|
{ name: "summary", type: "json", label: { en: "Summary", sv: "Sammanfattning" } },
|
|
587
602
|
{ name: "findings", type: "json", label: { en: "Findings", sv: "Fynd" } },
|
|
588
603
|
{ name: "states", type: "json", label: { en: "States", sv: "Lägen" } },
|