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
Published August 26, 2026Reviewed 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

critical

deleteNestedProperty Prototype Pollution via Dot-Notation Path

The `deleteNestedProperty` function in propertyUtils.ts allowed attackers to manipulate JavaScript object prototypes by passing specially crafted dot-notation paths like `__proto__.polluted`. A fix now blocks dangerous keys before processing, preventing prototype pollution attacks that could affect all objects in the application.

high

How Denial of Service via Infinite Loop Happens in JavaScript Dependencies and How to Fix It

CVE-2026-67213 is a high-severity denial of service vulnerability in nanoid before version 5.1.6 that triggers an infinite loop during random ID generation when processing specially crafted input. We upgraded nanoid across the entire dependency tree to patch this flaw and prevent attackers from freezing application threads. This fix ensures that ID generation remains resilient even when handling adversarial input patterns.

high

How Sensitive Data Exposure happens in Zotero plugins and how to fix it

A high-severity data exposure vulnerability in `Zotero.ts` automatically transmitted complete document metadata—including private notes, attachment paths, and tags—to external LLM services without user consent. The fix replaces broad `item.toJSON()` serialization with explicit field selection, sending only essential bibliographic data.

high

How missing dependency update cooldowns happen in GitHub Dependabot configurations and how to fix it

A semgrep scan flagged `.github/dependabot.yml` for lacking a cooldown period, meaning Dependabot would immediately propose updates to brand-new package versions across npm, Bundler, and Docker ecosystems. The fix adds a `cooldown: default-days: 7` block to every `package-ecosystem` entry, forcing a one-week waiting period before newly published releases are considered — reducing exposure to malicious or unstable package drops.

high

How Path Traversal Happens in TensorFlow's Data Service and How to Fix It

TensorFlow's data service dispatcher validated dataset IDs against forward-slash traversal attacks but overlooked backslash characters on non-Windows platforms, allowing attackers to escape the root directory. A targeted fix adds explicit backslash validation across all platforms, closing a high-severity path traversal vulnerability in the snapshot management system.

critical

How Unbounded WebSocket Message Handling Causes Resource Exhaustion in Node.js and How to Fix It

The WebSocketCrossServerAdapter class in a popular Node.js WebSocket library lacked any rate limiting on inbound messages, allowing attackers to flood Redis nodes and WebSocket servers with high-volume traffic. The fix introduces a configurable `rateLimit` option that caps messages per connection per second, preventing resource exhaustion while preserving legitimate functionality.