Repository navigation
[core] Backport #8293 to LTS: refuse internal plugin events requested as URL paths - #8303
Closed
davidecavaliere wants to merge 3 commits into
Closed
davidecavaliere wants to merge 3 commits into
davidecavaliere wants to merge 3 commits into
Conversation
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)
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. |
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.
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 throughrequestProcessor'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/iand/o, now answer400 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 onrelease-lts) and was dropped; the change torequestProcessor.jsis line-for-line the one on master.Tests:
test/2.api/25.internal.event.paths.jscomes with it and runs in CI.🤖 Generated with Claude Code