Back to Blog
critical SEVERITY7 min read

How Unauthenticated HTTPS Fetch Calls Happen in JavaScript and How to Fix Them

A critical vulnerability in `script.js` was making unauthenticated HTTPS POST requests to an external summarization service without proper CORS controls or credential isolation, leaving users on compromised networks exposed to man-in-the-middle attacks. The fix adds explicit `mode: 'cors'` and `credentials: 'omit'` to the fetch call, ensuring the browser enforces cross-origin restrictions and prevents unintended credential leakage. This is especially significant because the affected code is part

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published August 26, 2026•Reviewed August 26, 2026

Answer Summary

This vulnerability is an unauthenticated HTTPS fetch with missing CORS controls (CWE-346) in `script.js` at line 1152, where a `fetch()` POST to `https://a11y-widget.jerit.in/summarize` lacked `mode: 'cors'` and `credentials: 'omit'`. On a compromised network, an attacker could intercept or manipulate the response via ARP spoofing or DNS hijacking. The fix adds both `mode: 'cors'` and `credentials: 'omit'` to the fetch options object, enforcing strict cross-origin browser policies and preventing cookie or credential leakage to the external endpoint.

Vulnerability at a Glance

cweCWE-346 (Origin Validation Error)
fixAdded `mode: 'cors'` and `credentials: 'omit'` to the fetch options in script.js at line 1154
riskMan-in-the-middle interception of summarization requests; unintended credential leakage to third-party domain
languageJavaScript
root causefetch() call to external domain lacked explicit CORS mode and credential isolation settings
vulnerabilityUnauthenticated Fetch / Missing CORS Controls

The Vulnerability in Context

The script.js file in this accessibility widget library contains a feature that summarizes text content by POSTing it to an external service at https://a11y-widget.jerit.in/summarize. On the surface, using HTTPS looks safe. But at line 1152, the fetch() call was missing two critical security properties — and that gap opened the door to man-in-the-middle (MITM) attacks and unintended credential exposure for every user of this library downstream.

Because this is a distributed Node.js/browser library, the vulnerability doesn't just affect one application. It affects every project that installs and uses this widget, multiplying the real-world blast radius significantly.


The Vulnerability Explained

What the Vulnerable Code Looked Like

Here's the fetch call as it existed before the fix (around line 1152 of script.js):

formData.append('data', text)
const response = await fetch('https://a11y-widget.jerit.in/summarize', {
  method: 'POST',
  body: formData
});

At first glance, this looks fine — it's HTTPS, it's a POST, it passes formData. But notice what's absent: there is no mode property and no credentials property in the fetch options.

Why Omitting These Properties Is Dangerous

Missing mode:
When mode is not explicitly set, the browser defaults to 'cors' for cross-origin requests — but this default behavior can be inconsistent across environments and does not communicate developer intent. More critically, in some configurations (e.g., with service workers, certain polyfills, or older browser quirks), the absence of an explicit mode can allow the request to fall back to a less restrictive mode. Explicitly declaring mode: 'cors' ensures the browser always enforces the Cross-Origin Resource Sharing protocol, and will refuse to complete the request if the server doesn't return the correct CORS headers.

Missing credentials: 'omit':
Without this property, the browser defaults to credentials: 'same-origin' for most fetch calls, but this default is not universally safe. In certain browser contexts, cookies, HTTP authentication headers, or TLS client certificates associated with the user's session could be forwarded to the external domain a11y-widget.jerit.in. For a third-party widget making calls to an external summarization API, this is a serious overshare.

The Attack Scenario

Consider a user on a public Wi-Fi network — a coffee shop, airport, or hotel — who has the widget embedded in a site they're visiting. An attacker on the same network performs ARP spoofing or DNS hijacking to redirect traffic destined for a11y-widget.jerit.in to their own server.

Because the original fetch call lacked credentials: 'omit', the browser might forward session cookies or auth headers to the attacker's server. The attacker can then:

  1. Capture any forwarded credentials associated with the user's browsing session.
  2. Return a malicious response from the spoofed summarization endpoint — potentially injecting content into the widget's output, which could escalate to XSS if the response is rendered without sanitization.
  3. Log all text content being summarized (which could include sensitive document content pasted by the user).

The fact that this is a library makes it worse: the attacker only needs to compromise the DNS or network path for a11y-widget.jerit.in once, and it affects every site using the widget simultaneously.


The Fix

What Changed

The fix is surgical and precise — two lines added to the fetch options in script.js:

Before (vulnerable):

formData.append('data', text)
const response = await fetch('https://a11y-widget.jerit.in/summarize', {
  method: 'POST',
  body: formData
});

After (fixed):

formData.append('data', text)
const response = await fetch('https://a11y-widget.jerit.in/summarize', {
  method: 'POST',
  mode: 'cors',
  credentials: 'omit',
  body: formData
});

Why Each Change Matters

mode: 'cors'
This explicitly tells the browser: "This is a cross-origin request, and it must comply with CORS protocol." If the server at a11y-widget.jerit.in does not return appropriate Access-Control-Allow-Origin headers, the browser will block the response entirely. This is the correct, defensive posture for any fetch to a third-party domain. It also makes developer intent explicit and auditable — future maintainers won't have to guess whether CORS was considered.

