@steadphast/connector-nextjs 0.6.0 → 0.7.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/README.md +176 -18
- package/dist/behavioral-collector.d.ts +9 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +19 -0
- package/dist/config.d.ts +26 -0
- package/dist/index.js +374 -26
- package/dist/page-probes.d.ts +27 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +1012 -20
- package/package.json +13 -2
package/README.md
CHANGED
|
@@ -9,6 +9,13 @@ any classification, and never changes the response your visitor receives.
|
|
|
9
9
|
The package is one connector with two modes: **Next.js on Vercel** (`kind: "vercel"`) and
|
|
10
10
|
**Next.js self-hosted** (`kind: "self-hosted"`).
|
|
11
11
|
|
|
12
|
+
The optional App Router `DiscoverCollector` component has independent T0 and Family C controls.
|
|
13
|
+
Family C requires API enablement, workspace policy and an exact nonsensitive route. Own mode
|
|
14
|
+
is not visitor permission: affirmative consent is the default. A no-prompt `notice` basis
|
|
15
|
+
applies only where Steadphast has recorded it for the workspace and `behavioral.consentBasis`
|
|
16
|
+
is also `"notice"`. Timing defaults false and needs both the site and the workspace switch.
|
|
17
|
+
See [Family C own collection](#family-c-own-collection).
|
|
18
|
+
|
|
12
19
|
```text
|
|
13
20
|
Visitor / bot Your Next.js deployment Steadphast
|
|
14
21
|
───────────── ─────────────────────── ──────────
|
|
@@ -32,8 +39,8 @@ authoritative terms.
|
|
|
32
39
|
## Requirements
|
|
33
40
|
|
|
34
41
|
- Next.js 15 or 16 (`^15.0.0 || ^16.0.0`) and React 19 (`^19.0.0`) are peer dependencies.
|
|
35
|
-
|
|
36
|
-
those two
|
|
42
|
+
The exact-runtime fixtures pin Next.js 15.5.28 (`middleware.ts`) and 16.3.2 (`proxy.ts`);
|
|
43
|
+
other releases on those two lines are expected to work. Next.js 14 and earlier are unsupported.
|
|
37
44
|
- A Steadphast API key, created in the dashboard under **Settings → API keys** with **Used with**
|
|
38
45
|
set to the mode you deploy: **Next.js on Vercel** or **Next.js self-hosted**. A key is issued for
|
|
39
46
|
one deployment mode and is rejected by the other.
|
|
@@ -384,6 +391,12 @@ type DiscoverNextConfig = (
|
|
|
384
391
|
excludedHeaders?: ReadonlyArray<string>;
|
|
385
392
|
recordIdPrefix?: string;
|
|
386
393
|
timeoutMs?: number;
|
|
394
|
+
collector?: boolean;
|
|
395
|
+
behavioral?: {
|
|
396
|
+
mode?: "own" | "off" | "partner";
|
|
397
|
+
timing?: boolean;
|
|
398
|
+
routes?: ReadonlyArray<string>;
|
|
399
|
+
};
|
|
387
400
|
};
|
|
388
401
|
```
|
|
389
402
|
|
|
@@ -394,9 +407,12 @@ type DiscoverNextConfig = (
|
|
|
394
407
|
| `apiUrl` | Yes | The Steadphast API origin, `https://api.steadphast.ai`. See [Destination rules](#destination-rules). |
|
|
395
408
|
| `apiKeyEnvVar` | No | Name of the server-only environment variable holding the API key. Defaults to `STEADPHAST_API_KEY` (`DISCOVER_API_KEY` is still read as a deprecated fallback; migrate to `STEADPHAST_API_KEY`). When set, only the named variable is read. A `NEXT_PUBLIC_*` name is rejected. |
|
|
396
409
|
| `captureAllPaths` | No | Static assets (scripts, styles, images, fonts, and similar) are skipped by default, except `robots.txt` and `sitemap.xml`. Set `true` to capture every path the matcher allows. |
|
|
397
|
-
| `excludedHeaders` | No | Header names (case-insensitive) to remove from the captured header map.
|
|
410
|
+
| `excludedHeaders` | No | Header names (case-insensitive) to remove from the captured header map. Cookie values are never sent; list `cookie` or `set-cookie` to also drop the cookie names taken from that header (see [Cookies, query strings, and Referer](#cookies-query-strings-and-referer)). |
|
|
398
411
|
| `recordIdPrefix` | No | A short label that prefixes the record IDs Steadphast assigns, useful for telling deployments apart. Defaults to `vercel-routing-middleware` or `nextjs-self-hosted`. Limit: 128 UTF-8 bytes. A longer value is not rejected at startup but makes every capture drop silently. |
|
|
399
412
|
| `timeoutMs` | No | Delivery timeout in milliseconds. Defaults to `5000`. |
|
|
413
|
+
| `collector` | No | T0 remains explicit opt-in with `true`. An explicit `false` also vetoes Family C; leaving it undefined permits independently configured Family C without T0. |
|
|
414
|
+
| `environment.rendering` | No | Enables the site's optional rendering category. It also requires workspace authorization and the server component's `environmentPermitted` prop for this request. Set the prop only on an approved origin and route after checking this visitor's applicable permission server-side; never derive it from a visitor-provided header. Omission or a failed policy check leaves ordinary collection unchanged. |
|
|
415
|
+
| `behavioral` | No | Inert until Steadphast enables the API switch (`BEHAVIORAL_ENABLED` defaults false); until then approved routes only add `no-store` and a policy fetch that answers off. Once enabled: own mode, timing/default-false, exact nonsensitive `routes` required. `off` and `partner` install no own collector. Workspace/API OFF and visitor consent remain independent controls. `consentBasis: "notice"` starts the window without a consent callback only when Steadphast has also set the workspace's audited consent basis to `notice`; the default is `affirmative`. `pathCapture: true` adds click target geometry (no label, text or element identity) to click records, and only when the workspace's path capture setting is also on; default off. |
|
|
400
416
|
|
|
401
417
|
`kind`, `publicOrigin`, `apiUrl`, and the `NEXT_PUBLIC_*` rule for `apiKeyEnvVar` are validated
|
|
402
418
|
when the entry file is evaluated: an invalid value throws a `DiscoverConfigError`, so those
|
|
@@ -430,7 +446,9 @@ installations, ends at `platform` as in 0.5.x.
|
|
|
430
446
|
|
|
431
447
|
- **Request:** method, URL, and headers. The connector reads nothing else. It never reads, clones,
|
|
432
448
|
buffers, or transmits the request body, so every downstream body consumer in your application
|
|
433
|
-
remains callable.
|
|
449
|
+
remains callable. The URL keeps its query keys but not their values, cookie values are never
|
|
450
|
+
sent, and `Referer` is reduced to its origin (see
|
|
451
|
+
[Cookies, query strings, and Referer](#cookies-query-strings-and-referer)).
|
|
434
452
|
- **Platform (Vercel):** Vercel's protected client IP, request ID (`x-vercel-id`), and the JA4 and
|
|
435
453
|
JA3 TLS-fingerprint digests when Vercel supplies them.
|
|
436
454
|
- **Platform (self-hosted):** the client IP and request ID nginx sets in `X-Steadphast-Client-Ip`
|
|
@@ -452,10 +470,11 @@ Headers pass through two filters before anything is serialized:
|
|
|
452
470
|
built-in exclusions ── a fixed list of recognized credential header names
|
|
453
471
|
│ and a few name patterns (see below)
|
|
454
472
|
▼
|
|
455
|
-
your excludedHeaders ──
|
|
473
|
+
your excludedHeaders ── every application-specific credential header
|
|
456
474
|
│
|
|
457
475
|
▼
|
|
458
|
-
captured header map (everything else
|
|
476
|
+
captured header map (everything else; cookie values replaced by cookie names,
|
|
477
|
+
Referer reduced to its origin, URL-bearing headers redacted)
|
|
459
478
|
```
|
|
460
479
|
|
|
461
480
|
The built-in filter is a **limited, fixed set**, not a general secret detector. Names are compared
|
|
@@ -488,10 +507,45 @@ Every other header is captured, including custom credential headers such as `x-t
|
|
|
488
507
|
headers your application, its upstream proxies, and its third-party integrations attach, and list
|
|
489
508
|
every credential-bearing name in `excludedHeaders`.
|
|
490
509
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
510
|
+
Excluding a header removes it from the generic header map only; it does not remove a value that a
|
|
511
|
+
dedicated field separately carries (for example the user agent).
|
|
512
|
+
|
|
513
|
+
### Cookies, query strings, and Referer
|
|
514
|
+
|
|
515
|
+
These rules apply to every installation, with no configuration, from the first release after
|
|
516
|
+
0.6.0 (ADR 0017 amendment, 2026-11-17):
|
|
517
|
+
|
|
518
|
+
- **Cookies.** `Cookie` and `Set-Cookie` values are never sent. The captured map instead carries
|
|
519
|
+
`x-steadphast-cookie-names`: the cookie names only, de-duplicated, sorted, and capped at 32 names
|
|
520
|
+
and 1024 bytes. A name must be 1 to 64 RFC 6265 token characters; anything else is dropped. Each
|
|
521
|
+
`Set-Cookie` value contributes only its first name (values are never split on commas). The
|
|
522
|
+
connector removes any `x-steadphast-cookie-names` header the visitor sends. List `cookie` or
|
|
523
|
+
`set-cookie` in `excludedHeaders` to drop the names taken from that header, or
|
|
524
|
+
`x-steadphast-cookie-names` to drop the marker entirely.
|
|
525
|
+
- **Query strings and paths.** `external_url` keeps every query key but empties every value, so
|
|
526
|
+
`/a?utm_source=x&token=abc&flag` is sent as `/a?utm_source=&token=&flag=`. In the path, matrix
|
|
527
|
+
parameter values are emptied (`;jsessionid=abc` becomes `;jsessionid=`) and an encoded query
|
|
528
|
+
starting at `%3F` is treated like a query. The exceptions are requests carrying signature headers
|
|
529
|
+
(a `Signature` header and a `Signature-Input`): one that covers `@query`, `@query-param`,
|
|
530
|
+
`@target-uri`, or `@request-target` keeps its full URL, and one that covers `@path` keeps its raw
|
|
531
|
+
path, because Steadphast needs those exact bytes to verify the RFC 9421 signature. Any visitor
|
|
532
|
+
can send such headers for their own request. The server empties query values before it stores
|
|
533
|
+
the request path either way.
|
|
534
|
+
- **Referer.** `Referer` (and the `Referrer` misspelling) is reduced to its origin,
|
|
535
|
+
`scheme://host[:port]`: path, query, and fragment are removed. A value that is not an absolute
|
|
536
|
+
`http:` or `https:` URL, or that carries credentials (`user@host`), a `%` escape or non-ASCII
|
|
537
|
+
character in the host, a backslash, or whitespace, is dropped entirely rather than repaired.
|
|
538
|
+
- **Other URL-bearing headers.** `Next-Router-State-Tree` and `Next-Url`, which embed the page's
|
|
539
|
+
query values on client navigations, are sent only as the value `present`. The proxy headers
|
|
540
|
+
`X-Forwarded-Uri`, `X-Original-Url`, `X-Original-Uri`, `X-Envoy-Original-Path`, and
|
|
541
|
+
`X-Rewrite-Url`, and any other header whose value starts with `/`, `//`, `http://`, or `https://`
|
|
542
|
+
and contains `?`, are sent with query values emptied, the fragment removed, and any credentials
|
|
543
|
+
dropped from the host.
|
|
544
|
+
- **Signed header values.** A signature covering one of the headers above cannot be verified from
|
|
545
|
+
the minimized value, so that header's raw value is never sent and the signature is reported
|
|
546
|
+
`unattemptable`.
|
|
547
|
+
|
|
548
|
+
Even so, avoid placing secrets or personal data in URL paths or query keys.
|
|
495
549
|
|
|
496
550
|
### Size limits
|
|
497
551
|
|
|
@@ -512,9 +566,95 @@ Delivery does not block the visitor response: the connector serializes the recor
|
|
|
512
566
|
changes the response status, headers, or body, and never propagates an error into your composed
|
|
513
567
|
handler.
|
|
514
568
|
|
|
569
|
+
## Family C own collection
|
|
570
|
+
|
|
571
|
+
The API switch `BEHAVIORAL_ENABLED` defaults to false. While it is off, an approved route
|
|
572
|
+
only adds `no-store` delivery and a policy fetch that answers off.
|
|
573
|
+
|
|
574
|
+
After enablement, use the existing `DiscoverCollector` server component on supported uncached Node
|
|
575
|
+
App Router documents and add `behavioral: { routes: ["/catalog"], timing: false }` to its shared
|
|
576
|
+
server configuration. Choose routes deliberately; authentication, payment, transaction and health
|
|
577
|
+
routes and sensitive fields remain excluded. An absent route list collects nothing. Explicit
|
|
578
|
+
`collector: false` or `behavioral.mode: "off"` wins over workspace own mode.
|
|
579
|
+
|
|
580
|
+
Workspace owners/admins can independently disable own collection or enable timing in Settings.
|
|
581
|
+
API OFF wins over both. Server rendering fetches current policy without
|
|
582
|
+
caching, with a 250 ms deadline; failure emits no T1 script. This can add bounded page-render
|
|
583
|
+
latency, not a wait for user interaction or a change to classification latency.
|
|
584
|
+
|
|
585
|
+
Connect your actual consent manager through the browser-safe entry:
|
|
586
|
+
|
|
587
|
+
```ts
|
|
588
|
+
import {
|
|
589
|
+
setBehavioralConsent,
|
|
590
|
+
disableBehavioralCollection,
|
|
591
|
+
closeBehavioralRoute,
|
|
592
|
+
} from "@steadphast/connector-nextjs/client";
|
|
593
|
+
|
|
594
|
+
// Only after affirmative permission; also handle steadphast:behavioral-ready.
|
|
595
|
+
setBehavioralConsent(true);
|
|
596
|
+
// Revoke permission and discard this document's unsent window.
|
|
597
|
+
setBehavioralConsent(false, true);
|
|
598
|
+
// Local OFF: synchronous listener removal and discard.
|
|
599
|
+
disableBehavioralCollection();
|
|
600
|
+
// Before a programmatic SPA transition: close, never continue the window.
|
|
601
|
+
closeBehavioralRoute();
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
Unknown or denied consent installs no interaction listeners. T0 permission is not Family C consent.
|
|
605
|
+
The one exception is the two-key `notice` basis: when the workspace policy (set only by Steadphast,
|
|
606
|
+
with an audited change record) and `behavioral.consentBasis` both say `notice`, the window starts at
|
|
607
|
+
render, or when a background page first becomes visible, without a callback. Your privacy notice
|
|
608
|
+
must describe the collection. Revocation and `disableBehavioralCollection()` still discard it.
|
|
609
|
+
The library does not retain a consent call made before the collector registers; replay your real
|
|
610
|
+
consent-manager state on `steadphast:behavioral-ready`. Revoked/closed documents cannot restart.
|
|
611
|
+
Remote workspace OFF rejects old-policy submissions and suppresses later renders, but does not
|
|
612
|
+
instantly remove listeners from an already-open disconnected page. There is no polling or retry.
|
|
613
|
+
|
|
614
|
+
One window ends at 30 seconds, 100 actions or first hide, with at most one 4 KiB beacon,
|
|
615
|
+
30 Hz/1,024 pointer/touch samples and bounded timing intervals. Key records are timing only: the
|
|
616
|
+
collector reads no key identity (`keyCode` only to compare it with 229, for IME composition) and
|
|
617
|
+
sends no character or key class, and drops modifier, shifted, shortcut and IME composition keys.
|
|
618
|
+
The number of key records, which roughly tracks the length of what was typed, leaves the browser;
|
|
619
|
+
dwell and flight values are sent sorted and rounded down to 10 ms. Values, clipboard text,
|
|
620
|
+
passwords, one-time codes, hidden fields, free-text content, payment/transaction/health fields,
|
|
621
|
+
contenteditable content, DOM identifiers and cross-page identifiers are never collected.
|
|
622
|
+
With timing on (site and workspace), the window also sends one connection timing value.
|
|
623
|
+
Collectors from this release add further interaction counts on eligible controls and tagged form
|
|
624
|
+
fields. Counts only: no value, key, text or element identity.
|
|
625
|
+
Use `data-discover-sensitive` for sensitive subtrees, and for any password field with a "show
|
|
626
|
+
password" toggle. Only explicitly reviewed `data-discover-nonsensitive="true"` buttons, selects and
|
|
627
|
+
range/number/checkbox/radio inputs permit key/paste/input observations; tagged
|
|
628
|
+
text/search/email/tel/url inputs and textareas, including fields that ask for the visitor's
|
|
629
|
+
details, give key timing and, from a collector that reports rule version 3 counts, interaction
|
|
630
|
+
counts, and nothing else: never a value, key, text or which field. Never tag a sensitive control
|
|
631
|
+
as nonsensitive.
|
|
632
|
+
|
|
633
|
+
Open-shadow origins and exposed slot/ancestor exclusions are checked transiently; paths, nodes and
|
|
634
|
+
native events are not retained. Unknown or opaque origin hosts abstain even when tagged safe.
|
|
635
|
+
**Closed-root installation prerequisite:** mark a sensitive/opaque component's light-DOM host or
|
|
636
|
+
enclosing visible subtree `data-discover-sensitive`, including its slotted light-DOM controls.
|
|
637
|
+
A tagged nonsensitive child cannot override that boundary. Passive DOM APIs can hide an internal
|
|
638
|
+
sensitive slot ancestor; null `shadowRoot`/`assignedSlot` and missing exposed marks are not proof
|
|
639
|
+
of safety. There is no closed-root probing or prototype instrumentation. If you cannot establish
|
|
640
|
+
and mark the boundary, leave that route unapproved or explicitly OFF. Unmarked opaque installs
|
|
641
|
+
are unsupported; workspace own mode is separate from route approval and visitor consent.
|
|
642
|
+
|
|
643
|
+
The API derives a summary in memory and discards the raw record array. One exception: when
|
|
644
|
+
path capture is enabled for the workspace and approved site, it can retain trusted pointer
|
|
645
|
+
samples, click points and click-target boxes (page-relative geometry, not text or selectors)
|
|
646
|
+
for at most 30 days and never longer than the summary. Pending summaries expire at
|
|
647
|
+
23 hours and attached summaries at 179 days from original receipt; event/subject deletion removes
|
|
648
|
+
linked evidence earlier. Physical purge must remain within the 24-hour/180-day ceilings, including
|
|
649
|
+
outage recovery and lock/pool starvation; the safety margins are one hour and one day, and reader
|
|
650
|
+
expiry alone is not physical deletion. The existing event detail shows
|
|
651
|
+
observations and honest coverage without changing its original verdict. Behavioral predicates and
|
|
652
|
+
partner intake are not released; synthetic engineering controls are not the required human/agent
|
|
653
|
+
evaluation. Customer install/privacy wording and consent review remain required before deployment.
|
|
654
|
+
|
|
515
655
|
## Optional: the T0 client collector
|
|
516
656
|
|
|
517
|
-
|
|
657
|
+
The optional **T0 client collector** is a small clean-room script, inlined into
|
|
518
658
|
document HTML, that observes browser realms and posts one beacon to `POST /v1/client/t0`.
|
|
519
659
|
The server joins the beacon to its event by the envelope's `record_id_prefix:request_id` identity
|
|
520
660
|
and records `client_environment`; the six client-side flags are derived from that evidence.
|
|
@@ -583,19 +723,23 @@ server-side HMAC path. Missing configuration, missing context and forged context
|
|
|
583
723
|
Visitor endpoint, nonce and enablement headers are never trusted. The component needs the App
|
|
584
724
|
Router (`next/headers`); the Pages Router is not supported. `react` ^19 is a peer for `./server`.
|
|
585
725
|
|
|
586
|
-
The collector observes the main window, a Blob worker, and a sandboxed `srcdoc` iframe, and reports
|
|
726
|
+
The T0 collector in this package version observes the main window, a Blob worker, and a sandboxed `srcdoc` iframe, and reports
|
|
587
727
|
realm cross-checks (a spoofed `navigator` that disagrees across realms), native-function integrity,
|
|
588
728
|
headless and automation markers, a coarse screen/WebGL/feature profile, and interaction *counts*
|
|
589
729
|
(untrusted clicks, whether any trusted input happened). It registers no listener that reads what
|
|
590
730
|
was typed, and it never touches form contents, pointer coordinates, the clipboard, storage,
|
|
591
|
-
cookies,
|
|
592
|
-
|
|
731
|
+
cookies, or any persistent identifier. Its one keepalive `text/plain` POST explicitly uses
|
|
732
|
+
`credentials: "omit"`, with a UTF-8 body capped at 2000 bytes. It sends at
|
|
593
733
|
`DOMContentLoaded` plus a short realm grace, on early exit/backgrounding, or at the 1500 ms cap,
|
|
594
734
|
then removes its listeners, worker, Blob URL and iframe. The bundle is gated below 8 KB gzipped.
|
|
595
735
|
|
|
596
736
|
Availability is factual: `available`, `unsupported-api`, `script-failure`, `background-tab`,
|
|
597
737
|
`early-exit` or `insufficient-observation`. Missing realms are not disagreements; discarded fields
|
|
598
738
|
cannot leave stale cross-realm findings. Availability alone changes no classification verdict.
|
|
739
|
+
The full browser version list is sent only when the worker reports client hints to compare it
|
|
740
|
+
with, so an ordinary Chrome beacon fits the budget untrimmed. Trimming optional detail keeps
|
|
741
|
+
`available`; only a trim that removes a field the server's verdict reads, or a cross-realm
|
|
742
|
+
finding, reports `insufficient-observation`.
|
|
599
743
|
|
|
600
744
|
**Content-Security-Policy.** Supply an independently server-generated application CSP nonce as
|
|
601
745
|
`<DiscoverCollector config={discoverConfig} nonce={cspNonce} />`; never read it from an unsanitized
|
|
@@ -615,13 +759,18 @@ nix develop -c pnpm -C ts --filter @steadphast/connector-nextjs build
|
|
|
615
759
|
nix develop -c pnpm -C ts deadcode
|
|
616
760
|
```
|
|
617
761
|
|
|
618
|
-
The build has
|
|
762
|
+
The build has three public entries and two repository-only loopback fixture entries. Knip tracks
|
|
619
763
|
the build entrypoints explicitly because the Next.js fixtures import their compiled paths;
|
|
620
764
|
the private entries remain excluded from package exports and published files. The hosted
|
|
621
765
|
`nextjs-connector-checks` gate exercises both supported runtimes through nginx and the live API.
|
|
622
766
|
The durable replay test waits for the first committed value and then for every replay job to
|
|
623
767
|
settle; asynchronous acceptance does not promise FIFO completion.
|
|
624
768
|
|
|
769
|
+
Family C's jsdom controls exercise consent/revocation, first-hide/BFCache/SPA closure, masking,
|
|
770
|
+
sample/action/body bounds and timing abstention deterministically. They do not emulate native
|
|
771
|
+
hardware or satisfy the independent human/agent corpus; real connector → API/Postgres → reader
|
|
772
|
+
verification remains separate.
|
|
773
|
+
|
|
625
774
|
## Troubleshooting
|
|
626
775
|
|
|
627
776
|
- **No events appear:** switch the Explore traffic filter to all traffic first, because the default
|
|
@@ -646,14 +795,23 @@ settle; asynchronous acceptance does not promise FIFO completion.
|
|
|
646
795
|
the `proxy_set_header Host` lines, and `publicOrigin` agree with each other.
|
|
647
796
|
- **Self-hosted URLs show the wrong host:** `publicOrigin` does not match the public scheme, host,
|
|
648
797
|
and port nginx serves; it is never derived from request headers.
|
|
649
|
-
- **
|
|
650
|
-
|
|
798
|
+
- **Cookie values or query values appear:** confirm the deployed connector is newer than 0.6.0;
|
|
799
|
+
0.6.0 and earlier sent them unless excluded.
|
|
651
800
|
- **Your site response fails:** inspect your own handler and application route. Steadphast delivery
|
|
652
801
|
failures are swallowed and never change the response.
|
|
653
802
|
|
|
654
803
|
## Upgrading
|
|
655
804
|
|
|
656
|
-
- **0.
|
|
805
|
+
- **0.7.1** adds optional rendering evidence. Installing it does not grant permission:
|
|
806
|
+
`environment.rendering`, server-checked per-visit `environmentPermitted`, and a current
|
|
807
|
+
workspace rendering grant are all required. Without them ordinary T0 is unchanged.
|
|
808
|
+
- **0.7.0** never sends cookie values (only the
|
|
809
|
+
`x-steadphast-cookie-names` marker),
|
|
810
|
+
empties query values in `external_url` except for a request carrying signature headers that
|
|
811
|
+
cover the query, and reduces `Referer` to its origin. See
|
|
812
|
+
[Cookies, query strings, and Referer](#cookies-query-strings-and-referer). No configuration
|
|
813
|
+
change is needed; an existing `excludedHeaders: ["cookie"]` now also drops the cookie names.
|
|
814
|
+
- **0.6.0** adds the opt-in T0 client collector. It also stops sending the
|
|
657
815
|
`Payment-Authorization` credential and sends the `x-steadphast-payment-credential` presence
|
|
658
816
|
marker in its place. Upgrade the connector and the Steadphast API together: the API rejects an
|
|
659
817
|
older envelope that still carries `Payment-Authorization`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProbeRunner } from "./page-probes.js";
|
|
2
|
+
/** Stringified after compilation; every runtime dependency lives inside this function. */
|
|
3
|
+
export declare function behavioralCollector(sdk: ProbeRunner, nonce: string, endpoint: string, timing: boolean, issuedAt: number, route: string, notice?: boolean, pathCapture?: boolean, timingRoute?: "customer-host" | "steadphast-host"): void;
|
|
4
|
+
/** Call from the customer's consent callback; revocation closes this document permanently. */
|
|
5
|
+
export declare function setBehavioralConsent(granted: boolean, revoked?: boolean): void;
|
|
6
|
+
/** Synchronous browser-local OFF: listeners removed and unsent buffers discarded. */
|
|
7
|
+
export declare function disableBehavioralCollection(): void;
|
|
8
|
+
/** Call before a programmatic SPA transition when the browser has no navigation event. */
|
|
9
|
+
export declare function closeBehavioralRoute(): void;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setBehavioralConsent, disableBehavioralCollection, closeBehavioralRoute, } from "./behavioral-collector.js";
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/behavioral-collector.ts
|
|
2
|
+
function setBehavioralConsent(granted, revoked = false) {
|
|
3
|
+
window.dispatchEvent(
|
|
4
|
+
new CustomEvent("steadphast:behavioral-consent", {
|
|
5
|
+
detail: { granted, revoked }
|
|
6
|
+
})
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
function disableBehavioralCollection() {
|
|
10
|
+
window.dispatchEvent(new Event("steadphast:behavioral-disable"));
|
|
11
|
+
}
|
|
12
|
+
function closeBehavioralRoute() {
|
|
13
|
+
window.dispatchEvent(new Event("steadphast:behavioral-route"));
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
closeBehavioralRoute,
|
|
17
|
+
disableBehavioralCollection,
|
|
18
|
+
setBehavioralConsent
|
|
19
|
+
};
|
package/dist/config.d.ts
CHANGED
|
@@ -29,6 +29,31 @@ export interface DiscoverNextCommonConfig {
|
|
|
29
29
|
* from visitor headers. Disabled requests have no collector output or envelope keys.
|
|
30
30
|
*/
|
|
31
31
|
collector?: boolean;
|
|
32
|
+
/** Optional site authorization, separate from the workspace and per-render permission. */
|
|
33
|
+
environment?: {
|
|
34
|
+
rendering?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Family C defaults to own, independently of T0. An explicit collector:false or mode:"off"
|
|
38
|
+
* wins. Only exact approved pathnames are eligible; an empty route list collects nothing.
|
|
39
|
+
* Timing remains off unless both this switch and the workspace timing switch are true.
|
|
40
|
+
* Browser consent is supplied separately through the consent event, never by configuration,
|
|
41
|
+
* unless `consentBasis` is "notice" here AND the workspace's Steadphast-set consent basis is
|
|
42
|
+
* "notice" (ADR 0053 amendment, 2026-11-16): then the window starts without a prompt on a site
|
|
43
|
+
* whose privacy notice discloses the collection. Revocation and every OFF control still apply.
|
|
44
|
+
* `pathCapture` likewise needs the workspace's `path_capture_enabled` too: only with both does
|
|
45
|
+
* the page script add each click target's bounding box (geometry only) for pointer-path replay.
|
|
46
|
+
*/
|
|
47
|
+
behavioral?: {
|
|
48
|
+
mode?: "own" | "off" | "partner";
|
|
49
|
+
timing?: boolean;
|
|
50
|
+
/** Provenance of the configured Discover receiver, not an extra destination or permission.
|
|
51
|
+
* Defaults to the Steadphast API. Set customer-host for a customer-provisioned receiver hostname. */
|
|
52
|
+
timingRoute?: "customer-host" | "steadphast-host";
|
|
53
|
+
routes?: ReadonlyArray<string>;
|
|
54
|
+
consentBasis?: "affirmative" | "notice";
|
|
55
|
+
pathCapture?: boolean;
|
|
56
|
+
};
|
|
32
57
|
}
|
|
33
58
|
/** The connector configuration: the explicit deployment mode plus the common transport settings. */
|
|
34
59
|
export type DiscoverNextConfig = DiscoverDeploymentMode & DiscoverNextCommonConfig;
|
|
@@ -51,6 +76,7 @@ export declare const BEACON_PATHNAME = "/v1/client/t0";
|
|
|
51
76
|
export declare const COLLECTOR_HEADER_PREFIX = "x-steadphast-collector-";
|
|
52
77
|
/** Authenticated middleware-to-render context, domain-separated from browser beacon nonces. */
|
|
53
78
|
export declare const COLLECTOR_CONTEXT_HEADER = "x-steadphast-collector-context";
|
|
79
|
+
export declare const BEHAVIORAL_CONTEXT_HEADER = "x-steadphast-collector-behavioral";
|
|
54
80
|
export declare class DiscoverConfigError extends TypeError {
|
|
55
81
|
readonly name = "DiscoverConfigError";
|
|
56
82
|
}
|