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

Add some security checks when handling a websocket connection. #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jgraham
Copy link
Member

@jgraham jgraham commented Dec 3, 2021

Check the Host and Origin headers for the incoming connection to
verify the connection is allowed.

The language is intended to allow the specific behaviour to be largely
implementation defined, whilst recommending a default
behaviour that prevents CSRF-type attacks (reject host headers that
aren't an IP address or the server hostname, reject any requests with
an origin header).

Hopefully adding this text will ensure that implementations consider
the security issues accepting a connection, even though it's not
possible to give precise requirements that apply to all
implementations.


💥 Error: 400 Bad Request 💥

PR Preview failed to build. (Last tried on Dec 3, 2021, 2:42 PM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

🚨 CSS Spec Preprocessor - CSS Spec Preprocessor is the web service used to build Bikeshed specs.

🔗 Related URL

Error running preprocessor, returned code: 2.
WARNING: The following <var>s were only used once in the document:
  'child nodes', in algorithm 'serialize as a remote value'
  'call evaluation status', in algorithm 'remote end steps for session.new'
If these are not typos, please add an ignore='' attribute to the <var>.
FATAL ERROR: Obsolete biblio ref: [rfc5735] is replaced by [rfc6890]. Either update the reference, or use [rfc5735 obsolete] if this is an intentionally-obsolete reference.
 ✘  Did not generate, due to fatal errors

If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

Check the Host and Origin headers for the incoming connection to
verify the connection is allowed.

The language is intended to allow the specific behaviour to be largely
implementation defined, whilst recommending a default
behaviour that prevents CSRF-type attacks (reject host headers that
aren't an IP address or the server hostname, reject any requests with
an origin header).

Hopefully adding this text will ensure that implementations consider
the security issues accepting a connection, even though it's not
possible to give precise requirements that apply to all
implementations.
@jgraham
Copy link
Member Author

jgraham commented Dec 3, 2021

I made an equivalent HTTP PR at w3c/webdriver#1634 I think that one might have better wording, but I'll leave this as is until one or the other is reviewed to see what people prefer.

@whimboo
Copy link
Contributor

whimboo commented Dec 3, 2021

CC @sadym-chromium, @bwalderman

Comment on lines +574 to +578
Note: rejecting connections with unexpected values in the Host header
prevents DNS rebinding attacks. Implementations can opt to provide more
stringent controls where appropriate, for example only accepting connections
when the |host| value corresponds to a loopback interface [[!RFC5735]].

Copy link
Contributor

@sadym-chromium sadym-chromium Dec 6, 2021

Choose a reason for hiding this comment

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

I'd add a note about the Docker edge case here as well: w3c/webdriver#1634 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-discussion Issues to be discussed by the working group
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants