Giter VIP home page Giter VIP logo

Comments (3)

wuhan005 avatar wuhan005 commented on June 14, 2024 1

I agree with you, users can implement the ClientIP() method in their custom context.

Maybe we can make a more clear warning message to point out there is a potential security issue. The current warning only shows proxy or VPN can fake the IP address, but the attacker can simply change the request header to do so as well.

from flamego.

unknwon avatar unknwon commented on June 14, 2024

This is known and warning has been put in the docs:

CleanShot 2022-04-04 at 14 58 50@2x

I think we should create a new function called ClientIP() to get the client IP address from these headers. The RemoteAddr() can only get it from http.Request.RemoteAddr.

If the user just want the http.Request.RemoteAddr, then they can just call this exact method/field.

Meanwhile, I think if the user wants custom logic, they can just wrap the flamego.Context and implement/override their own version of this method.

Moreover, the Flame instance should allow the developers to set the trusted remote IP headers and the trusted proxies if they want to get the client IP from user-provided headers.

We can provide examples, but I don't think it is worth to complicate the core framework. WDYT?

from flamego.

unknwon avatar unknwon commented on June 14, 2024

Maybe we can make a more clear warning message to point out there is a potential security issue. The current warning only shows proxy or VPN can fake the IP address, but the attacker can simply change the request header to do so as well.

Sounds good, feel free to send PRs to docs repos.

from flamego.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.