Repository navigation
Refuse cross-origin writes in the bot dashboard proxy - #70
Merged
Merged
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage/vitest
View coverage of the 1 most impacted file.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.dehost 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()inlib/botDashboardProxy.tsnow runs before anything is forwarded:Originto be exactlyhttps://<BOT_DASHBOARD_HOST>.Originheader,Sec-Fetch-Site: same-originis 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 andnullare refused, the Sec-Fetch-Site fallback). Counter-check: accepting any origin turned the test red.typecheck,lintandnpm test(1508 passed) pass locally.