feat(web-server): add frame guard, CORS-friendly client headers, and websocket payload fixes#170
Open
edusperoni wants to merge 1 commit into
Open
feat(web-server): add frame guard, CORS-friendly client headers, and websocket payload fixes#170edusperoni wants to merge 1 commit into
edusperoni wants to merge 1 commit into
Conversation
8122c64 to
063374f
Compare
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.
Summary
Adds origin/header introspection for WebSocket clients, an optional anti-embedding
("frame guard") mode for the static server, and fixes the
max_payloadoption thatwas previously dead code. Also exports
ServerStatusfromcommonin the platformentry points.
Changes
WebSocket client headers (
origin+header(name))Client.origingetter andClient.header(name)method (case-insensitive)exposed on both iOS and Android, backed by a new
webserver_websocket_client_headerFFI /clientHeaderJNI binding.Origin) instead of the response headers — previously only the CSP header weappended was surfaced, so
Originwas never available. The remote peer is alsostashed under a synthetic
x-peer-addrkey for loopback/same-origin checks.Origin, so callers can use it toallowlist connections from a known served origin.
Frame guard (anti-embedding) option
frameGuardconfig flag onServer. When enabled, every served responsecarries
X-Frame-Options: DENYand CSPframe-ancestors 'self', preventing thecontent from being iframed by a third-party page.
(
CStaticServiceOptions.frame_guard), and the JNI/FFI layers.max_payloadfixmax_payloadwas being ignored. Now applied to bothmax_frame_size(codec per-frame limit, defaulted to 64KB and silently droppedlarger frames) and
max_continuation_size(was hardcoded to 8MB). Both fall backto 100MB.
Misc
ServerStatusfromcommonin the Android and iOS entry points.ios-arm64+ios-arm64-simulator) and Androidprebuilt
.so/.aarartifacts.Platforms
iOS and Android.