mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 11:25:24 +00:00
Revert "FEATURE: Protect against replay attacks when using TLS 1.3 0-RTT (#8020)"
This reverts commit 39c31a3d7693fae488461079c6f0c2bc7305c02e. Sorry about this, we have decided againse supporting 0-RTT directly in core, this can be supported with similar hacks to this commit in a plugin. That said, we recommend against using a 0-RTT proxy for the Discourse app due to inherit risk of replay attacks.
This commit is contained in:
parent
bf05a8da96
commit
8cea78c833
@ -214,9 +214,6 @@ module Discourse
|
||||
config.middleware.delete Rack::ETag
|
||||
|
||||
unless Rails.env.development?
|
||||
require 'middleware/early_data_check'
|
||||
config.middleware.insert_after Rack::MethodOverride, Middleware::EarlyDataCheck
|
||||
|
||||
require 'middleware/enforce_hostname'
|
||||
config.middleware.insert_after Rack::MethodOverride, Middleware::EnforceHostname
|
||||
end
|
||||
|
@ -1,27 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Middleware
|
||||
class EarlyDataCheck
|
||||
def initialize(app, settings = nil)
|
||||
@app = app
|
||||
end
|
||||
|
||||
# When a new connection happens, and it uses TLS 1.3 0-RTT
|
||||
# the reverse proxy will set the header `Early-Data` to 1.
|
||||
# Due to 0-RTT susceptibility to Replay Attacks only GET
|
||||
# requests for anonymous users are allowed.
|
||||
# Reference: https://tools.ietf.org/html/rfc8446#appendix-E.5
|
||||
def call(env)
|
||||
if env['HTTP_EARLY_DATA'].to_s == '1' &&
|
||||
(env['REQUEST_METHOD'] != 'GET' || CurrentUser.has_auth_cookie?(env))
|
||||
[
|
||||
425,
|
||||
{ 'Content-Type' => 'text/html', 'Content-Length' => '9' },
|
||||
['Too Early']
|
||||
]
|
||||
else
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user