Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the ActionDispatch::RemoteIp middleware #1720

Merged
merged 1 commit into from
Aug 3, 2020
Merged

Conversation

micahlee
Copy link
Contributor

What does this PR do?

  • What's changed? Why were these changes made?

This PR removes ActionDispatch::RemoteIP from the Conjur Rack middleware.This middleware
provides additional logic for selecting the client IP address in Conjur,
and stores the client IP in request.remote_ip. This can sometimes be different than
the client IP determined by Rack in request.ip.

We use request.ip for audit and CIDR restrictions. However, Rails uses request.remote_ip in the request log.

In order to make the request log match the audit log and network restrictions, we remove this middleware. This causes request.remote_ip to fallback to the value in request.ip.

  • How should the reviewer approach this PR, especially if manual tests are required?
  • Are there relevant screenshots you can add to the PR description?

What ticket does this PR close?

Connected to #1719

Checklists

Change log

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR, and/or there is a follow-on issue to update docs, or
  • This PR does not require updating any documentation

This middleware provides additional logic for selecting the client IP address in Conjur,
and stores the client IP in `request.remote_ip`. This can sometimes be different than
the client IP determined by Rack in `request.ip`.

We use `request.ip` for audit and CIDR restrictions. However, Rails uses `request.remote_ip` in the request log.

In order to make the request log match the audit log and network restrictions, we remove this middleware. This causes `request.remote_ip` to fallback to the value in `request.ip`.
@micahlee micahlee requested a review from a team as a code owner July 30, 2020 21:08
@micahlee micahlee requested a review from h-artzi July 30, 2020 21:14
@codeclimate
Copy link

codeclimate bot commented Jul 30, 2020

Code Climate has analyzed commit c4ff54c and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 86.2% (0.0% change).

View more on Code Climate.

@h-artzi
Copy link
Contributor

h-artzi commented Aug 3, 2020

LGTM!

@micahlee micahlee merged commit b4c4b27 into master Aug 3, 2020
@micahlee micahlee deleted the 1719-request-log-ip branch August 3, 2020 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants