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

namespace scoped web sockets #1419

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

hosie
Copy link
Contributor

@hosie hosie commented Oct 20, 2023

If I am running firefly behind an HTTP aware gateway, I can govern access to REST api for namespaces based on the HTTP path. However, for websockets, this is not possible. namespace isolation is much looser and requires analysis of query parameters and/or websocket message payloads.

This PR proposes a solution where a WebSocket connection can be opened on a namespace specific path (/api/v1/namespaces/{namespace}/ws) and the web socket plugin will only allow streams to be started for the given namespace.

This also means that namespace query parameter and namespace field of the start message become redundant. For compatibility reasons, the PR tolerates them but asserts that they must be equal to the namespace for which the connection was opened.

@hosie hosie requested a review from a team as a code owner October 20, 2023 12:46
@codecov-commenter
Copy link

Codecov Report

Merging #1419 (f6cbfe1) into main (13bf4e1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1419   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files         321      321           
  Lines       23027    23065   +38     
=======================================
+ Hits        23025    23063   +38     
  Misses          1        1           
  Partials        1        1           
Files Coverage Δ
internal/apiserver/server.go 100.00% <100.00%> (ø)
internal/events/websockets/websocket_connection.go 100.00% <100.00%> (ø)
internal/events/websockets/websockets.go 100.00% <100.00%> (ø)

Copy link
Contributor

@nguyer nguyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@nguyer nguyer merged commit f92b532 into hyperledger:main Oct 20, 2023
@nguyer nguyer deleted the websocket-namespaced branch October 20, 2023 17:37
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.

3 participants