dify - 💡(How to fix) Fix HIGH: CORS allows wildcard * origin — any website can make authenticated API requests

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The default CORS configuration includes a wildcard * origin, which means ANY website can make authenticated cross-origin requests to the Dify API and Console API. This is combined with session cookies that are sent with cross-origin requests.

Root Cause

The default CORS configuration includes a wildcard * origin, which means ANY website can make authenticated cross-origin requests to the Dify API and Console API. This is combined with session cookies that are sent with cross-origin requests.

Code Example

WEB_API_CORS_ALLOW_ORIGINS=http://localhost:3000,*
CONSOLE_CORS_ALLOW_ORIGINS=http://localhost:3000,*
RAW_BUFFERClick to expand / collapse

CWE-942: CORS Wildcard * Allows Any Origin to Access API

Severity: HIGH (CVSS 7.5)

Location

api/.env.example:

WEB_API_CORS_ALLOW_ORIGINS=http://localhost:3000,*
CONSOLE_CORS_ALLOW_ORIGINS=http://localhost:3000,*

Description

The default CORS configuration includes a wildcard * origin, which means ANY website can make authenticated cross-origin requests to the Dify API and Console API. This is combined with session cookies that are sent with cross-origin requests.

Impact

  • Session hijacking: A malicious website can make authenticated API calls using the victim's session cookie
  • Data exfiltration: Attacker can read workflow configurations, API keys, and dataset contents
  • CSRF attacks: Attacker can create/delete workflows, modify app configurations, change settings
  • Plugin abuse: Attacker can deploy plugins or modify model provider settings

Remediation

  1. Remove the * wildcard from default CORS origins
  2. Require users to explicitly set their frontend URL
  3. Add CSRF token protection for state-changing operations

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING