-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: x-forwarded-proto is sanitized now #61
Conversation
src/index.ts
Outdated
@@ -30,6 +32,8 @@ export function createIPXHandler ({ | |||
} | |||
const handler: Handler = async (event, _context) => { | |||
const host = event.headers.host | |||
event.headers['x-forwarded-proto'] = X_FORWARDED_PROTO_VALUES.includes(event.headers['x-forwarded-proto'].toLowerCase()) ? event.headers['x-forwarded-proto'] : 'http' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we only allow the allowed values for x-forwarded-proto
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
src/index.ts
Outdated
@@ -30,7 +30,7 @@ export function createIPXHandler ({ | |||
} | |||
const handler: Handler = async (event, _context) => { | |||
const host = event.headers.host | |||
const protocol = event.headers['x-forwarded-proto'] || 'http' | |||
const protocol = event.headers['x-nf-connection-proto'] || 'http' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mraerino mentioned this as a better option as it can't be tampered with.
This reverts commit abfbff4.
Co-authored-by: Marcus Weiner <marcus.weiner@gmail.com>
3cc3032
to
16c154e
Compare
Description
Fixes an issue where someone can inject a non-standard value in the
x-forwarded-proto
header.Related Issues and Documents
/~https://github.com/netlify/pod-ecosystem-frameworks/issues/208