Skip to content

Refuse cross-origin writes in the bot dashboard proxy - #70

Merged
Musiker15 merged 1 commit into
mainfrom
fix/botproxy-origin-check
Nov 5, 2026
Merged

Musiker15 merged 1 commit into
mainfrom
fix/botproxy-origin-check

Conversation

@Musiker15

Copy link
Copy Markdown
Member

The hosted ticket bot dashboards trust this proxy and skip their own origin and CSRF checks for proxied requests. The proxy itself did not check the origin either. The session cookie is SameSite=Lax, and every *.msk-scripts.de host counts as the same site, so a form on another subdomain could send a POST without a body (for example /api/bot/stop) with a logged-in customer's session.

isAllowedProxyOrigin() in lib/botDashboardProxy.ts now runs before anything is forwarded:

  • GET, HEAD and OPTIONS pass as before.
  • Any other method needs Origin to be exactly https://<BOT_DASHBOARD_HOST>.
  • Without an Origin header, Sec-Fetch-Site: same-origin is accepted; with neither the request is refused.

A refused request gets a 403 and never reaches the bot. The dashboard's own requests are same-origin fetches and carry the right Origin, so nothing changes for them.

Tests: tests/botProxyOrigin.test.ts (reads pass, own origin passes, another subdomain, another site, http, a lookalike host and null are refused, the Sec-Fetch-Site fallback). Counter-check: accepting any origin turned the test red. typecheck, lint and npm test (1508 passed) pass locally.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage/vitest

main 6f344a8 fix/botproxy-origin-... de12712 +/-
73% 73% 0%
View coverage of the 1 most impacted file.
File main 6f344a8 fix/botproxy-origin-... de12712 +/-
lib/botDashboardProxy.ts 33% 41% +8%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@graphify-labs

graphify-labs Bot commented Nov 5, 2026

Copy link
Copy Markdown

Graphify reviews are paused for this workspace because nobody has used it in 7 days. A workspace owner can resume reviews from the Repositories page: https://app.graphify.com/msk-scripts/repositories

@Musiker15
Musiker15 merged commit 77c4768 into main Nov 5, 2026
11 checks passed
@Musiker15
Musiker15 deleted the fix/botproxy-origin-check branch November 5, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant