Scan your whole stack
From OX Research Newsroom
Are you using @ordinatio/email?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v1.19.0
@ordinatio/email was last scanned on 13 Nov 2026 at version 1.19.0. Risk score 45 of 100 (medium). High-severity rules fired.
| Version | Published | Status |
|---|---|---|
| 1.19.0 LATEST | 13 Nov 2026 | 1 rule fired |
| 1.18.0 | 13 Nov 2026 | 1 rule fired |
| 1.17.0 | 10 Nov 2026 | 1 rule fired |
| 1.16.0 | 10 Nov 2026 | Not shown |
| 1.15.0 | 8 Nov 2026 | Not shown |
Findings for v1.19.0. 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.
A DNS lookup command (nslookup, dig or host) takes its query name from a subshell that first encodes the data, for example with base64 or xxd. Encoding the name turns a lookup into a way to send data to the nameserver of the queried domain. Ordinary diagnostic lookups have no encoding step.
HIGHThe score describes 1.19.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
A standalone, multi-provider email engine with OAuth + IMAP/SMTP support, auto-discovery, templates, scheduled delivery, and OAEM protocol integration.
Built as a Canonical module (C-03) under the Ordinatio architecture. Zero app-layer dependencies — all side effects (activity logging, events, contact resolution) injected via callbacks.
┌──────────────────────────────────────────────────┐
│ @ordinatio/email │
│ │
│ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │
│ │ Providers │ │ Services │ │ Discovery │ │
│ │ │ │ │ │ │ │
│ │ Gmail │ │ Account │ │ MX resolver │ │
│ │ Outlook │ │ Messages │ │ Autoconfig │ │
│ │ IMAP │ │ Sync │ │ SRV records │ │
│ │ │ │ Archive │ │ Port prober │ │
│ │ │ │ Content │ │ Intelligence │ │
│ │ │ │ Template │ │ │ │
│ │ │ │ Schedule │ │ │ │
│ └─────┬─────┘ └─────┬────┘ └───────┬───────┘ │
│ │ │ │ │
│ ┌─────┴──────────────┴───────────────┴───────┐ │
│ │ types / errors / schemas │ │
│ └─────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘
↕ PrismaClient ↕ Callbacks
(database injected) (side effects injected)
Key design principles:
PrismaClient instance; works with any tenant database# Install (within pnpm workspace)
pnpm add @ordinatio/email
# Or reference as workspace dependency
# package.json: "@ordinatio/email": "workspace:*"
import {
getProvider,
getActiveAccount,
syncEmails,
getInboxEmails,
replyToEmail,
discoverProvider,
} from '@ordinatio/email';
// Get the active email provider
const account = await getActiveAccount(db);
const provider = getProvider(account.provider.toLowerCase());
// Sync emails from provider
await syncEmails(db, {
onActivity: (action, desc, data) => console.log(action, desc),
onEmailSynced: async (email) => { /* extract context */ },
});
// Read inbox
const { emails, total } = await getInboxEmails(db, {
status: 'INBOX',
maxResults: 50,
});
// Auto-discover provider settings for a new email address
const discovery = await discoverProvider('user@acmecorp.com');
// → { domain: 'acmecorp.com', providers: [{ type: 'imap', settings: {...} }] }
Three built-in providers, plus a registry for custom providers.
import { GmailProvider } from '@ordinatio/email';
const gmail = new GmailProvider();
gmail.authType; // 'oauth'
gmail.getCapabilities(); // { supportsLabels: true, supportsNativeThreading: true, ... }
// OAuth flow
const authUrl = gmail.getAuthUrl('state-token');
const tokens = await gmail.exchangeCodeForTokens(code);
// Token refresh — use getValidAccessToken(db, accountId) instead of calling this directly.
// It handles the 5-minute buffer, token rotation capture, and TokenRevokedError.
const refreshed = await gmail.refreshAccessToken(tokens.refreshToken);
// Operations
const { messages, nextCursor } = await gmail.listMessages(tokens.accessToken, {
maxResults: 50,
after: new Date('2026-01-01'),
});
const full = await gmail.getMessage(tokens.accessToken, messageId);
await gmail.archiveMessage(tokens.accessToken, messageId);
await gmail.sendMessage(tokens.accessToken, { to, subject, bodyHtml });
Requests the single gmail.modify scope (enough for every call this provider makes; see
src/providers/gmail-scopes.test.ts). If the user completes Google's consent screen but unticks it,
exchangeCodeForTokens throws GmailScopeNotGrantedError (test with isGmailScopeNotGrantedError(err);
also exported from @ordinatio/email/client). Nothing is stored or revoked: a revoke at Google acts on
the whole authorization and could kill an existing live connection. The token Google issued for that rejected
grant is simply discarded unused; the user can remove the app at myaccount.google.com/permissions. Grants made under earlier versions' three scopes keep working.
Environment variables:
GOOGLE_CLIENT_ID=xxx
GOOGLE_CLIENT_SECRET=xxx
GOOGLE_REDIRECT_URI=http://localhost:3000/api/email/callback/gmail
import { OutlookProvider } from '@ordinatio/email';
const outlook = new OutlookProvider();
outlook.authType; // 'oauth'
outlook.getCapabilities(); // { supportsFolders: true, maxAttachmentSize: 157286400, ... }
// OAuth flow (Microsoft MSAL)
const authUrl = outlook.getAuthUrl('state-token');
const tokens = await outlook.exchangeCodeForTokens(code);
// Operations use Microsoft Graph API
const { messages } = await outlook.listMessages(tokens.accessToken);
await outlook.archiveMessage(tokens.accessToken, messageId); // Moves to Archive folder
Environment variables:
MICROSOFT_CLIENT_ID=xxx
MICROSOFT_CLIENT_SECRET=xxx
MICROSOFT_REDIRECT_URI=http://localhost:3000/api/email/callback/outlook
Works with any email provider that supports IMAP and SMTP.
import { ImapSmtpProvider } from '@ordinatio/email';
import type { ImapSmtpCredentials } from '@ordinatio/email';
const imap = new ImapSmtpProvider();
imap.authType; // 'credentials'
// Test connection before saving
const credentials: ImapSmtpCredentials = {
imapHost: 'imap.fastmail.com',
imapPort: 993,
imapSecurity: 'ssl',
smtpHost: 'smtp.fastmail.com',
smtpPort: 465,
smtpSecurity: 'ssl',
username: 'user@fastmail.com',
password: 'app-password-here',
};
const test = await imap.testConnection(credentials);
// → { success: true, imapConnected: true, smtpConnected: true, folderCount: 12, messageCount: 1847 }
// Operations
const { messages } = await imap.listMessages(JSON.stringify(credentials));
Register your own provider implementation:
import { registerProvider } from '@ordinatio/email';
import type { EmailProvider } from '@ordinatio/email';
class ProtonMailProvider implements EmailProvider {
readonly providerId = 'protonmail';
readonly authType = 'credentials' as const;
// ... implement required methods
}
registerProvider('protonmail', () => new ProtonMailProvider());
Each provider declares its capabilities:
interface ProviderCapabilities {
supportsOAuth: boolean;
supportsPushNotifications: boolean;
supportsNativeArchive: boolean;
supportsNativeThreading: boolean;
supportsServerSearch: boolean;
supportsLabels: boolean; // Gmail-specific
supportsFolders: boolean; // IMAP-specific
archiveAction: 'label_remove' | 'move_folder' | 'flag';
maxAttachmentSize: number; // bytes
}
| Capability | Gmail | Outlook | IMAP/SMTP |
|---|---|---|---|
| OAuth | Yes | Yes | No |
| Push notifications | Yes | Yes (webhooks) | No |
| Native threading | Yes (threadId) |
Yes (conversationId) |
No |
| Native archive | Yes (remove INBOX label) | Yes (move to Archive folder) | Flag-based |
| Server search | Yes (full-text) | Yes (OData filter) | IMAP SEARCH |
| Max attachment | 25 MB | 150 MB | Varies |
When a mailbox is deleted, the stored sign-in goes with it, but the grant at Google stays listed under the user's Google account permissions until it is revoked. revokeGoogleToken asks Google to revoke it:
import { revokeGoogleToken } from '@ordinatio/email';
const outcome = await revokeGoogleToken(refreshToken, { tokenKind: 'refresh' });
// outcome.result: 'revoked' | 'already-gone' | 'failed'
tokenKind: 'access'); Google's invalid_token reply to one proves nothing about the grant, so it is reported as failed, never already-gone.timeoutMs to change it), so a slow Google cannot stall a deletion.planSync, runPages, syncResultData, isRejectedPageToken and arrivalsToLog decide how to sync one mailbox and what to save afterwards. They have no database, network or clock of their own: you pass the time and supply storage, locking and the provider calls (runPages only calls the callbacks you give it).
import { planSync, runPages, syncResultData, arrivalsToLog, isRejectedPageToken, getProvider } from '@ordinatio/email';
import type { ProviderType } from '@ordinatio/email';
const startedAt = Date.now();
const emailProvider = getProvider(account.provider.toLowerCase() as ProviderType); // 'imap' | 'gmail' | 'outlook'
const plan = planSync({ provider: account.provider, syncCursor: account.syncCursor, lastSyncAt: account.lastSyncAt }, new Date());
const listing = await runPages({
plan,
// accessToken: whatever your provider's listMessages takes (for IMAP, the serialized credentials string).
listPage: (cursor) => emailProvider.listMessages(accessToken, { ...plan.listOptions, cursor }),
storePage: async (messages) => storeIdempotently(messages), // count stored, or null if the account changed meanwhile
elapsedMs: () => Date.now() - startedAt,
perCallTimeoutMs: 20_000, // worst case for ONE listing
budgetMs: 55_000, // how long the whole sync may take (e.g. your lock's lifetime minus a reserve)
onFirstPageFailure: async (error) => { if (isRejectedPageToken(error)) await clearSavedPageToken(account.id); },
});
if (!listing.discarded) {
await saveAccount(account.id, syncResultData(plan, listing.nextCursor, new Date(startedAt))); // the time the sync BEGAN
const newMail = arrivalsToLog({ skipped: false, isBackfill: plan.isBackfill, created: listing.created });
}
Inputs (SyncAccountState):
provider: 'IMAP' | 'GMAIL' | 'OUTLOOK', either case. Any other value is treated as a cursor-model provider.syncCursor: opaque and provider-specific: the provider's own cursor for IMAP/Outlook, a JSON scan state (written by syncResultData) for Gmail. Never mix them. A Gmail scan state on a non-Gmail account, or a non-scan cursor on a Gmail account, is ignored; reset the cursor on reconnect all the same.lastSyncAt: when the last COMPLETED sync (Gmail: scan) started; null = never synced. An invalid date counts as null; a future one is clamped to now.How it works:
after: window (first sync: last 30 days, never further), 100 per page, up to 2 pages per call, resumed across calls through the JSON kept in syncCursor. Gmail cannot use the cursor model: its listing is newest-first and costs one API call per message.runPages stores each page before fetching the next, so a later failure keeps earlier progress (optional onLaterPageFailure is told; with none, the error name is logged); it only fetches another page while the worst case fits budgetMs; if your storePage returns null (the account changed mid-sync) it stops and sets discarded: do not write sync state then.storePage must be idempotent (insert if absent): re-listing overlapping mail is expected. Throttling repeat syncs is yours: each Gmail message listed costs an API call.lastSyncAt means "when the last COMPLETED scan started" for Gmail. A reconnect should reset it and the cursor (the next sync is then a backfill and arrivalsToLog reports nothing).isRejectedPageToken is true only when Google REJECTED a saved page token: an HTTP 400 (on status, response.status or code) whose message names the page token, or, for an error with no status at all, a message that says the page token is invalid. A timeout, 429 or 5xx is never one, so a long scan's progress is not thrown away. It relies on Google's error wording naming the token; see the comment in the source.arrivalsToLog as new.syncEmails: the package's bundled single-account syncEmails keeps its own simpler model (50 per page, its own page-token check) and is unchanged. Use this planner when you own storage and need Gmail scans that are bounded and resumable.Every stored email corresponds to a Person: the SENDER of received mail, the first recipient of mail you sent. If no Person exists for the address, one is created. A message links to ONE Person (the first counterparty); every other recipient of mail you sent still becomes a Person (up to the cap below). The logic lives here; your app keeps its tables, tenancy and locking, and plugs in through a small PeopleStore.
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.
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).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.