Skip to content

[core] Backport #8293 to LTS: refuse internal plugin events requested as URL paths - #8303

Closed
davidecavaliere wants to merge 3 commits into
release-ltsfrom
backport/8293-release-lts
Closed

davidecavaliere wants to merge 3 commits into
release-ltsfrom
backport/8293-release-lts

Conversation

@davidecavaliere

Copy link
Copy Markdown
Contributor

Backport of #8293 to release-lts.

A request whose path names an internal plugin event (e.g. /o/method/total_users, /i/user_merge) was dispatched to that event's hooks through requestProcessor's fall-through. The hooks ran without their data, threw, the request was never answered, and the unhandled rejection was reported as a crash. Such paths, and any path outside /i and /o, now answer 400 Invalid path.

Seen on a 25.03.52-LTS instance as four crash groups (Cannot set properties of undefined (setting 'browser' | 'densities' | 'languages' | 'sources')). The latest LTS tag, 25.03.57-LTS, does not contain the fix.

Cherry-picked with -x: 23ad626, 3a9d0b4, d865ec9. The one conflict was context only (hasDbExportAccess, which is not on release-lts) and was dropped; the change to requestProcessor.js is line-for-line the one on master.

Tests: test/2.api/25.internal.event.paths.js comes with it and runs in CI.

🤖 Generated with Claude Code

widatama and others added 3 commits November 29, 2026 14:24
requestProcessor dispatches unknown request paths to plugins by name. Plugin
events that core or plugins fire themselves, with their own data, could be
requested as URL paths (no credentials needed): /i/device_id, /i/user_merge,
/o/method/total_users, /i/event/delete, /i/events and /o/validate under /i and
/o, and every event outside them (/master, /sdk/user_properties,
/session/begin, /systemlogs, ...) where the API port is reachable directly.
Their hooks ran without that data, threw or returned a value, the dispatch
counted as handled, and the request was never answered, each hook logging an
unhandled rejection.

All 18 request-path dispatches in requestProcessor now go through
dispatchRequestPath, which refuses names outside /i and /o (request routes
live only there) and the internal events listed in INTERNAL_EVENTS, so these
requests answer 400 Invalid path without running any hook. Core's own
dispatches of these events are unchanged, and no plugin changes.

Adds test/2.api/25.internal.event.paths.js: each listed path and
/sdk/user_properties, bare and with request parameters, answers 400 Invalid
path, and the locale plugin's /o/langmap route still answers through the same
fall-through dispatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 23ad626)
The /i/events route answered unknown sub-paths with "must be one of /all or
/me", copied from another route. It now names its own sub-paths:
change_visibility, delete_events, edit_map and whitelist_segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3a9d0b4)
The tests request through the proxy, which sends only /i and /o to the API, so
/sdk/user_properties is answered 404 by the frontend before it reaches the
API (core CI: expected 400, got 404). requestProcessor's refusal of names
outside /i and /o protects API ports exposed without the proxy; it is checked
by a local run against the API port, not by these tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d865ec9)
@davidecavaliere

Copy link
Copy Markdown
Contributor Author

Not needed: #8293 ships in 25.03.60, and the LTS line has been merged into the regular 25.03.x branch with no further LTS tags.

@davidecavaliere
davidecavaliere deleted the backport/8293-release-lts branch November 30, 2026 10:47
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.

2 participants