@certrev/cert-block 0.5.5 → 1.0.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 +189 -25
- package/LICENSE +21 -0
- package/README.md +415 -54
- package/dist/builder/cert-chrome-data.d.ts +26 -8
- package/dist/builder/cert-chrome-data.d.ts.map +1 -1
- package/dist/builder/cert-chrome-data.js +5 -5
- package/dist/builder/cert-chrome-data.js.map +1 -1
- package/dist/builder/cert-review-card.d.ts +35 -5
- package/dist/builder/cert-review-card.d.ts.map +1 -1
- package/dist/builder/cert-review-card.js +117 -34
- package/dist/builder/cert-review-card.js.map +1 -1
- package/dist/builder/index.d.ts +33 -16
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +33 -16
- package/dist/builder/index.js.map +1 -1
- package/dist/components/CertBadge.d.ts +2 -2
- package/dist/components/CertBadge.d.ts.map +1 -1
- package/dist/components/CertBadge.js +11 -5
- package/dist/components/CertBadge.js.map +1 -1
- package/dist/components/CertJsonLd.d.ts.map +1 -1
- package/dist/components/CertJsonLd.js.map +1 -1
- package/dist/components/CertRevBacklink.d.ts.map +1 -1
- package/dist/components/CertRevBacklink.js +3 -2
- package/dist/components/CertRevBacklink.js.map +1 -1
- package/dist/components/CertReview.d.ts +1 -1
- package/dist/components/ExpertBio.d.ts.map +1 -1
- package/dist/components/ExpertBio.js +12 -4
- package/dist/components/ExpertBio.js.map +1 -1
- package/dist/components/escape.d.ts +28 -1
- package/dist/components/escape.d.ts.map +1 -1
- package/dist/components/escape.js +37 -8
- package/dist/components/escape.js.map +1 -1
- package/dist/components/format.d.ts +51 -2
- package/dist/components/format.d.ts.map +1 -1
- package/dist/components/format.js +103 -6
- package/dist/components/format.js.map +1 -1
- package/dist/components/preview-block.d.ts +1 -1
- package/dist/components/preview-block.js +3 -3
- package/dist/components/preview-block.js.map +1 -1
- package/dist/components/rel.d.ts +24 -0
- package/dist/components/rel.d.ts.map +1 -0
- package/dist/components/rel.js +24 -0
- package/dist/components/rel.js.map +1 -0
- package/dist/components/render-cert-block.d.ts +50 -22
- package/dist/components/render-cert-block.d.ts.map +1 -1
- package/dist/components/render-cert-block.js +146 -80
- package/dist/components/render-cert-block.js.map +1 -1
- package/dist/components/render-def.d.ts +13 -14
- package/dist/components/render-def.d.ts.map +1 -1
- package/dist/components/render-def.js +14 -15
- package/dist/components/render-def.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonld/project.d.ts +46 -13
- package/dist/jsonld/project.d.ts.map +1 -1
- package/dist/jsonld/project.js +139 -56
- package/dist/jsonld/project.js.map +1 -1
- package/dist/modal/avatar-resize.d.ts +10 -10
- package/dist/modal/avatar-resize.js +14 -14
- package/dist/modal/avatar-resize.js.map +1 -1
- package/dist/modal/cert-modal-view.d.ts +27 -7
- package/dist/modal/cert-modal-view.d.ts.map +1 -1
- package/dist/modal/cert-modal-view.js +49 -25
- package/dist/modal/cert-modal-view.js.map +1 -1
- package/dist/modal/certrev-cert-modal.d.ts +5 -5
- package/dist/modal/certrev-cert-modal.js +9 -9
- package/dist/modal/certrev-cert-modal.js.map +1 -1
- package/dist/modal/certrev-cert-modal.styles.d.ts +6 -6
- package/dist/modal/certrev-cert-modal.styles.d.ts.map +1 -1
- package/dist/modal/certrev-cert-modal.styles.js +8 -8
- package/dist/modal/certrev-cert-modal.styles.js.map +1 -1
- package/dist/modal/certrev-cert.entry.d.ts +8 -6
- package/dist/modal/certrev-cert.entry.d.ts.map +1 -1
- package/dist/modal/certrev-cert.entry.js +9 -7
- package/dist/modal/certrev-cert.entry.js.map +1 -1
- package/dist/modal/certrev-cert.js +6 -6
- package/dist/modal/display-strings.d.ts +25 -5
- package/dist/modal/display-strings.d.ts.map +1 -1
- package/dist/modal/display-strings.js +27 -5
- package/dist/modal/display-strings.js.map +1 -1
- package/dist/modal/escape.d.ts +26 -3
- package/dist/modal/escape.d.ts.map +1 -1
- package/dist/modal/escape.js +32 -3
- package/dist/modal/escape.js.map +1 -1
- package/dist/modal/font-face.d.ts.map +1 -1
- package/dist/modal/font-face.js +8 -11
- package/dist/modal/font-face.js.map +1 -1
- package/dist/modal/ftc-disclosure.d.ts +2 -2
- package/dist/modal/ftc-disclosure.js +2 -2
- package/dist/modal/ftc-guard.d.ts +44 -9
- package/dist/modal/ftc-guard.d.ts.map +1 -1
- package/dist/modal/ftc-guard.js +50 -17
- package/dist/modal/ftc-guard.js.map +1 -1
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/interactions.d.ts +2 -2
- package/dist/modal/interactions.js +2 -2
- package/dist/modal/logo-paths.js +2 -2
- package/dist/modal/logo-paths.js.map +1 -1
- package/dist/modal/placement.d.ts +4 -3
- package/dist/modal/placement.d.ts.map +1 -1
- package/dist/modal/placement.js +7 -6
- package/dist/modal/placement.js.map +1 -1
- package/dist/modal/revalidate.d.ts +2 -3
- package/dist/modal/revalidate.d.ts.map +1 -1
- package/dist/modal/revalidate.js +2 -3
- package/dist/modal/revalidate.js.map +1 -1
- package/dist/modal/verify-client.d.ts +2 -2
- package/dist/modal/verify-client.js +2 -2
- package/dist/verify/cache.d.ts +21 -6
- package/dist/verify/cache.d.ts.map +1 -1
- package/dist/verify/cache.js +29 -8
- package/dist/verify/cache.js.map +1 -1
- package/dist/verify/fetch-with-deadline.d.ts +35 -0
- package/dist/verify/fetch-with-deadline.d.ts.map +1 -0
- package/dist/verify/fetch-with-deadline.js +55 -0
- package/dist/verify/fetch-with-deadline.js.map +1 -0
- package/dist/verify/get-verified-envelope.d.ts +23 -9
- package/dist/verify/get-verified-envelope.d.ts.map +1 -1
- package/dist/verify/get-verified-envelope.js +89 -40
- package/dist/verify/get-verified-envelope.js.map +1 -1
- package/dist/verify/resolve-kid.d.ts +3 -0
- package/dist/verify/resolve-kid.d.ts.map +1 -1
- package/dist/verify/resolve-kid.js +17 -8
- package/dist/verify/resolve-kid.js.map +1 -1
- package/dist/webcomponent/certrev-badge.d.ts.map +1 -1
- package/dist/webcomponent/certrev-badge.js +24 -2
- package/dist/webcomponent/certrev-badge.js.map +1 -1
- package/dist/webcomponent/render-badge-html.d.ts +1 -1
- package/dist/webcomponent/render-badge-html.d.ts.map +1 -1
- package/dist/webcomponent/render-badge-html.js +36 -17
- package/dist/webcomponent/render-badge-html.js.map +1 -1
- package/package.json +5 -2
- package/src/builder/cert-chrome-data.ts +26 -8
- package/src/builder/cert-review-card.tsx +149 -38
- package/src/builder/index.tsx +34 -17
- package/src/components/CertBadge.tsx +14 -9
- package/src/components/CertJsonLd.tsx +1 -1
- package/src/components/CertRevBacklink.tsx +10 -3
- package/src/components/CertReview.tsx +1 -1
- package/src/components/ExpertBio.tsx +15 -8
- package/src/components/escape.ts +37 -7
- package/src/components/format.ts +102 -6
- package/src/components/preview-block.ts +3 -3
- package/src/components/rel.ts +23 -0
- package/src/components/render-cert-block.ts +192 -109
- package/src/components/render-def.ts +14 -15
- package/src/index.ts +4 -2
- package/src/jsonld/project.ts +155 -59
- package/src/modal/avatar-resize.ts +14 -14
- package/src/modal/cert-modal-view.ts +52 -27
- package/src/modal/certrev-cert-modal.styles.ts +8 -8
- package/src/modal/certrev-cert-modal.ts +9 -9
- package/src/modal/certrev-cert.entry.ts +9 -7
- package/src/modal/display-strings.ts +26 -5
- package/src/modal/escape.ts +32 -4
- package/src/modal/font-face.ts +8 -11
- package/src/modal/ftc-disclosure.ts +2 -2
- package/src/modal/ftc-guard.ts +73 -18
- package/src/modal/index.ts +1 -1
- package/src/modal/interactions.ts +2 -2
- package/src/modal/logo-paths.ts +2 -2
- package/src/modal/placement.ts +7 -6
- package/src/modal/revalidate.ts +2 -3
- package/src/modal/verify-client.ts +2 -2
- package/src/verify/cache.ts +34 -8
- package/src/verify/fetch-with-deadline.ts +60 -0
- package/src/verify/get-verified-envelope.ts +131 -48
- package/src/verify/resolve-kid.ts +22 -6
- package/src/webcomponent/certrev-badge.ts +24 -2
- package/src/webcomponent/render-badge-html.ts +66 -19
- package/src/__tests__/__snapshots__/render-cert-block.test.ts.snap +0 -17
- package/src/__tests__/components.test.tsx +0 -206
- package/src/__tests__/preview-block.test.ts +0 -84
- package/src/__tests__/project.test.ts +0 -128
- package/src/__tests__/readme-version.test.ts +0 -51
- package/src/__tests__/render-cert-block.test.ts +0 -657
- package/src/__tests__/render-def.test.tsx +0 -295
- package/src/__tests__/verify.test.ts +0 -239
- package/src/__tests__/webcomponent.test.tsx +0 -116
- package/src/builder/__tests__/builder.test.tsx +0 -158
- package/src/modal/cert-modal-view.test.ts +0 -175
- package/src/modal/certrev-cert-modal.test.ts +0 -125
- package/src/modal/ftc-guard.test.ts +0 -153
- package/src/modal/interactions.test.ts +0 -250
- package/src/modal/placement.test.ts +0 -398
- package/src/modal/revalidate.test.ts +0 -111
- package/src/modal/verify-client.test.ts +0 -164
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FTC disclosure tamper guard for the NATIVE Shopify cert render (iframe→native parity).
|
|
3
3
|
*
|
|
4
|
-
* In the cross-origin iframe model the expert-memo embed inlined
|
|
5
|
-
* (
|
|
4
|
+
* In the cross-origin iframe model the expert-memo embed inlined the portal's
|
|
5
|
+
* `ftcTamperGuardScript()`: a kill switch that blanks the memo if the verbatim FTC
|
|
6
6
|
* material-connection disclosure is stripped, hidden, or altered — making the MSA §3
|
|
7
7
|
* anti-stripping covenant TECHNICALLY enforced, not just contractual. The native memo renders
|
|
8
8
|
* in the host theme's DOM (no sandbox), so without this it would lose that runtime enforcement.
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
* - On tamper it neutralizes ONLY the memo (never `document.body` — we're in the host page).
|
|
18
18
|
* - The contributors card is governed by the badge re-verify (`revalidate.ts`), not this guard;
|
|
19
19
|
* the card carries only the one-word "Compensated" cue, never the guarded disclosure.
|
|
20
|
+
* - COVERAGE, and it is narrower than it reads: `.certrev-memo` / `.certrev-memo-wrap` are portal
|
|
21
|
+
* LIQUID markup — NOTHING in this package emits either. So the kill switch covers the Liquid
|
|
22
|
+
* memo surface and nothing else. `<CertBadge>` and `render-badge-html.ts` emit the same
|
|
23
|
+
* `[data-ftc-line]` hook inside a `.certrev-badge` (no memo), and `renderCertBlock` emits no
|
|
24
|
+
* hook at all; on those surfaces a pass verifies nothing and says so (`'unguarded'`) rather
|
|
25
|
+
* than reporting success, and no observer is installed at all. Widening enforcement to the
|
|
26
|
+
* badge is a live design decision, not an omission — see `FtcEnforcementResult`.
|
|
20
27
|
*
|
|
21
28
|
* Pure DOM, no crypto, no network. The expected text is the single source of truth
|
|
22
29
|
* `FTC_DISCLOSURE_LINE` (imported, not copied — so a reword can never desync this guard).
|
|
@@ -33,18 +40,46 @@ export declare function isDisclosureIntact(memo: Element): boolean;
|
|
|
33
40
|
* seal — so the surface can never read as an endorsement without its required disclosure.
|
|
34
41
|
*/
|
|
35
42
|
export declare function neutralizeMemo(memo: Element): void;
|
|
43
|
+
/**
|
|
44
|
+
* What ONE enforcement pass actually established:
|
|
45
|
+
* - `'intact'` — at least one memo was checked, and every one carried its verbatim, visible line.
|
|
46
|
+
* - `'tampered'` — at least one memo failed the check and was neutralized.
|
|
47
|
+
* - `'unguarded'` — the document holds no `.certrev-memo`, so the pass checked nothing.
|
|
48
|
+
*
|
|
49
|
+
* `'unguarded'` used to be reported as `true`, indistinguishable from `'intact'`, and that
|
|
50
|
+
* conflation was a correctness bug, not a cosmetic one: `.certrev-memo` is portal Liquid markup
|
|
51
|
+
* this package never emits, so on every React / Web Component / `renderCertBlock` surface the pass
|
|
52
|
+
* finds nothing and answered "all intact" about a disclosure it had never looked at — the kill
|
|
53
|
+
* switch silently reporting success on exactly the surfaces it does not protect.
|
|
54
|
+
*
|
|
55
|
+
* The legitimate no-memo certified article (card only, no memo, no disclosure owed) lands here too,
|
|
56
|
+
* and the guard genuinely cannot tell the two apart from the DOM alone. That is the point of a
|
|
57
|
+
* third state rather than a second boolean: "nothing was verified" is the honest answer to both,
|
|
58
|
+
* and it is the caller — which knows which surface it rendered — that can tell whether that is
|
|
59
|
+
* expected or a coverage gap.
|
|
60
|
+
*/
|
|
61
|
+
export type FtcEnforcementResult = 'intact' | 'tampered' | 'unguarded';
|
|
36
62
|
/**
|
|
37
63
|
* Enforce the disclosure across every memo in the doc: neutralize any whose disclosure isn't
|
|
38
|
-
* intact. A doc with no `.certrev-memo`
|
|
39
|
-
*
|
|
64
|
+
* intact. A doc with no `.certrev-memo` is a no-op — see `FtcEnforcementResult` for why that is
|
|
65
|
+
* `'unguarded'` and not success.
|
|
40
66
|
*/
|
|
41
|
-
export declare function enforceFtcDisclosure(doc: Document):
|
|
67
|
+
export declare function enforceFtcDisclosure(doc: Document): FtcEnforcementResult;
|
|
42
68
|
/**
|
|
43
69
|
* Install the guard once per document: enforce now (on DOM ready) and re-enforce on later DOM
|
|
44
|
-
* mutations within the
|
|
45
|
-
* after load still trips the kill switch.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
70
|
+
* mutations within the guarded subtree(s) — so a host script that strips / hides / edits the
|
|
71
|
+
* disclosure after load still trips the kill switch. Idempotent.
|
|
72
|
+
*
|
|
73
|
+
* The observer scope is the memo wrap(s) — placement.ts relocates a wrap as a node, so the observer
|
|
74
|
+
* tracks it wherever it moves — plus any memo sitting outside a wrap. When the document has
|
|
75
|
+
* NEITHER, NO observer is installed at all. That bail-out is the whole storefront case, not an edge
|
|
76
|
+
* one: this package emits neither selector (both are portal Liquid), so the old `<body>` fallback
|
|
77
|
+
* was the only branch a React / Web Component / `renderCertBlock` page could take, and it pinned a
|
|
78
|
+
* subtree + attributes + characterData observer — no `attributeFilter`, no coalescing — on the
|
|
79
|
+
* host's entire page for the life of the tab, re-running an enforce pass on EVERY mutation a busy
|
|
80
|
+
* storefront makes, to query a selector that could never match. A guard watching a page it cannot
|
|
81
|
+
* act on is pure cost; `enforceFtcDisclosure`'s `'unguarded'` result is the correctness half of the
|
|
82
|
+
* same gap.
|
|
48
83
|
*/
|
|
49
84
|
export declare function installFtcGuard(doc: Document): void;
|
|
50
85
|
//# sourceMappingURL=ftc-guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ftc-guard.d.ts","sourceRoot":"","sources":["../../src/modal/ftc-guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ftc-guard.d.ts","sourceRoot":"","sources":["../../src/modal/ftc-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,eAAO,MAAM,iBAAiB,oBAAoB,CAAA;AAClD,eAAO,MAAM,aAAa,kBAAkB,CAAA;AAC5C,eAAO,MAAM,kBAAkB,uBAAuB,CAAA;AACtD,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,iCAAiC,CAAA;AAgClE,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKzD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAUlD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;AAEtE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,GAAG,oBAAoB,CAWxE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CA0BnD"}
|
package/dist/modal/ftc-guard.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FTC disclosure tamper guard for the NATIVE Shopify cert render (iframe→native parity).
|
|
3
3
|
*
|
|
4
|
-
* In the cross-origin iframe model the expert-memo embed inlined
|
|
5
|
-
* (
|
|
4
|
+
* In the cross-origin iframe model the expert-memo embed inlined the portal's
|
|
5
|
+
* `ftcTamperGuardScript()`: a kill switch that blanks the memo if the verbatim FTC
|
|
6
6
|
* material-connection disclosure is stripped, hidden, or altered — making the MSA §3
|
|
7
7
|
* anti-stripping covenant TECHNICALLY enforced, not just contractual. The native memo renders
|
|
8
8
|
* in the host theme's DOM (no sandbox), so without this it would lose that runtime enforcement.
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
* - On tamper it neutralizes ONLY the memo (never `document.body` — we're in the host page).
|
|
18
18
|
* - The contributors card is governed by the badge re-verify (`revalidate.ts`), not this guard;
|
|
19
19
|
* the card carries only the one-word "Compensated" cue, never the guarded disclosure.
|
|
20
|
+
* - COVERAGE, and it is narrower than it reads: `.certrev-memo` / `.certrev-memo-wrap` are portal
|
|
21
|
+
* LIQUID markup — NOTHING in this package emits either. So the kill switch covers the Liquid
|
|
22
|
+
* memo surface and nothing else. `<CertBadge>` and `render-badge-html.ts` emit the same
|
|
23
|
+
* `[data-ftc-line]` hook inside a `.certrev-badge` (no memo), and `renderCertBlock` emits no
|
|
24
|
+
* hook at all; on those surfaces a pass verifies nothing and says so (`'unguarded'`) rather
|
|
25
|
+
* than reporting success, and no observer is installed at all. Widening enforcement to the
|
|
26
|
+
* badge is a live design decision, not an omission — see `FtcEnforcementResult`.
|
|
20
27
|
*
|
|
21
28
|
* Pure DOM, no crypto, no network. The expected text is the single source of truth
|
|
22
29
|
* `FTC_DISCLOSURE_LINE` (imported, not copied — so a reword can never desync this guard).
|
|
@@ -27,6 +34,20 @@ export const MEMO_SELECTOR = '.certrev-memo';
|
|
|
27
34
|
export const MEMO_WRAP_SELECTOR = '.certrev-memo-wrap';
|
|
28
35
|
/** Marker on the neutral notice node that replaces a tampered memo (testable / idempotent). */
|
|
29
36
|
export const FTC_NEUTRALIZED_ATTR = 'data-certrev-ftc-neutralized';
|
|
37
|
+
/**
|
|
38
|
+
* Link qualification for the notice's CertREV anchor — a CertREV link on a brand's page that the
|
|
39
|
+
* brand did not author, so it carries the same qualification as every other anchor this package
|
|
40
|
+
* emits. Deliberately a LOCAL literal rather than an import of `CERTREV_LINK_REL`
|
|
41
|
+
* (`../components/rel.ts`): `src/modal/` imports NOTHING from `src/components/` by design — every
|
|
42
|
+
* shared string here (`ftc-disclosure.ts`, `logo-paths.ts`, `display-strings.ts`) is a modal-local
|
|
43
|
+
* copy so the browser IIFE never drags the SSR renderer in. `ftc-guard.test.ts` imports the
|
|
44
|
+
* components constant and asserts this value stays a superset of it, so the copies cannot drift.
|
|
45
|
+
*
|
|
46
|
+
* `noreferrer` rides ON TOP of the shared tokens (which omit it): this is the only anchor the
|
|
47
|
+
* package opens with `target="_blank"`, and it fires from a page whose operator has just stripped
|
|
48
|
+
* the disclosure — withholding the referrer there is worth the token.
|
|
49
|
+
*/
|
|
50
|
+
const NOTICE_LINK_REL = 'nofollow sponsored noopener noreferrer';
|
|
30
51
|
/** Documents already guarded, so a double script-load can't double-bind. */
|
|
31
52
|
const guardedDocs = new WeakSet();
|
|
32
53
|
/** Visible = not display:none / visibility:hidden / opacity:0 and a non-zero box. */
|
|
@@ -63,30 +84,42 @@ export function neutralizeMemo(memo) {
|
|
|
63
84
|
'font-family:system-ui,-apple-system,sans-serif;font-size:12px;color:#555;padding:12px;line-height:1.4';
|
|
64
85
|
notice.innerHTML =
|
|
65
86
|
'This CertREV verification cannot be displayed because its required disclosure was not shown. ' +
|
|
66
|
-
|
|
87
|
+
`<a href="https://certrev.com" style="color:#555" target="_blank" rel="${NOTICE_LINK_REL}">Learn more</a>.`;
|
|
67
88
|
memo.replaceWith(notice);
|
|
68
89
|
}
|
|
69
90
|
/**
|
|
70
91
|
* Enforce the disclosure across every memo in the doc: neutralize any whose disclosure isn't
|
|
71
|
-
* intact. A doc with no `.certrev-memo`
|
|
72
|
-
*
|
|
92
|
+
* intact. A doc with no `.certrev-memo` is a no-op — see `FtcEnforcementResult` for why that is
|
|
93
|
+
* `'unguarded'` and not success.
|
|
73
94
|
*/
|
|
74
95
|
export function enforceFtcDisclosure(doc) {
|
|
75
|
-
|
|
76
|
-
|
|
96
|
+
const memos = Array.from(doc.querySelectorAll(MEMO_SELECTOR));
|
|
97
|
+
if (!memos.length)
|
|
98
|
+
return 'unguarded';
|
|
99
|
+
let result = 'intact';
|
|
100
|
+
for (const memo of memos) {
|
|
77
101
|
if (!isDisclosureIntact(memo)) {
|
|
78
|
-
|
|
102
|
+
result = 'tampered';
|
|
79
103
|
neutralizeMemo(memo);
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
|
-
return
|
|
106
|
+
return result;
|
|
83
107
|
}
|
|
84
108
|
/**
|
|
85
109
|
* Install the guard once per document: enforce now (on DOM ready) and re-enforce on later DOM
|
|
86
|
-
* mutations within the
|
|
87
|
-
* after load still trips the kill switch.
|
|
88
|
-
*
|
|
89
|
-
*
|
|
110
|
+
* mutations within the guarded subtree(s) — so a host script that strips / hides / edits the
|
|
111
|
+
* disclosure after load still trips the kill switch. Idempotent.
|
|
112
|
+
*
|
|
113
|
+
* The observer scope is the memo wrap(s) — placement.ts relocates a wrap as a node, so the observer
|
|
114
|
+
* tracks it wherever it moves — plus any memo sitting outside a wrap. When the document has
|
|
115
|
+
* NEITHER, NO observer is installed at all. That bail-out is the whole storefront case, not an edge
|
|
116
|
+
* one: this package emits neither selector (both are portal Liquid), so the old `<body>` fallback
|
|
117
|
+
* was the only branch a React / Web Component / `renderCertBlock` page could take, and it pinned a
|
|
118
|
+
* subtree + attributes + characterData observer — no `attributeFilter`, no coalescing — on the
|
|
119
|
+
* host's entire page for the life of the tab, re-running an enforce pass on EVERY mutation a busy
|
|
120
|
+
* storefront makes, to query a selector that could never match. A guard watching a page it cannot
|
|
121
|
+
* act on is pure cost; `enforceFtcDisclosure`'s `'unguarded'` result is the correctness half of the
|
|
122
|
+
* same gap.
|
|
90
123
|
*/
|
|
91
124
|
export function installFtcGuard(doc) {
|
|
92
125
|
if (guardedDocs.has(doc))
|
|
@@ -100,11 +133,11 @@ export function installFtcGuard(doc) {
|
|
|
100
133
|
const MO = doc.defaultView?.MutationObserver;
|
|
101
134
|
if (!MO)
|
|
102
135
|
return;
|
|
103
|
-
//
|
|
104
|
-
//
|
|
136
|
+
// The guarded roots: the stable wrap(s), plus any memo not inside one (in the Liquid shape a
|
|
137
|
+
// wrap always contains its memo, so this is normally just the wraps). No root ⇒ no observer.
|
|
105
138
|
const wraps = Array.from(doc.querySelectorAll(MEMO_WRAP_SELECTOR));
|
|
106
|
-
const
|
|
107
|
-
for (const node of
|
|
139
|
+
const looseMemos = Array.from(doc.querySelectorAll(MEMO_SELECTOR)).filter((memo) => !memo.closest(MEMO_WRAP_SELECTOR));
|
|
140
|
+
for (const node of [...wraps, ...looseMemos]) {
|
|
108
141
|
const mo = new MO(run);
|
|
109
142
|
mo.observe(node, { childList: true, subtree: true, characterData: true, attributes: true });
|
|
110
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ftc-guard.js","sourceRoot":"","sources":["../../src/modal/ftc-guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ftc-guard.js","sourceRoot":"","sources":["../../src/modal/ftc-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAA;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAA;AACtD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,8BAA8B,CAAA;AAElE;;;;;;;;;;;;GAYG;AACH,MAAM,eAAe,GAAG,wCAAwC,CAAA;AAEhE,4EAA4E;AAC5E,MAAM,WAAW,GAAG,IAAI,OAAO,EAAY,CAAA;AAE3C,qFAAqF;AACrF,SAAS,SAAS,CAAC,EAAW;IAC7B,MAAM,GAAG,GAAG,EAAE,CAAC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,CAAC,kBAAkB,CAAC,CAC3C,CAAA;QACD,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,KAAK,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;YAC9C,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA;YACtB,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;QAC5F,CAAC;IACF,CAAC,CAAA;IAED,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;;QAC5F,KAAK,EAAE,CAAA;AACb,CAAC"}
|
package/dist/modal/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@certrev/cert-block/modal` — the browser cert MODAL + badge-revalidation Web Component
|
|
3
|
-
*
|
|
3
|
+
* — a BYTE-FAITHFUL relocation of the portal's cert-delivery web-component sources. The IIFE
|
|
4
4
|
* built from `certrev-cert.entry.ts` (`build:modal-bundle`) is structurally byte-identical to the
|
|
5
5
|
* Shopify-deployed `certrev-cert.js`, so a headless brand can drop the SAME verified modal onto its
|
|
6
6
|
* storefront (`<script src=".../dist/modal/certrev-cert.js">`) instead of vendoring a copy.
|
package/dist/modal/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@certrev/cert-block/modal` — the browser cert MODAL + badge-revalidation Web Component
|
|
3
|
-
*
|
|
3
|
+
* — a BYTE-FAITHFUL relocation of the portal's cert-delivery web-component sources. The IIFE
|
|
4
4
|
* built from `certrev-cert.entry.ts` (`build:modal-bundle`) is structurally byte-identical to the
|
|
5
5
|
* Shopify-deployed `certrev-cert.js`, so a headless brand can drop the SAME verified modal onto its
|
|
6
6
|
* storefront (`<script src=".../dist/modal/certrev-cert.js">`) instead of vendoring a copy.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Cert-card INTERACTIONS for the native Shopify cert experience.
|
|
3
3
|
*
|
|
4
4
|
* Progressive enhancement, delegated from the document (one listener, survives the placement
|
|
5
|
-
* reposition). Two behaviours (
|
|
5
|
+
* reposition). Two behaviours (the chevron model):
|
|
6
6
|
*
|
|
7
7
|
* • Accordion bios — a contributor row carrying `[data-certrev-acc]` toggles its `.open` class
|
|
8
8
|
* (revealing the row's `.acc-bio` in place; the name caret rotates via CSS) and mirrors the
|
|
9
9
|
* state on `aria-expanded`. A click on a link inside the row (e.g. the "Compensated expert"
|
|
10
10
|
* cue) is NOT a toggle. Keyboard: Enter/Space on the role=button row.
|
|
11
11
|
* • In-page modals: a `[data-certrev-modal-open]` control opens the unified
|
|
12
|
-
* `<certrev-cert-modal>` element
|
|
12
|
+
* `<certrev-cert-modal>` element via its `.open('cert'|'expert')` method. Bare /
|
|
13
13
|
* `"cert"` opens the certificate dialog; `"expert"` opens the reviewer dialog. With no JS / no
|
|
14
14
|
* element / no envelope a link control falls back to its href (the certificate or the CertREV
|
|
15
15
|
* profile page). The element owns its OWN close plumbing (× / Close / backdrop / Esc) inside its
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Cert-card INTERACTIONS for the native Shopify cert experience.
|
|
3
3
|
*
|
|
4
4
|
* Progressive enhancement, delegated from the document (one listener, survives the placement
|
|
5
|
-
* reposition). Two behaviours (
|
|
5
|
+
* reposition). Two behaviours (the chevron model):
|
|
6
6
|
*
|
|
7
7
|
* • Accordion bios — a contributor row carrying `[data-certrev-acc]` toggles its `.open` class
|
|
8
8
|
* (revealing the row's `.acc-bio` in place; the name caret rotates via CSS) and mirrors the
|
|
9
9
|
* state on `aria-expanded`. A click on a link inside the row (e.g. the "Compensated expert"
|
|
10
10
|
* cue) is NOT a toggle. Keyboard: Enter/Space on the role=button row.
|
|
11
11
|
* • In-page modals: a `[data-certrev-modal-open]` control opens the unified
|
|
12
|
-
* `<certrev-cert-modal>` element
|
|
12
|
+
* `<certrev-cert-modal>` element via its `.open('cert'|'expert')` method. Bare /
|
|
13
13
|
* `"cert"` opens the certificate dialog; `"expert"` opens the reviewer dialog. With no JS / no
|
|
14
14
|
* element / no envelope a link control falls back to its href (the certificate or the CertREV
|
|
15
15
|
* profile page). The element owns its OWN close plumbing (× / Close / backdrop / Esc) inside its
|
package/dist/modal/logo-paths.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// ⚠ VENDORED, BYTE-FAITHFUL copy of portal
|
|
2
|
-
//
|
|
1
|
+
// ⚠ VENDORED, BYTE-FAITHFUL copy of the portal design-guide's `LOGO_PATHS`.
|
|
2
|
+
// Byte-identical to `../components/render-cert-block.ts`'s private copy;
|
|
3
3
|
// kept modal-local so the browser bundle never pulls in the SSR renderer. Unifying the
|
|
4
4
|
// package's two copies onto one shared leaf module is a post-publish follow-up.
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo-paths.js","sourceRoot":"","sources":["../../src/modal/logo-paths.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"logo-paths.js","sourceRoot":"","sources":["../../src/modal/logo-paths.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,yEAAyE;AACzE,uFAAuF;AACvF,gFAAgF;AAChF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,gOAAgO;IAChO,6NAA6N;IAC7N,yOAAyO;IACzO,6OAA6O;CACpO,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* When no references exist, each falls back to a chrome-aware semantic-landmark / theme-class
|
|
19
19
|
* scan, with a STYLED end-of-article fallback when nothing matches.
|
|
20
20
|
* (c) Records the matched tier on each wrap as `data-certrev-placement` — the observability the
|
|
21
|
-
* pre-launch theme-matrix sweep + the
|
|
21
|
+
* pre-launch theme-matrix sweep + the liveness check read, so a silent misplacement
|
|
22
22
|
* becomes an inspectable signal rather than a surprise on a real brand's store.
|
|
23
23
|
*
|
|
24
24
|
* It runs BEFORE the badge re-verify pass and never moves a wrap twice, so the `<certrev-badge>`
|
|
@@ -50,8 +50,9 @@ export declare const TOP_CONTENT_SELECTOR: string;
|
|
|
50
50
|
* footer, nav, or cart drawer often carries its own `.rte` that precedes the article in document
|
|
51
51
|
* order — IntelliPure's announcement bar is literally `<div class="announcement__content … rte">`.
|
|
52
52
|
* `isRenderable` can't reject those (they're visible), so `querySelector('.rte')` returned the
|
|
53
|
-
* announcement bar and the contributors card was injected there instead of the article (
|
|
54
|
-
* "contributors not showing"). Placement scopes anchors out of chrome STRUCTURALLY
|
|
53
|
+
* announcement bar and the contributors card was injected there instead of the article (the
|
|
54
|
+
* "contributors not showing" regression). Placement scopes anchors out of chrome STRUCTURALLY
|
|
55
|
+
* via this set. */
|
|
55
56
|
export declare const SITE_CHROME_SELECTOR = "header, [role=\"banner\"], [class*=\"announcement\"], footer, [role=\"contentinfo\"], nav, [role=\"navigation\"], cart-drawer, .cart-drawer, .drawer, .mini-cart, .modal, [role=\"dialog\"]";
|
|
56
57
|
/** Achieved-tier attribute the JS stamps on each wrap (CSS body-fallback styling + observability). */
|
|
57
58
|
export declare const PLACEMENT_ATTR = "data-certrev-placement";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.d.ts","sourceRoot":"","sources":["../../src/modal/placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;mDAEmD;AACnD,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAOjG,CAAA;AAED;;;;mEAImE;AACnE,eAAO,MAAM,WAAW,EAAE,aAA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,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,qGAAqG;IACrG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;CACjC;AAkED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,WAAW,CAyFvE;AAED,sGAAsG;AACtG,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,eAAe,CAoBxD;AAwCD,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAOrD"}
|
package/dist/modal/placement.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* When no references exist, each falls back to a chrome-aware semantic-landmark / theme-class
|
|
19
19
|
* scan, with a STYLED end-of-article fallback when nothing matches.
|
|
20
20
|
* (c) Records the matched tier on each wrap as `data-certrev-placement` — the observability the
|
|
21
|
-
* pre-launch theme-matrix sweep + the
|
|
21
|
+
* pre-launch theme-matrix sweep + the liveness check read, so a silent misplacement
|
|
22
22
|
* becomes an inspectable signal rather than a surprise on a real brand's store.
|
|
23
23
|
*
|
|
24
24
|
* It runs BEFORE the badge re-verify pass and never moves a wrap twice, so the `<certrev-badge>`
|
|
@@ -58,8 +58,9 @@ export const TOP_CONTENT_SELECTOR = TOP_ANCHORS.map((a) => a.selector).join(', '
|
|
|
58
58
|
* footer, nav, or cart drawer often carries its own `.rte` that precedes the article in document
|
|
59
59
|
* order — IntelliPure's announcement bar is literally `<div class="announcement__content … rte">`.
|
|
60
60
|
* `isRenderable` can't reject those (they're visible), so `querySelector('.rte')` returned the
|
|
61
|
-
* announcement bar and the contributors card was injected there instead of the article (
|
|
62
|
-
* "contributors not showing"). Placement scopes anchors out of chrome STRUCTURALLY
|
|
61
|
+
* announcement bar and the contributors card was injected there instead of the article (the
|
|
62
|
+
* "contributors not showing" regression). Placement scopes anchors out of chrome STRUCTURALLY
|
|
63
|
+
* via this set. */
|
|
63
64
|
export const SITE_CHROME_SELECTOR = 'header, [role="banner"], [class*="announcement"], footer, [role="contentinfo"], nav, [role="navigation"], cart-drawer, .cart-drawer, .drawer, .mini-cart, .modal, [role="dialog"]';
|
|
64
65
|
/** Achieved-tier attribute the JS stamps on each wrap (CSS body-fallback styling + observability). */
|
|
65
66
|
export const PLACEMENT_ATTR = 'data-certrev-placement';
|
|
@@ -105,7 +106,7 @@ function isRenderable(el) {
|
|
|
105
106
|
* Whether `el` sits inside SITE CHROME (announcement bar / header / footer / nav / cart drawer /
|
|
106
107
|
* modal). Complements `isRenderable`: chrome anchors are usually VISIBLE, so the visibility guard
|
|
107
108
|
* can't reject them — but a cert wrap must never anchor there. This is the guard that keeps the
|
|
108
|
-
* contributors card out of IntelliPure's `.rte`-classed announcement bar
|
|
109
|
+
* contributors card out of IntelliPure's `.rte`-classed announcement bar.
|
|
109
110
|
*/
|
|
110
111
|
function isInSiteChrome(el) {
|
|
111
112
|
return el.closest(SITE_CHROME_SELECTOR) !== null;
|
|
@@ -121,7 +122,7 @@ function anchorTier(el, anchors) {
|
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* First anchor that exists, is RENDERABLE (not in a hidden drawer/popup), is NOT site chrome (a
|
|
124
|
-
* visible announcement bar / header / nav
|
|
125
|
+
* visible announcement bar / header / nav), and is safely positionable relative to
|
|
125
126
|
* `wrap`. Iterates ALL matches per selector (not just the first in document order) so an unusable
|
|
126
127
|
* early match (a closed drawer's `.rte`, or the announcement bar's) is skipped for the article copy.
|
|
127
128
|
*/
|
|
@@ -180,7 +181,7 @@ export function placeWrap(doc, wrap) {
|
|
|
180
181
|
// on a certified article) lives INSIDE the body-content container, so `closest(TOP_CONTENT_SELECTOR)`
|
|
181
182
|
// resolves the exact article `.rte` / `article` / `main` — never a same-classed site-chrome element
|
|
182
183
|
// that merely precedes the article in document order (IntelliPure's `.rte` announcement bar, which
|
|
183
|
-
// is visible so isRenderable can't reject it —
|
|
184
|
+
// is visible so isRenderable can't reject it — the "contributors not showing" regression). This ties
|
|
184
185
|
// the card + memo to the SAME article region by construction.
|
|
185
186
|
const refs = doc.querySelector(REFERENCES_SELECTOR);
|
|
186
187
|
const owner = refs?.closest(TOP_CONTENT_SELECTOR) ?? null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/modal/placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;mDAEmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAwE;IACrG,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE;IAC7C,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACxC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAClC,EAAE,QAAQ,EAAE,4BAA4B,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/D,EAAE,QAAQ,EAAE,wBAAwB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC3D,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE;CACzC,CAAA;AAED;;;;mEAImE;AACnE,MAAM,CAAC,MAAM,WAAW,GAAwE;IAC/F,EAAE,QAAQ,EAAE,4BAA4B,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/D,EAAE,QAAQ,EAAE,wBAAwB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC3D,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE;IACzC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D,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;;QAC1F,GAAG,EAAE,CAAA;AACX,CAAC"}
|
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
* • verdict `render` → leave the SSR badge (verified live);
|
|
12
12
|
* • verdict `suppress` (invalid-sig / subject-mismatch / revoked / expired) → HIDE it
|
|
13
13
|
* (fail-closed), stamping `data-certrev-suppressed` with the verdict's reason. A revoked
|
|
14
|
-
* placement now serves the SLIM `CertTombstone
|
|
14
|
+
* placement now serves the SLIM `CertTombstone`, which `verifyArtifact`
|
|
15
15
|
* resolves to `suppress:'revoked'` — so the badge hides AND the suppressed-reason telemetry
|
|
16
|
-
* is right (`verifyEnvelope` used to mis-report it as `unsupported_contract_version
|
|
17
|
-
* POR-10684);
|
|
16
|
+
* is right (`verifyEnvelope` used to mis-report it as `unsupported_contract_version`);
|
|
18
17
|
* • the Delivery API 404s (no servable artifact) or the network errors → LEAVE the SSR badge.
|
|
19
18
|
* The SSR copy already passed the Liquid lifecycle gate against the app-owned metafield
|
|
20
19
|
* (the authoritative revoke/expire surface — the binding retracts it on revoke), so the WC
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidate.d.ts","sourceRoot":"","sources":["../../src/modal/revalidate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"revalidate.d.ts","sourceRoot":"","sources":["../../src/modal/revalidate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,4FAA4F;AAC5F,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC3B;AAED;gFACgF;AAChF,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;AAEzE,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAC9B;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBxF;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAQ/E"}
|
package/dist/modal/revalidate.js
CHANGED
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
* • verdict `render` → leave the SSR badge (verified live);
|
|
12
12
|
* • verdict `suppress` (invalid-sig / subject-mismatch / revoked / expired) → HIDE it
|
|
13
13
|
* (fail-closed), stamping `data-certrev-suppressed` with the verdict's reason. A revoked
|
|
14
|
-
* placement now serves the SLIM `CertTombstone
|
|
14
|
+
* placement now serves the SLIM `CertTombstone`, which `verifyArtifact`
|
|
15
15
|
* resolves to `suppress:'revoked'` — so the badge hides AND the suppressed-reason telemetry
|
|
16
|
-
* is right (`verifyEnvelope` used to mis-report it as `unsupported_contract_version
|
|
17
|
-
* POR-10684);
|
|
16
|
+
* is right (`verifyEnvelope` used to mis-report it as `unsupported_contract_version`);
|
|
18
17
|
* • the Delivery API 404s (no servable artifact) or the network errors → LEAVE the SSR badge.
|
|
19
18
|
* The SSR copy already passed the Liquid lifecycle gate against the app-owned metafield
|
|
20
19
|
* (the authoritative revoke/expire surface — the binding retracts it on revoke), so the WC
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidate.js","sourceRoot":"","sources":["../../src/modal/revalidate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"revalidate.js","sourceRoot":"","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AI,CAAC,CAAA;QACjC,CAAC;IACF,CAAC,CAAA;IACD,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;;QAC1F,GAAG,EAAE,CAAA;AACX,CAAC"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* `@certrev/cert-contract` (WebCrypto Ed25519 over RFC-8785 JCS — the same kernel the server +
|
|
6
6
|
* every other edge run). No crypto is reimplemented here.
|
|
7
7
|
*
|
|
8
|
-
* `verifyArtifact` (
|
|
8
|
+
* `verifyArtifact` (cert-contract 0.3.0) dispatches on the `kind: 'tombstone'`
|
|
9
9
|
* discriminator: a full `CertDeliveryEnvelope` runs the whole crypto + lifecycle pipeline, while
|
|
10
|
-
* the SLIM `CertTombstone` the control plane now serves for a revoked placement
|
|
10
|
+
* the SLIM `CertTombstone` the control plane now serves for a revoked placement —
|
|
11
11
|
* which carries NO payload — verifies its own signature + subject and resolves to
|
|
12
12
|
* `suppress:'revoked'`. The old `verifyEnvelope` fails a tombstone's shape-check and returns
|
|
13
13
|
* `suppress:'unsupported_contract_version'` (still a blank badge, but the wrong suppressed-reason
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* `@certrev/cert-contract` (WebCrypto Ed25519 over RFC-8785 JCS — the same kernel the server +
|
|
6
6
|
* every other edge run). No crypto is reimplemented here.
|
|
7
7
|
*
|
|
8
|
-
* `verifyArtifact` (
|
|
8
|
+
* `verifyArtifact` (cert-contract 0.3.0) dispatches on the `kind: 'tombstone'`
|
|
9
9
|
* discriminator: a full `CertDeliveryEnvelope` runs the whole crypto + lifecycle pipeline, while
|
|
10
|
-
* the SLIM `CertTombstone` the control plane now serves for a revoked placement
|
|
10
|
+
* the SLIM `CertTombstone` the control plane now serves for a revoked placement —
|
|
11
11
|
* which carries NO payload — verifies its own signature + subject and resolves to
|
|
12
12
|
* `suppress:'revoked'`. The old `verifyEnvelope` fails a tombstone's shape-check and returns
|
|
13
13
|
* `suppress:'unsupported_contract_version'` (still a blank badge, but the wrong suppressed-reason
|
package/dist/verify/cache.d.ts
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* still recovering quickly (short negative TTL).
|
|
14
14
|
*
|
|
15
15
|
* It is deliberately tiny + dependency-free (a Map + timestamps) so it runs in any server
|
|
16
|
-
* runtime (Node, edge, workerd). For multi-instance deployments this is per-instance L1
|
|
17
|
-
*
|
|
18
|
-
* `lifecycle.revision
|
|
16
|
+
* runtime (Node, edge, workerd). For multi-instance deployments this is per-instance L1 and
|
|
17
|
+
* nothing more: each instance keeps its own copy, so an L2 (the CDN in front of the Delivery
|
|
18
|
+
* API, which is cacheable on `lifecycle.revision`, or a shared KV) is the caller's to add.
|
|
19
19
|
*/
|
|
20
20
|
export interface TtlCacheOptions {
|
|
21
21
|
/** Positive-result TTL in ms (default 60_000). */
|
|
@@ -44,12 +44,27 @@ export declare class TtlCache<V> {
|
|
|
44
44
|
* TTL; if `isNegative(value)` returns true (e.g. a 'suppress' verdict) it's cached
|
|
45
45
|
* with the shorter negative TTL so a transient failure recovers fast. A thrown loader
|
|
46
46
|
* is NOT cached (it rejects all current waiters and the next call retries).
|
|
47
|
+
*
|
|
48
|
+
* `positiveTtlMs` overrides the cache's positive TTL FOR THIS WRITE only, so one caller
|
|
49
|
+
* can hold a verdict longer/shorter than the cache's default without owning the cache.
|
|
50
|
+
* It deliberately does NOT apply to a negative result: a caller asking for a 10-minute
|
|
51
|
+
* positive TTL is asking for fewer origin reads, not for a transient failure to be
|
|
52
|
+
* remembered for ten minutes (see the negative-TTL rationale in the module header).
|
|
47
53
|
*/
|
|
48
|
-
getOrLoad(key: string, loader: () => Promise<V>, isNegative?: (v: V) => boolean): Promise<V>;
|
|
49
|
-
/** Insert/overwrite an entry
|
|
50
|
-
|
|
54
|
+
getOrLoad(key: string, loader: () => Promise<V>, isNegative?: (v: V) => boolean, positiveTtlMs?: number): Promise<V>;
|
|
55
|
+
/** Insert/overwrite an entry. `ttlMsOverride` replaces the TTL this write would otherwise
|
|
56
|
+
* get (positive or negative); omit it for the cache's configured TTLs. */
|
|
57
|
+
set(key: string, value: V, negative?: boolean, ttlMsOverride?: number): void;
|
|
51
58
|
/** Drop a key (e.g. on a known revocation push). */
|
|
52
59
|
delete(key: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Drop every key under a prefix. WHY it exists: a cache key identifies everything the
|
|
62
|
+
* cached value depends on, which for a verdict includes the live content hash the render
|
|
63
|
+
* observed — a fact a revocation webhook does not know. Invalidating by prefix lets the
|
|
64
|
+
* webhook drop a placement without having to reconstruct every render context that ever
|
|
65
|
+
* cached it.
|
|
66
|
+
*/
|
|
67
|
+
deletePrefix(prefix: string): void;
|
|
53
68
|
clear(): void;
|
|
54
69
|
get size(): number;
|
|
55
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/verify/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,eAAe;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAC3B;AAQD,qBAAa,QAAQ,CAAC,CAAC;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAQ;IACtC,OAAO,CAAC,QAAQ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