2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-10-03 17:21:20 +08:00

Revert "DEV: Debug cookie overflows" (#35120)

Reverts discourse/discourse#34639

We understood the main culprit for cookie overflows was storing
`destination_url` in the session, so we don’t really need that debug
code anymore.
This commit is contained in:
Loïc Guitaut 2025-10-02 09:55:47 +02:00 committed by GitHub
parent ebb1a49ea3
commit 5146a8e399
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 23 deletions

View file

@ -22,9 +22,6 @@ class ActionDispatch::Session::DiscourseCookieStore < ActionDispatch::Session::C
end
end
cookie_jar(request)[@key] = cookie
rescue ActionDispatch::Cookies::CookieOverflow
Rails.logger.error("Cookie overflow occurred for #{@key}: #{request.session.to_h.inspect}")
raise
end

def session_has_changed?(request, session)

View file

@ -13,24 +13,4 @@ describe ActionDispatch::Session::DiscourseCookieStore, type: :request do
expect(response.cookies["_forum_session"]).not_to be_present
expect(session[:_csrf_token]).to eq(csrf_token)
end

describe "Cookie overflow" do
context "when cookie size exceeds limit" do
let(:fake_logger) { FakeLogger.new }

before do
Rails.logger.broadcast_to(fake_logger)
allow_any_instance_of(ActionController::RequestForgeryProtection).to receive(
:generate_csrf_token,
).and_return(SecureRandom.urlsafe_base64(4097))
end

after { Rails.logger.stop_broadcasting_to(fake_logger) }

it "logs an error" do
get "/session/csrf.json"
expect(fake_logger.errors).to include(/Cookie overflow occurred.*"_csrf_token"=>/)
end
end
end
end