Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPB-14912] Limit the consume events endpoint to v8 #4368

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion integration/test/Test/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,15 @@ createEventsWebSocket user cid = do
eventsChan <- liftIO newChan
ackChan <- liftIO newEmptyMVar
serviceMap <- lift $ getServiceMap =<< objDomain user
apiVersion <- lift $ getAPIVersionFor $ objDomain user
let minAPIVersion = 8
lift
. when (apiVersion < minAPIVersion)
$ assertFailure ("Events websocket can only be created when APIVersion is at least " <> show minAPIVersion)

uid <- lift $ objId =<< objQidObject user
let HostPort caHost caPort = serviceHostPort serviceMap Cannon
path = "/events?client=" <> cid
path = "/v" <> show apiVersion <> "/events?client=" <> cid
caHdrs = [(fromString "Z-User", toByteString' uid)]
app conn =
race_
Expand Down
3 changes: 2 additions & 1 deletion libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Servant
import Wire.API.Routes.API
import Wire.API.Routes.Named
import Wire.API.Routes.Public (ZConn, ZUser)
import Wire.API.Routes.Version
import Wire.API.Routes.WebSocket

type CannonAPI =
Expand All @@ -46,7 +47,7 @@ type CannonAPI =
"consume-events"
( Summary "Consume events over a websocket connection"
:> Description "This is the rabbitMQ-based variant of \"await-notifications\""
-- :> From 'V8 -- cannon is not versioned yet
:> From 'V8
:> "events"
:> ZUser
:> QueryParam'
Expand Down
Loading