Scan your whole stack
From OX Research Newsroom
Are you using @tesouro/embedded-components-loader?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.11.308
@tesouro/embedded-components-loader was last scanned on 23 Nov 2026 at version 0.11.308. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.11.308 LATEST | 23 Nov 2026 | No rules fired |
| 0.11.307 | 23 Nov 2026 | No rules fired |
| 0.11.305 | 23 Nov 2026 | No rules fired |
| 0.11.304 | 23 Nov 2026 | Not shown |
| 0.11.303 | 23 Nov 2026 | Not shown |
Findings for v0.11.308. 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 0.11.308; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The loader for the hosted build of @tesouro/embedded-components-react: the
same widgets, served by Tesouro from https://widgets.tesouro.com instead of
bundled into your app. The hosted build renders with your page's own React,
which you hand to the loader (the injected React). The loader carries no widget
code of its own.
The hosted build is the npm package's code at one exact, unchanging version. Everything else in Getting started still applies: you need the same credentials and the same token route. Only how the widgets reach the page changes.
There are two ways to load it, depending on whether your page has a build step.
Both end in the same call, loadTesouro({ modules }), which resolves once the
widget code and its stylesheet have loaded.
Install the loader at an exact version. Loader 1.2.3 loads hosted 1.2.3.
npm install --save-exact @tesouro/embedded-components-loader
Then make one awaited call with your react, react-dom and
react/jsx-runtime modules, before you render anything it returns:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as jsxRuntime from 'react/jsx-runtime';
import { createRoot } from 'react-dom/client';
import { loadTesouro } from '@tesouro/embedded-components-loader';
const { RefreshingRootWidgetProvider, BankAccountsWidget } = await loadTesouro({
modules: { React, ReactDOM, jsxRuntime },
});
createRoot(document.getElementById('root')!).render(
<RefreshingRootWidgetProvider
baseUrl="https://api.sandbox.tesouro.com"
fetcher={fetcher}
>
<BankAccountsWidget />
</RefreshingRootWidgetProvider>,
);
fetcher is the same function that calls your token route in Getting started.
The loader adds the widget stylesheet to the page itself, so do not import
styles.css from the npm package. The result is fully typed: every provider,
hook and widget has the npm package's types, with no other package to install.
A page with no bundler imports loader.js from the version folder in a module
script and takes React as ES modules from a URL. esm.sh works:
<div id="root"></div>
<script type="module">
import * as React from 'https://esm.sh/react@19.3.0';
import * as ReactDOM from 'https://esm.sh/react-dom@19.3.0?deps=react@19.3.0';
import * as jsxRuntime from 'https://esm.sh/react@19.3.0/jsx-runtime';
import { createRoot } from 'https://esm.sh/react-dom@19.3.0/client?deps=react@19.3.0';
import { loadTesouro } from 'https://widgets.tesouro.com/embedded-components-react/1.2.3/loader.js';
const fetcher = async () => {
const res = await fetch('/api/widget-token', { method: 'POST' });
if (!res.ok) throw new Error('Widget token request failed');
return res.json();
};
const { RefreshingRootWidgetProvider, BankAccountsWidget } =
await loadTesouro({
modules: { React, ReactDOM, jsxRuntime },
});
createRoot(document.getElementById('root')).render(
React.createElement(
RefreshingRootWidgetProvider,
{ baseUrl: 'https://api.sandbox.tesouro.com', fetcher },
React.createElement(BankAccountsWidget),
),
);
</script>
Keep ?deps=react@19.3.0 on every react-dom URL. It makes esm.sh build
react-dom against that same React; without it, react-dom can bring its own
copy, and the page ends up with two.
Pass the react, react-dom and react/jsx-runtime imports your app renders
with, not another copy. The loader checks that the versions are supported and
that ReactDOM.version matches React.version, but it checks version strings
only: it cannot prove which React your app renders with. A different copy fails
at first render with React's own "Invalid hook call" error.
Providers, hooks and widgets all come from the hosted build. Do not import a provider from the npm package and render hosted widgets under it: that gives two separate contexts, the widgets never see the provider, and nothing reports an error.
A page runs one hosted version. A call for a different version on the same page
rejects with version-conflict, whichever loader makes it.
Nothing loads a "latest" version, and nothing tells a page that a newer version exists. You choose when to move:
--save-exact keeps a lockfile refresh from moving it.loader.js URL.
Change the URL to change the version.Each version folder is written once and kept, so a pinned page keeps working.
Most pages need only the call above. entry narrows what loads, mirroring the
npm subpaths:
entry |
Loads | npm equivalent |
|---|---|---|
| omitted | every stable widget | …/embedded-components-react |
'BillPayWidget' |
one stable widget, for a smaller load | …/lib/BillPayWidget |
'experimental' |
every experimental widget | …/experimental |
'experimental/QuickViewWidget' |
one experimental widget | …/experimental/QuickViewWidget |
Entries loaded on one page share their code and the stylesheet, so a second
entry fetches only what is new. Experimental entries carry no stability
promise: they can change or disappear in any version, including a patch, and a
widget that graduates moves to its stable name ('QuickViewWidget').
entry is typed as the entry names this version publishes, and the promise
resolves to that entry's module type. A name only known at runtime needs a
cast to one of them; the loader still rejects it with unknown-entry if this
version does not have it.
Importing the loader does nothing; loading starts on the call. A second call for the same entry while one is pending returns the same promise, and a failed call is retried in full by the next one.
Every failure rejects with TesouroLoaderError. Branch on its code; the
message is not part of the contract.
code |
Meaning | Retry helps |
|---|---|---|
react-out-of-range |
Your React version is outside the supported range | No |
react-dom-mismatch |
ReactDOM.version differs from React.version |
No |
react-export-missing |
Your React lacks an export the build imports | No |
version-conflict |
A different hosted version is already loaded on the page | No |
instance-conflict |
This version was already loaded with different React modules | No |
base-url-conflict |
This version was already loaded from a different baseUrl |
No |
unknown-entry |
The entry is not in this version; the message lists them | No |
network |
The manifest, the entry script or the stylesheet failed | Yes, after a reload |
import { TesouroLoaderError } from '@tesouro/embedded-components-loader';
try {
await loadTesouro({ modules });
} catch (error) {
if (error instanceof TesouroLoaderError && error.code === 'network') {
// Offer a reload. Every other code needs an integration fix.
}
throw error;
}
Only network can succeed on a retry, and reloading the page is the reliable
retry. After the entry script fails, Chromium answers a second import of it
from its module map without making a request, so a retry on the same page fails
again; Firefox and WebKit fetch it again. The error does not say which file
failed, so a page cannot tell when a same-page retry would help. A retry on the
same page must use the same baseUrl; switching to a mirror is
base-url-conflict.
Two policy forms work in Chromium, Firefox and WebKit. The examples show what
the widgets need, with 'self' for your own token route and stylesheets; merge
them into your existing policy. Wherever they name
https://widgets.tesouro.com, a page that loads from a mirror names the mirror
instead.
A nonce with 'strict-dynamic'. Put the page's nonce on the import map, if
you use one (see Integrity), and on the page's module script.
'strict-dynamic' then trusts every script those load: the loader,
the entry, its chunks and React from a URL.
script-src 'nonce-<random>' 'strict-dynamic';
style-src 'self' https://widgets.tesouro.com;
connect-src 'self' https://widgets.tesouro.com https://api.tesouro.com https://z.tesouro.com <file URL origins>;
worker-src https://widgets.tesouro.com blob:;
A host allowlist. Name https://widgets.tesouro.com and wherever React
comes from, such as https://esm.sh. An inline import map or module script
still needs its nonce, as any inline script does.
script-src 'self' https://widgets.tesouro.com https://esm.sh;
style-src 'self' https://widgets.tesouro.com;
connect-src 'self' https://widgets.tesouro.com https://api.tesouro.com https://z.tesouro.com <file URL origins>;
worker-src https://widgets.tesouro.com blob:;
Never rely on hashes alone. With only 'sha256-…' sources in script-src,
WebKit refuses a chunk reached by a static import, and the pdf.js worker behind
PDF previews cannot load.
What each directive is for:
| Directive | Allow |
|---|---|
script-src |
One of the two forms above. |
style-src |
The CDN origin, for index.css. |
connect-src |
The CDN origin, for manifest.json; your API origin (https://api.sandbox.tesouro.com in sandbox); https://z.tesouro.com for analytics, unless the provider has analytics={false}; the origins of the file URLs the API returns. |
worker-src |
Optional. If you set it, the CDN origin plus blob:. |
A page showing BankAccountOnboardingWidget for a bank that requires device
profiling also needs Alloy's origins, listed in the package README's
Content Security Policy section. Under 'strict-dynamic' the nonce covers
Alloy's script, and connect-src still needs its API.
Under a strict style-src, a few inline styles that dependencies add are still
refused, such as the toast library's <style> tag. How many a browser reports
varies: WebKit also reports inline style attributes that Chromium and Firefox
do not. The npm package has the same ones under the same policy, so the hosted
build adds none.
To check every script against the hash Tesouro published, give the page an
import map with an integrity section, filled from the files list in the
version's manifest.json. It covers the loader, the entry and every chunk it
imports, in all three engines. It must come before any module script on the
page.
<script type="importmap" nonce="<random>">
{
"integrity": {
"https://widgets.tesouro.com/embedded-components-react/1.2.3/loader.js": "sha384-...",
"https://widgets.tesouro.com/embedded-components-react/1.2.3/index.js": "sha384-...",
"https://widgets.tesouro.com/embedded-components-react/1.2.3/chunks/...": "sha384-..."
}
}
</script>
Build the section when you deploy, from the manifest of the version you pin, not in the page:
const folder = 'https://widgets.tesouro.com/embedded-components-react/1.2.3';
const manifest = await (await fetch(`${folder}/manifest.json`)).json();
const integrity = Object.fromEntries(
manifest.files
.filter((file) => file.path.endsWith('.js'))
.map((file) => [`${folder}/${file.path}`, file.integrity]),
);
console.log(JSON.stringify({ integrity }, null, 2));
Never use a script tag's integrity attribute instead. It covers only the file
the tag names, not the entry or the chunks, and in Firefox and WebKit a tampered
loader that the tag refused still ran when the page imported the same URL.
The stylesheet, the manifest and the pdf.js worker are outside both: nothing checks their integrity.
A mirror is a copy of the Tesouro CDN root that you serve from your own origin. To make one:
embedded-components-react/<version>/.externals list names, such as the pdf.js
worker under deps/. These paths are relative to the root, not to the
version folder.await loadTesouro({ modules, baseUrl: 'https://assets.example.com/tesouro' });
Without a build step, import loader.js from the mirror and still pass
baseUrl. The loader in a version folder does not read its own URL: without
baseUrl it loads the manifest, the entry and the chunks from
https://widgets.tesouro.com, wherever it was imported from. The pdf.js worker
follows the hosted build, which finds deps/ from its own URL, so it comes from
the mirror once baseUrl points there. Serve .js files with
a JavaScript content type, such as text/javascript, because browsers refuse a
module script served as anything else. If the mirror is on a different origin
from the page, serve it with CORS headers, because module scripts are fetched
with CORS.
Do not put crossorigin="use-credentials" on a script tag that loads from the
CDN. The CDN answers CORS with a wildcard origin and no credentials, so a
credentialed request is refused. The default (no crossorigin attribute on a
module script) is right.
Today the loader loads the React build. The elements build, for pages without React, will load through a second export of this package later, at the same version.
Apache-2.0. See LICENSE and NOTICE.
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.