Comments (3)
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.
This is known and warning has been put in the docs:
I think we should create a new function called
ClientIP()
to get the client IP address from these headers. TheRemoteAddr()
can only get it fromhttp.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.
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)
- middleware: add support for request rate limiting
- router: support using `http.MethodGet`, `http.MethodPost` to replace "GET,POST" in `f.Routes` HOT 3
- cors: doesn't check the port of URL while parsing `Access-Control-Allow-Origin` HOT 1
- Returning a byte slice with an error outputs an empty HTTP body HOT 4
- template: mysterious error "failed to write out rendered HTML: short write"
- does flamego need to limit of uniqueness of injector.Map and injector.MapTo ? HOT 1
- docs: add documentation for SSE middleware
- context: support setting default value for `Query` methods
- validator: make examples to work with i18n HOT 2
- router: type-safe helpers for multiplex routes
- router: type-safe helpers for multiplex routes HOT 1
- router: add support for `HeadersRegexp` HOT 2
- Incorrect handling of non-CORS requests
- session: panic when context is cancelled
- Bump go version to 1.19 HOT 1
- Encountered a GOB error when using Session and CSRF at the same time HOT 3
- binding: Improve validation rule error message
- binding: support binding query
- Binding nested structs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flamego.