Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@sdxc/newsletter

Latest version: v2026.11.29

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
npm package Publisher: sergiodxa
18 Stars
1 Forks
13 Versions
590 Downloads
TypeScript Repo language

Scan summary

@sdxc/newsletter was last scanned on 29 Nov 2026 at version 2026.11.29. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 13 versions; the latest was published on 29 Nov 2026.
  • Findings: No rules fired in version 2026.11.29.
  • Downloads: 590 downloads.

Versions

13 versions published
Versions and the rules that fired in each
VersionPublishedStatus
2026.11.29 LATEST 29 Nov 2026 No rules fired
2026.11.10 10 Nov 2026 No rules fired
2026.11.3 3 Nov 2026 No rules fired
2026.10.26 26 Oct 2026 Not shown
2026.10.25 25 Oct 2026 Not shown

No rules fired in 2026.11.29

Findings

Findings for v2026.11.29. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 2026.11.29; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@sdxc/newsletter

Vendor-neutral newsletter subscriber lists, with Buttondown and Kit providers, a memory provider for tests and a verified webhook endpoint.

Installation

npm add @sdxc/newsletter

Addresses come parsed by @sdxc/email-address, a visitor's IP is an IP from @sdxc/ip, and every answer is a Result from @sdxc/result. The middleware and webhook endpoint run on remix/router from remix.

Usage

Create a provider

Build one provider at module scope. Construction reaches no network, so a missing API key fails the call that needed it, never the boot.

import type { Newsletter } from "@sdxc/newsletter";

import { ButtondownNewsletter } from "@sdxc/newsletter/buttondown";

export let newsletter: Newsletter = new ButtondownNewsletter({
    apiKey: process.env.BUTTONDOWN_API_KEY ?? "",
    webhookSecret: process.env.BUTTONDOWN_WEBHOOK_SECRET,
    confirmation: "double",
});

Kit decides double opt-in by the form a reader joins through, so its provider names that form:

import { KitNewsletter } from "@sdxc/newsletter/kit";

export let newsletter: Newsletter = new KitNewsletter({
    apiKey: process.env.KIT_API_KEY ?? "",
    webhookSecret: process.env.KIT_WEBHOOK_SECRET,
    form: { id: "55", confirmation: "double" },
});
Subscribe an address
import { parseEmailAddress } from "@sdxc/email-address";
import { IP } from "@sdxc/ip";
import { isFailure } from "@sdxc/result";

let email = parseEmailAddress("reader@example.com");
if (isFailure(email)) throw email.error;

let outcome = await newsletter.subscribers.subscribe({
    email: email.data,
    tags: ["launch"],
    ip: IP.parse(request.headers.get("cf-connecting-ip") ?? ""),
});

if (isFailure(outcome)) {
    outcome.error.code; // "invalid_address", "suppressed", "rate_limited", ...
} else {
    outcome.data.created; // false when the address was already on the list
    outcome.data.subscriber.status; // "pending" until the reader confirms
}

Subscribing an address the list already holds, in any status, succeeds with created: false and leaves the record untouched, so repeating the call is safe. ip takes the Result of IP.parse as it is; a failed parse records no IP.

Read, change and unsubscribe a reader

A reader is addressed by { id } or { email }; one the list does not hold fails as not_found.

let reader = await newsletter.subscribers.find({ email: email.data });
let tags = await newsletter.subscribers.tags({ email: email.data }); // ["launch"]

await newsletter.subscribers.update(
    { email: email.data },
    { tags: { add: ["buyer"], remove: ["launch"] }, metadata: { plan: "pro", trial: null } },
);

await newsletter.subscribers.unsubscribe({ email: email.data });

Metadata merges into what is stored, and a null value removes that key. Unsubscribing keeps the record and succeeds again on an unsubscribed reader.

API

Newsletter

