motiv-labs / janus

An API Gateway written in Go
https://hellofresh.gitbooks.io/janus
MIT License
2.77k stars 319 forks source link

Log correct IP in ratelimiter if we trust forward headers #405

Closed Seklfreak closed 4 years ago

Seklfreak commented 4 years ago

What does this PR do?

For the Ratelimit plugin:

When we trust the forwarding headers, we still log the actual source IP address when a ratelimit is triggered.

This PR makes sure we log the correct IP address.

s4nji commented 4 years ago

+1

Approved with Zappr Approved with Zappr

codecov[bot] commented 4 years ago

Codecov Report

Merging #405 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #405   +/-   ##
=======================================
  Coverage   40.27%   40.27%           
=======================================
  Files          75       75           
  Lines        2642     2642           
=======================================
  Hits         1064     1064           
  Misses       1516     1516           
  Partials       62       62
Impacted Files Coverage Δ
pkg/plugin/rate/rate_limit_logger.go 56% <100%> (ø) :arrow_up:
pkg/plugin/rate/setup.go 51.92% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f37b43b...a1c0e2b. Read the comment docs.

codecov[bot] commented 4 years ago

Codecov Report

Merging #405 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #405   +/-   ##
=======================================
  Coverage   40.27%   40.27%           
=======================================
  Files          75       75           
  Lines        2642     2642           
=======================================
  Hits         1064     1064           
  Misses       1516     1516           
  Partials       62       62
Impacted Files Coverage Δ
pkg/plugin/rate/rate_limit_logger.go 56% <100%> (ø) :arrow_up:
pkg/plugin/rate/setup.go 51.92% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f37b43b...f9bb3b4. Read the comment docs.

ozairasim commented 4 years ago

👍

Approved with Zappr Approved with Zappr

0sc commented 4 years ago

⚡️

Approved with Zappr Approved with Zappr

jvalecillos commented 4 years ago

:+1:

Approved with Zappr Approved with Zappr Approved with Zappr

jvalecillos commented 4 years ago

:+1:

Approved with Zappr Approved with Zappr Approved with Zappr

Seklfreak commented 4 years ago

@vgarvardt added a note to Unreleased in the changelog 👍

vgarvardt commented 4 years ago

👍

Approved with Zappr Approved with Zappr Approved with Zappr