Repository navigation
Conversation
POST /api/broadcast/:topic/events/:event treated any private value other than the exact string "true" as false, so private=True, which Python's requests sends for True, published the message on the public topic. Parse private with FlexibleBoolean, the type the channel join uses for config.private, and answer 422 for any other value.
This branch has not been deployed
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.
Why
POST /api/broadcast/:topic/events/:eventread everyprivatevalue except the exact stringtrueas false. So?private=True, which Python'srequestssends forTrue, published the message on the public topic with a 202. Subscribers of the private channel never got it, and the RLS write check never ran. This readsprivatethe way a channel join readsconfig.private.What changed
privateis parsed withFlexibleBoolean, sotrueandfalseare accepted in any case.private=1, answers 422 withprivate must be true or false.privatesays so.Scope
privatequery parameter of the single broadcast endpoint.persistas is.persist=Truealready answers 422.privatefrom the JSON body with Ecto's:booleancast, which already rejects"True".Blast Radius
A request with a non-boolean
private, including an emptyprivate=, now gets 422 instead of a public broadcast. Those callers were not getting what they asked for. Requests that sendtrue,falseor noprivatebehave as before.Verification
broadcast_single_controller_test.exs:private=Truefrom a caller without a write policy answers 403 and nothing reaches the public topic, andprivate=1answers 422. On the test commit without the fix both fail, and the trace shows the public branch ofSingleBroadcast.broadcast/7(single_broadcast.ex:97). With the fix the file passes 41 of 41.GenCounterstubbed answers 202 and the public subscriber receives the message.broadcast_request_outcome_test.exs,single_broadcast_test.exs,broadcast_controller_test.exsandrequest_metrics_test.exspass 109 of 109.mix format --check-formattedpasses andmix credo --strictreports nothing new on the changed files. Runs used Elixir 1.20.4 and OTP 29 against local PostgreSQL 17, not CI's Elixir 1.19.5 and OTP 28.Fixes #2513