The contract every provider implements: connection (the configured credential set's name), subscribers, webhooks, and native, the underlying client for endpoints the contract leaves out.

subscribers.subscribe(input: SubscribeInput): Promise<Result<SubscribeOutcome, NewsletterError>>

Ensures an address is on the list. A new reader answers created: true with status "pending" when a confirmation email went out and "active" otherwise. tags, metadata and attribution apply only to a reader the call creates.

subscribers.find(ref: SubscriberRef): Promise<Result<Subscriber, NewsletterError>>

Reads one reader.

subscribers.tags(ref: SubscriberRef): Promise<Result<string[], NewsletterError>>

Reads one reader's tag names, which Subscriber leaves out.

subscribers.list(query?: ListSubscribersQuery): Promise<Result<Page<Subscriber>, NewsletterError>>

Reads one page of readers, filtered by status or tag. Pass the page's cursor back for the next one; the walk ends only at cursor === null, since a page may come back short before the last.

subscribers.update(ref: SubscriberRef, input: UpdateSubscriberInput): Promise<Result<Subscriber, NewsletterError>>

Adds and removes tags by name and merges metadata, answering the stored reader.

subscribers.unsubscribe(ref: SubscriberRef): Promise<Result<Subscriber, NewsletterError>>

Marks a reader unsubscribed and keeps the record. The contract has no resubscribe: the reader opts back in themselves.

webhooks.verify(request: Request, rawBody: string): Promise<boolean>

Whether the configured secret proves a delivery. An unset or empty secret answers false.

webhooks.events(request: Request, rawBody: string): Result<NewsletterEvent[], NewsletterError>

Normalizes an authentic delivery into its events. A platform event type with no mapping arrives as unrecognized.

DEFAULT_PAGE_SIZE

100, the page size list uses when the query names no limit.

NewsletterError

The error in every failed Result: a normalized code, the platform's providerCode, connection, retryable (true only for rate_limited) and retryAfter in seconds or null. invalid_address and suppressed are the refusals a visitor can act on; unknown is a timeout or 5xx after which a write may have landed. Providers never retry on their own.

new NewsletterWebhook<Context>(provider: Newsletter, handlers: NewsletterWebhookHandlers<Context>, options?: NewsletterWebhookOptions)

A webhook endpoint whose handler mounts as a route handler. Each handler receives (event, context), with context typed as the Context you pass (your router's RouterContext, so services its middleware publishes are typed; it defaults to RequestContext). It answers 401 to an unproven delivery, 200 to an authentic one (including one it cannot parse), and 503 when a handler returns a Failure (or throws), so the platform redelivers. With a ReplayStore from @sdxc/webhooks in options.store, it skips event ids already handled for options.ttl (default "7 days"); without one, handlers must be idempotent. Buttondown signs without a timestamp, so give its endpoint a store.

@sdxc/newsletter/middleware
newsletter(options: NewsletterMiddlewareOptions): Middleware

The default export. Publishes options.provider, or a per-request factory's answer, as context.newsletter on a remix/router router, under the CurrentNewsletter context key it shares with ./middleware/cli.

@sdxc/newsletter/middleware/cli
newsletter(options: NewsletterCommandOptions): CommandMiddleware

The default export. Publishes options.provider, or (ctx) => Newsletter resolved once per run, as ctx.newsletter on an @sdxc/cli command, for subscribing or removing an address by hand.

import { createCLI } from "@sdxc/cli";
import newsletter from "@sdxc/newsletter/middleware/cli";

let cli = createCLI({ name: "app", commands, middleware: [newsletter({ provider })] });
@sdxc/newsletter/buttondown
new ButtondownNewsletter(options: ButtondownNewsletterOptions)
  • apiKey: Buttondown API key; an empty key fails every call as unauthenticated.
  • webhookSecret: the webhook's signing key.
  • confirmation: "double" (default) or "single".
  • connection: name reported on errors; defaults to "buttondown".
  • newsletterId: the newsletter this instance serves; deliveries for another newsletter of the account carry no events.
API_VERSION

The Buttondown API version every request pins.

@sdxc/newsletter/kit
new KitNewsletter(options: KitNewsletterOptions)
  • apiKey: Kit v4 API key; an empty key fails every call as unauthenticated.
  • webhookSecret: the webhook's signing secret.
  • form: { id, confirmation }, the form readers join through. confirmation must match the form's own double opt-in setting. Without a form, readers start active and attribution is dropped.
  • connection: defaults to "kit".

Metadata keys must already exist as Kit custom fields, and a subscribe can take several requests against Kit's rate limit.

@sdxc/newsletter/memory
new MemoryNewsletter(options?: MemoryNewsletterOptions)

The whole contract in memory. Options: confirmation (default "double"), connection (default "memory"), webhookSecret (a built-in base64 secret by default; "" makes every delivery unproven) and faults, failures armed from the first call. On top of the contract it adds:

  • seed(records): adds readers directly, active unless a status is given.
  • confirm(email): moves a pending reader to active.
  • fail(target, code?) and heal(target?): arm and disarm a failure on "subscribers" or one method such as "subscribers.subscribe" (default code unknown).
  • attribution(email) and ip(email): what the creating subscribe recorded, or null.
  • webhooks.emit(event): signs a Standard Webhooks delivery for one event and answers { request, body, events }.
@sdxc/newsletter/conformance
conformance(options: ConformanceOptions): void

Registers Vitest tests that hold a provider to the contract: one subscribe per address, lookups by id and email, tags, metadata merging, idempotent unsubscribe, a full cursor walk and fail-closed webhooks. Options: name, create(), createWithoutSecret(), confirmation, deliver(provider, subscriber), and optional metadataKeys, missingId and email().

Types
SubscriberApi, WebhookApi

The subscribers and webhooks groups of Newsletter.

Subscriber

id, email, status, the platform's own providerStatus, metadata and createdAt.

SubscriberStatus

"pending" | "active" | "unsubscribed" | "suppressed"; suppressed is blocked, bounced or complained.

SubscriberRef

{ id: string } | { email: EmailAddress }.

SubscribeInput, SubscribeOutcome, UpdateSubscriberInput, ListSubscribersQuery, Page<T>

The inputs and answers of the subscriber methods above.

SubscriberAttribution

Optional source, medium, campaign, term, content, referrer and landingPage strings for a new reader.

NewsletterEvent, NewsletterEventPayload, NewsletterEventType, NewsletterEventOf<Type>

An inbound event: its type, the platform's event id (the deduplication key), occurredAt, subscriberId, subscriber (or null when the delivery carried only the id) and raw. NewsletterEventOf narrows the union to one type.

NewsletterWebhookHandler<Type>, NewsletterWebhookHandlers, NewsletterWebhookOptions

Handlers keyed by event type, so a misspelled key is a type error, and the endpoint's store and ttl.

NewsletterErrorCode, NewsletterErrorOptions

The normalized codes and what a provider passes to new NewsletterError(message, options).

NewsletterMiddlewareOptions, NewsletterCommandOptions, ButtondownNewsletterOptions, KitNewsletterOptions, KitForm

Provider and middleware options listed above.

MemoryNewsletterOptions, ConfirmationPolicy, MemorySubscriberSeed, MemoryFaultTarget, MemoryFaults, MemoryEmitEvent, MemoryDelivery, MemoryWebhookApi

The memory provider's options, seeds, fault targets and emitted deliveries.

ConformanceOptions, ConformanceDelivery

What conformance needs to build and sign for a provider.

Pattern: A subscribe form on a router

Publish the provider with the middleware, then branch on the two codes a visitor can act on.

import { parseEmailAddress } from "@sdxc/email-address";
import { IP } from "@sdxc/ip";
import newsletter from "@sdxc/newsletter/middleware";
import { ButtondownNewsletter } from "@sdxc/newsletter/buttondown";
import { isFailure } from "@sdxc/result";
import { createRouter } from "remix/router";

let provider = new ButtondownNewsletter({ apiKey: process.env.BUTTONDOWN_API_KEY ?? "" });

let router = createRouter({ middleware: [newsletter({ provider })] });

router.post("/subscribe", async (context) => {
    let form = await context.request.formData();
    let email = parseEmailAddress(String(form.get("email") ?? ""));
    if (isFailure(email)) return new Response("Enter a valid email", { status: 422 });

    let outcome = await context.newsletter.subscribers.subscribe({
        email: email.data,
        ip: IP.parse(context.request.headers.get("cf-connecting-ip") ?? ""),
    });

    if (isFailure(outcome)) {
        if (outcome.error.code === "invalid_address") {
            return new Response("That address can't receive email", { status: 422 });
        }
        if (outcome.error.code === "suppressed") {
            return new Response("That address can't be subscribed", { status: 422 });
        }
        return new Response("Try again later", { status: 503 });
    }

    return new Response(
        outcome.data.subscriber.status === "pending" ? "Check your inbox" : "You're subscribed",
    );
});

For a list that varies per tenant, pass a factory instead: newsletter({ provider: (context) => listFor(context) }).

Pattern: Testing against the memory provider

Install a MemoryNewsletter in place of the real provider, arm a failure, and assert on what it recorded.

import newsletter from "@sdxc/newsletter/middleware";
import { MemoryNewsletter } from "@sdxc/newsletter/memory";
import { createRouter } from "remix/router";
import { expect, test } from "vitest";

import { subscribeHandler } from "./subscribe.js";

test("a blocked address sees the blocked copy", async () => {
    let provider = new MemoryNewsletter();
    provider.fail("subscribers.subscribe", "suppressed");

    let router = createRouter({ middleware: [newsletter({ provider })] });
    router.post("/subscribe", subscribeHandler);

    let response = await router.fetch(
        new Request("https://example.com/subscribe", {
            method: "POST",
            body: new URLSearchParams({ email: "reader@example.com" }),
        }),
    );

    expect(await response.text()).toContain("can't be subscribed");
    expect(provider.attribution("reader@example.com")).toBeNull();
});

Pattern: Crediting the campaign a visitor arrived from

attribution records where a new reader came from. @sdxc/attribution remembers a visitor's touches across pages: toCampaign flattens one touch into these fields and toMetadata keeps the first and last touches as metadata keys.

import { toCampaign, toMetadata } from "@sdxc/attribution";
import { isFailure } from "@sdxc/result";

let outcome = await context.newsletter.subscribers.subscribe({
    email,
    attribution: toCampaign(touches.last ?? touches.first, context.url),
    metadata: toMetadata(touches),
    ip,
});

if (!isFailure(outcome) && outcome.data.created) {
    // attribution and metadata were recorded on the new reader
}

Without that package, pass the fields directly: { source: "newsletter", medium: "email", campaign: "launch", landingPage: context.url.href }. On Kit, every metadata key must already exist as a custom field.

Pattern: Reacting to webhook events

Mount a NewsletterWebhook and key handlers by event type. A returned Failure answers 503, and with a replay store the redelivery skips the events already handled.

import { NewsletterWebhook } from "@sdxc/newsletter";
import { isFailure } from "@sdxc/result";
import { KVReplayStore } from "@sdxc/webhooks";
import { createRouter } from "remix/router";

let endpoint = new NewsletterWebhook(
    newsletter,
    {
        async "subscriber.confirmed"(event) {
            let reader = event.subscriber;
            if (reader === null) {
                let found = await newsletter.subscribers.find({ id: event.subscriberId });
                if (isFailure(found)) return found;
                reader = found.data;
            }
            await sendWelcome(reader.email);
        },
        async "subscriber.suppressed"(event) {
            await markUndeliverable(event.subscriberId);
        },
    },
    { store: new KVReplayStore(kv, { prefix: "newsletter:" }), ttl: "14 days" },
);

let router = createRouter();
router.post("/webhooks/newsletter", endpoint.handler);

In a test, MemoryNewsletter.webhooks.emit signs a delivery to hand the endpoint:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @sdxc/newsletter

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229