Skip to content

Commit

Permalink
Use request.ip in sent_from_docker_host? (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextwoods authored Oct 13, 2022
1 parent 9a9dbe7 commit 17028d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Use `request.ip` in `sent_from_docker_host?`.

3.6.3 (2022-09-06)
------------------

Expand Down
4 changes: 2 additions & 2 deletions lib/aws/rails/middleware/ebs_sqs_active_job_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def call(env)

# Only accept requests from this user agent if it is from localhost or a docker host in case of forgery.
unless request.local? || sent_from_docker_host?(request)
@logger.warn("SQSD request detected from untrusted address #{request.remote_ip}; returning 403 forbidden.")
@logger.warn("SQSD request detected from untrusted address #{request.ip}; returning 403 forbidden.")
return FORBIDDEN_RESPONSE
end

Expand Down Expand Up @@ -81,7 +81,7 @@ def periodic_task?(request)
end

def sent_from_docker_host?(request)
app_runs_in_docker_container? && request.remote_ip == '172.17.0.1'
app_runs_in_docker_container? && request.ip == '172.17.0.1'
end

def app_runs_in_docker_container?
Expand Down

0 comments on commit 17028d7

Please sign in to comment.