From 3f95c1446e9ed8e9eb6562ca4cf3b6519fa454ba Mon Sep 17 00:00:00 2001 From: Louis Lambeau Date: Thu, 13 Jun 2024 12:25:16 +0200 Subject: [PATCH] Configurable rack query parser key space limit. --- CHANGELOG.md | 4 ++++ README.md | 2 ++ lib/talktome/app.rb | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02aa427..be6ff18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.1 - 2024-06-13 + +* Rack parser's max key space limit is now configurable through the RACK_KEY_SPACE_LIMIT env variable + ## 2.3.0 - 2024-06-06 * Sinatra >= 3.2 must be used. diff --git a/README.md b/README.md index 2815049..eb88602 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,8 @@ TALKTOME_SMTP_STARTTLS_AUTO true or false (see ruby Mail library) TALKTOME_SMTP_OPENSSL_VERIFY_MODE none or peer (see ruby Mail library). Defaults to peer. TALKTOME_BEARER_SECRET secret for the webapi, to let send emails to anyone + +RACK_KEY_SPACE_LIMIT configures the max key space limit for the rack query parser ``` ## Hacking Talktome diff --git a/lib/talktome/app.rb b/lib/talktome/app.rb index 42f789b..268cff0 100644 --- a/lib/talktome/app.rb +++ b/lib/talktome/app.rb @@ -11,6 +11,12 @@ class App < Sinatra::Application g.body{ "An error occured." } end + if key_space_limit = Talktome.env('RACK_KEY_SPACE_LIMIT') + if Rack::Utils.respond_to?("key_space_limit=") + Rack::Utils.key_space_limit = key_space_limit.to_i + end + end + set :raise_errors, true set :show_exceptions, false set :talktome, Talktome::Client::Local.new(ROOT_FOLDER/'templates')