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

Issue 246 fix - Unconditionally remove the hidden fields from incoming body in middlewares.js:handleParseHeaders #302

Closed
wants to merge 3 commits into from

Conversation

kunalg
Copy link

@kunalg kunalg commented Feb 8, 2016

When different instances of parse-server are fronted by a proxy (like haproxy), it may not be possible to modify the body - even if it can read and process the body and set some headers based on the info from body (these can, in turn, be used for forwarding decisions).

In case if the parse-server instance encounters such a situation, it should still remove the variables from the body after verifying that the hidden fields set in the headers and the body are actually matching.

AFAIK, only Parse-JS-SDK sends the app information in the body - all other SDKs send it correctly in the headers.

If the incoming request has app id specified both in the header AND
the JSON body, then check that both are the same.
Flag the request as invalid if they are not the same.

If the app id is not specified in the headers, then pick it up
from the JSON body.

Moreover, remove the app config keys (app id, master key, js key,
.net key etc.) from the request body unconditionally - ie. even if those
are specified in the header. This is so that if the proxy fronting the
app is not able these keys from the body.

Signed-off-by: Kunal Gangakhedkar <[email protected]>
De-indent the block after removing the if conditional for appid passed
in the header.

Signed-off-by: Kunal Gangakhedkar <[email protected]>
@gfosco
Copy link
Contributor

gfosco commented Feb 16, 2016

This is failing several tests.

@gfosco
Copy link
Contributor

gfosco commented Feb 19, 2016

If you get around to it, please fix and submit a new PR. Thanks.

@gfosco gfosco closed this Feb 19, 2016
@kunalg
Copy link
Author

kunalg commented Feb 21, 2016

Yes, stuck in some other high-priority work as of now :(

Will merge with latest repo, fix, test and send a new pull request when time permits.

thanks for taking a look at it.

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.

3 participants