credentials: 'omit'
This is the more impactful of the two changes from a credential-safety perspective. It explicitly instructs the browser: do not send cookies, HTTP auth headers, or TLS client certificates with this request. Since the summarization endpoint is a third-party service that has no legitimate need for the user's session credentials, omitting them entirely eliminates the credential leakage attack surface. Even if an attacker successfully spoofs the endpoint, they receive no credentials.

Together, these two properties close the MITM credential-leakage vector and harden the widget's network behavior to the principle of least privilege.


Key Takeaways

  • fetch() to third-party domains in script.js must always include credentials: 'omit' — the external summarization endpoint at a11y-widget.jerit.in has no legitimate need for user session credentials.
  • Omitting mode: 'cors' is not "safe by default" — it leaves CORS enforcement implicit and inconsistent across environments; always declare it explicitly.
  • Library-level vulnerabilities have multiplied impact — a single insecure fetch in a distributed widget affects every downstream consumer, not just one application.
  • HTTPS alone does not prevent MITM credential leakage — transport encryption protects the channel, but browser-level credential controls protect what gets sent through that channel.
  • The fix required only 2 lines of code — but those 2 lines eliminate an entire class of credential-leakage attack for all users of this widget.

How Orbis AppSec Detected This

  • Source: Text content submitted by the user to the widget's summarization feature, triggering the fetch call at script.js:1152.
  • Sink: fetch('https://a11y-widget.jerit.in/summarize', { method: 'POST', body: formData }) in script.js at line 1152 — a cross-origin POST with no explicit CORS mode or credential controls.
  • Missing control: No mode: 'cors' to enforce cross-origin protocol compliance, and no credentials: 'omit' to prevent unintended forwarding of cookies or auth headers to the third-party domain.
  • CWE: CWE-346 — Origin Validation Error (failure to properly enforce cross-origin request restrictions).
  • Fix: Added mode: 'cors' and credentials: 'omit' to the fetch options object at script.js:1154–1155, enforcing strict browser-level CORS compliance and eliminating credential leakage to the external endpoint.

Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.


Conclusion

A two-line fix — mode: 'cors' and credentials: 'omit' — closes a meaningful attack window in this accessibility widget. The vulnerability illustrates a common pattern in JavaScript development: developers correctly choose HTTPS for transport security, but overlook the browser-level controls that govern what gets sent and under what cross-origin rules. For library authors especially, these defaults matter enormously because your network security decisions propagate to every application that depends on your code.

When writing fetch calls to external services, treat explicit CORS mode and credential control as non-negotiable defaults, not optional enhancements. Your users — and their users — are counting on it.


Prevention and further reading

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #8

Related Articles

high

MapManager.get() Race Condition Duplicates API Requests

The MapManager's `get(mapUid, cache)` method used a check-then-act pattern that permitted multiple concurrent requests to pass the cache miss check simultaneously, triggering redundant API calls and risking cache corruption. The fix introduces a `_pending` promise map to deduplicate in-flight fetches for identical map UIDs.

critical

Lampa Desktop Auto-Update Heuristic Bypass: Execution of Unverified

Lampa Desktop's auto-update mechanism downloaded JavaScript and CSS from `raw.githubusercontent.com` using only heuristic validation—file size thresholds and string pattern matching—that attackers could trivially satisfy. The fix introduces cryptographic integrity verification by cross-referencing Git blob hashes from the GitHub Contents API, ensuring downloaded code matches the repository's authoritative state before execution.

high

adm-zip 0.6.0 Preserves SUID Bits From ZIPs: CVE-2026-102282

The `adm-zip` dependency resolved to 0.6.0 in this project's dependency tree, a version affected by CVE-2026-102282: during extraction it applies the Unix permission bits stored in each ZIP entry's external file attributes verbatim, including the setuid (`04000`), setgid (`02000`), and sticky bits. An attacker who controls an archive passed to `extractAllTo()` or `extractEntryTo()` can therefore have the extractor create a setuid binary owned by whatever user the extraction process runs as. The

high

requestInput() Type Confusion: NaN and Object Bypass in JavaScript

The `requestInput()` utility function lacked validation on its `type` parameter and failed to handle `NaN` results from float conversions, creating a type confusion weakness. An attacker could supply malformed inputs that propagate unhandled `NaN` values or unexpected object types through the type system. The fix adds explicit guards against `NaN` type parameters and rejects non-primitive type values.

critical

No Rate Limit on /api/uploads/presign Enables DoS

The `/api/uploads/presign` endpoint accepted unlimited concurrent requests to generate storage presigned URLs, giving an attacker a free lever to exhaust storage-provider quotas and server resources. The fix adds an `express-rate-limit` middleware capping each client to 30 requests per minute on that route.

high

CVE-2026-54673: builder-util-runtime Leaks Auth Headers on Redirect

electron-updater and electron-builder rely on builder-util-runtime to fetch update manifests and artifacts over HTTP. A flaw in that shared HTTP executor allowed credential headers attached to the original update-feed request to be re-sent after a redirect, exposing them to any host the redirect pointed to. The project fixes this by upgrading builder-util-runtime to 9.7.0 and collapsing a duplicate, older copy of the package that electron-updater had pinned on its own.