ServerConfiguration should let admins configure CORS #2
Labels
fullstack
Requires modifying both backend (Rust) and frontend (Dart/TypeScript) code.
good first issue
Good for newcomers
help wanted
Extra attention is needed
rust
Issues to improve Jonline's Rust BE
Currently CORS headers are served with the absolute max permissiveness. Admins should be able to switch between Blocklist and Allowlist modes, choosing to block/allow sets of domains. Add these to
ServerConfiguration
models, and give the admin a simple UI in the Server Details Screen in Tamagui and/or the Server Configuration Page in Flutter.AC:
A new
optional boolean strict_cors
field should be added to theFederationInfo
of theServerConfiguration
inserver_configuration.proto
.Add a

<Switch ... />
named "Strict CORS" with a description of "Only permit Web access from Federated Servers. This has no effect on native apps." to the UI to toggle this on/off inServerDetailsScreen
's "Federation" section, below the list of federated servers:When that flag is turned on, create and pass a
CorsLayer
to Tonic (the gRPC server) based here, instead of justCorsLayer::permissive()
. It should only allow access to the gRPC APIs referenced by therepeated FederatedServer servers
inFederationInfo
.(Strech goal; could be done in a second "Secure Web and Media with CORS" task.) Configure Rocket (the HTTP web/media server component) to also send CORS headers based on the
FederationInfo
.The text was updated successfully, but these errors were encountered: