[fix][star-rating] bind the widget rating counters to the submitting app (24.05) - #7898
Open
ar2rsawseen wants to merge 1 commit into
Open
[fix][star-rating] bind the widget rating counters to the submitting app (24.05)#7898ar2rsawseen wants to merge 1 commit into
ar2rsawseen wants to merge 1 commit into
Conversation
The widget id arrives in the submitted event's segmentation, and the counter update selected the widget by that id alone, so ingestion for one app could move ratingsSum and ratingsCount on another app's widget. The feedback row was already written to the submitting app's own collection, so only the aggregate needed binding, and it now carries app_id like every other selector against this collection. This closes an app boundary rather than a capability. Anyone holding an app's public key can already submit ratings against that app's own widgets through the same path, which is what public ingestion is for, so the counters were always movable by whoever had the key. What was wrong is that a different app's key could move them. timesShown is left alone. /o/feedback/widget takes no app key and has no app context, and the widget id it is given already determines the app, so adding app_id to that selector would compare a value against itself. An unauthenticated caller incrementing an impression counter on a public widget endpoint is what the endpoint is for; changing that would mean requiring a key there and breaking SDK clients that do not send one.
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 widget rating counters were updated by widget id alone:
The widget id arrives in the submitted event's segmentation, so ingestion for one app could move
ratingsSumandratingsCounton a widget belonging to another. The feedback row itself was already written to the submitting app's own collection, so only the aggregate needed binding. It now carriesapp_idlike every other selector against this collection (lines 565, 726, 817, 1117), matching the sameparams.app_id + ""string convention.What this is and is not
It closes an app boundary rather than a capability. Anyone holding an app's public key can already submit ratings against that app's own widgets through this same path, which is what public ingestion is for, so those counters were always movable by whoever held the key. What was wrong is that a different app's key could move them, and that the resulting aggregate then had no feedback rows behind it in the affected app.
timesShown is deliberately unchanged
/o/feedback/widgettakes no app key and has no app context, and the widget id it receives already determines the app, so addingapp_idto that selector would compare a value against itself. An unauthenticated caller incrementing an impression counter on a public widget endpoint is what that endpoint is for. Changing it would mean requiring a key there and breaking SDK clients that do not send one.Related:
6331a78scoped the dashboard write routes (remove, edit, bulk-status) to the authorised app. This selector was outside that change's scope and is the same idea applied to the ingestion path.