Skip to content

fix: Validate fetch-apify-docs URL by hostname, not prefix#781

Merged
MQ37 merged 1 commit intomasterfrom
claude/fix-security-vulnerability-vh7HM
May 2, 2026
Merged

fix: Validate fetch-apify-docs URL by hostname, not prefix#781
MQ37 merged 1 commit intomasterfrom
claude/fix-security-vulnerability-vh7HM

Conversation

@MQ37
Copy link
Copy Markdown
Contributor

@MQ37 MQ37 commented May 1, 2026

GHSA-jwp7-wg77-3w9v: url.startsWith(domain) against allowlist entries
like https://docs.apify.com is bypassable by URLs such as
https://docs.apify.com.evil.com/, https://docs.apify.com@evil.com/,
or https://docs.apify.com.evil.com:8080/. The bypass lets the tool
fetch attacker-controlled HTML and return it to the LLM, enabling
prompt injection.

Replace the prefix check with a parsed-URL comparison: derive allowed
hostnames from ALLOWED_DOC_DOMAINS once at module load and require
new URL(url) to have protocol === 'https:' and a hostname in that
set. Add unit coverage for the bypass cases and other rejections.

Fixes https://github.com/apify/apify-mcp-server/security/advisories/GHSA-jwp7-wg77-3w9v

GHSA-jwp7-wg77-3w9v: `url.startsWith(domain)` against allowlist entries
like `https://docs.apify.com` is bypassable by URLs such as
`https://docs.apify.com.evil.com/`, `https://docs.apify.com@evil.com/`,
or `https://docs.apify.com.evil.com:8080/`. The bypass lets the tool
fetch attacker-controlled HTML and return it to the LLM, enabling
prompt injection.

Replace the prefix check with a parsed-URL comparison: derive allowed
hostnames from `ALLOWED_DOC_DOMAINS` once at module load and require
`new URL(url)` to have `protocol === 'https:'` and a hostname in that
set. Add unit coverage for the bypass cases and other rejections.
@github-actions github-actions Bot added t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics. labels May 1, 2026
@MQ37 MQ37 requested a review from jirispilka May 1, 2026 20:46
Copy link
Copy Markdown
Collaborator

@jirispilka jirispilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 💪🏻

@MQ37 MQ37 merged commit e39bdee into master May 2, 2026
9 checks passed
@MQ37 MQ37 deleted the claude/fix-security-vulnerability-vh7HM branch May 2, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants