Skip to content

[CW-2587] Application not loading after setting RACK_ATTACK_LIMIT ENV variable #8014

Closed
@luizeof

Description

Describe the bug

When we configure the variable RACK_ATTACK_LIMIT in Docker's ENV, an exception is thrown. I believe env.fetch is loading the value as a string.

environment:
  - RACK_ATTACK_LIMIT=3000

Application log:

[192f9410-f8b9-4088-a532-a569c1046b34] ArgumentError (comparison of Integer with String failed):
I, [2023-09-28T19:34:58.224089 #16]  INFO -- : source=rack-timeout id=6f453de9-0015-4f6f-92d0-a6a7cb8ed149 timeout=15000ms service=4ms state=completed
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/thread_pool.rb:151:in `block in spawn_thread'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/runtime.rb:22:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/static.rb:23:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/ssl.rb:77:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/server.rb:443:in `process_client'
I, [2023-09-28T19:35:58.334121 #16]  INFO -- : source=rack-timeout id=192f9410-f8b9-4088-a532-a569c1046b34 timeout=15000ms service=4ms state=completed
[1] - Gracefully shutting down workers...
Exiting
[1] - Goodbye!
[1] === puma shutdown: 2023-09-28 19:36:02 +0000 ===
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/thread_pool.rb:151:in `block in spawn_thread'
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/server.rb:245:in `block in run'
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/request.rb:99:in `handle_request'
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/request.rb:100:in `block in handle_request'
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/thread_pool.rb:344:in `with_force_shutdown'
[192f9410-f8b9-4088-a532-a569c1046b34] puma (6.3.1) lib/puma/configuration.rb:270:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] railties (7.0.8) lib/rails/engine.rb:530:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-cors (2.0.1) lib/rack/cors.rb:102:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/method_override.rb:24:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/request_id.rb:26:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-timeout (0.6.3) lib/rack/timeout/core.rb:147:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-timeout (0.6.3) lib/rack/timeout/support/timeout.rb:19:in `timeout'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-timeout (0.6.3) lib/rack/timeout/core.rb:148:in `block in call'
[192f9410-f8b9-4088-a532-a569c1046b34] request_store (1.5.1) lib/request_store/middleware.rb:19:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] railties (7.0.8) lib/rails/rack/logger.rb:25:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `tagged'
[192f9410-f8b9-4088-a532-a569c1046b34] activesupport (7.0.8) lib/active_support/tagged_logging.rb:37:in `tagged'
[192f9410-f8b9-4088-a532-a569c1046b34] activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `block in tagged'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] railties (7.0.8) lib/rails/rack/logger.rb:25:in `block in call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] railties (7.0.8) lib/rails/rack/logger.rb:40:in `call_app'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] activesupport (7.0.8) lib/active_support/callbacks.rb:99:in `run_callbacks'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/cookies.rb:704:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] actionpack (7.0.8) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/etag.rb:27:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack (2.2.8) lib/rack/head.rb:12:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] warden (1.2.9) lib/warden/manager.rb:34:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] warden (1.2.9) lib/warden/manager.rb:34:in `catch'
[192f9410-f8b9-4088-a532-a569c1046b34] warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-attack (6.7.0) lib/rack/attack.rb:118:in `call'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-attack (6.7.0) lib/rack/attack/configuration.rb:90:in `throttled?'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-attack (6.7.0) lib/rack/attack/configuration.rb:90:in `any?'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-attack (6.7.0) lib/rack/attack/configuration.rb:91:in `block in throttled?'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-attack (6.7.0) lib/rack/attack/throttle.rb:41:in `matched_by?'
[192f9410-f8b9-4088-a532-a569c1046b34] rack-attack (6.7.0) lib/rack/attack/throttle.rb:41:in `>'
[192f9410-f8b9-4088-a532-a569c1046b34]   
I, [2023-09-28T19:35:58.330356 #16]  INFO -- : source=rack-timeout id=192f9410-f8b9-4088-a532-a569c1046b34 timeout=15000ms state=ready
F, [2023-09-28T19:35:58.333763 #16] FATAL -- : [192f9410-f8b9-4088-a532-a569c1046b34]   
I, [2023-09-28T19:35:58.330912 #16]  INFO -- : [192f9410-f8b9-4088-a532-a569c1046b34] Started GET "/cable" for 177.193.231.175 at 2023-09-28 19:35:58 +0000
[de15b157-99ed-492d-8000-2da82c02f44d] puma (6.3.1) lib/puma/thread_pool.rb:151:in `block in spawn_thread'
I, [2023-09-28T19:33:58.223724 #16]  INFO -- : source=rack-timeout id=de15b157-99ed-492d-8000-2da82c02f44d timeout=15000ms service=4ms state=completed
I, [2023-09-28T19:34:58.220106 #16]  INFO -- : source=rack-timeout id=6f453de9-0015-4f6f-92d0-a6a7cb8ed149 timeout=15000ms state=ready
I, [2023-09-28T19:34:58.220800 #16]  INFO -- : [6f453de9-0015-4f6f-92d0-a6a7cb8ed149] Started GET "/cable" for 177.193.231.175 at 2023-09-28 19:34:58 +0000
F, [2023-09-28T19:34:58.223575 #16] FATAL -- : [6f453de9-0015-4f6f-92d0-a6a7cb8ed149]   
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149]   
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] ArgumentError (comparison of Integer with String failed):
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-attack (6.7.0) lib/rack/attack/throttle.rb:41:in `>'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-attack (6.7.0) lib/rack/attack/throttle.rb:41:in `matched_by?'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-attack (6.7.0) lib/rack/attack/configuration.rb:91:in `block in throttled?'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-attack (6.7.0) lib/rack/attack/configuration.rb:90:in `throttled?'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-attack (6.7.0) lib/rack/attack/configuration.rb:90:in `any?'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-attack (6.7.0) lib/rack/attack.rb:118:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] warden (1.2.9) lib/warden/manager.rb:34:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/etag.rb:27:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] activesupport (7.0.8) lib/active_support/callbacks.rb:99:in `run_callbacks'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/cookies.rb:704:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/head.rb:12:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] warden (1.2.9) lib/warden/manager.rb:34:in `catch'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/request_id.rb:26:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-timeout (0.6.3) lib/rack/timeout/core.rb:147:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-timeout (0.6.3) lib/rack/timeout/core.rb:148:in `block in call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] railties (7.0.8) lib/rails/rack/logger.rb:25:in `block in call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] railties (7.0.8) lib/rails/rack/logger.rb:40:in `call_app'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] activesupport (7.0.8) lib/active_support/tagged_logging.rb:37:in `tagged'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] railties (7.0.8) lib/rails/rack/logger.rb:25:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `tagged'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `block in tagged'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-timeout (0.6.3) lib/rack/timeout/support/timeout.rb:19:in `timeout'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] request_store (1.5.1) lib/request_store/middleware.rb:19:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/server.rb:245:in `block in run'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/server.rb:443:in `process_client'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/request.rb:99:in `handle_request'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/thread_pool.rb:344:in `with_force_shutdown'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/request.rb:100:in `block in handle_request'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] puma (6.3.1) lib/puma/configuration.rb:270:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] railties (7.0.8) lib/rails/engine.rb:530:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack-cors (2.0.1) lib/rack/cors.rb:102:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/ssl.rb:77:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/static.rb:23:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/runtime.rb:22:in `call'
[6f453de9-0015-4f6f-92d0-a6a7cb8ed149] rack (2.2.8) lib/rack/method_override.rb:24:in `call'

To Reproduce

Just configure the variable RACK_ATTACK_LIMIT=3000 in the Docker Stack and the error occurs when loading the application.

Expected behavior

No response

Environment

Docker

Cloud Provider

Other [please specify in the description]

Platform

Browser

Operating system

Debian 12

Browser and version

No response

Docker (if applicable)

Docker Swarm 24.0.6

Additional context

No response

CW-2587

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions