-
Notifications
You must be signed in to change notification settings - Fork 22
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
Google plus oauth and node js. Is there a flaw? Or am I Wrong? #8
Comments
You have to take into account that the only piece of user information that your server (or a malicious one) can get by default is the "sub" field, which is just the Google ID. Take a look at the example response here. Of course you can add the rest of scopes to get e-mail, name, picture and so on, but if your communications are secured with HTTPS (which really should) that shouldn't be an issue, and the user has to grant explicit approval for this information to be shared with you. The thing with Google ID tokens is that they can't be used to perform actions (Google API calls) from your backend on behalf of the user. In case you wanted that functionality you would in fact need some kind of client secret to authorize your backend, and that brings us to OAuth 2.0 or equivalent solutions that use full-featured tokens (such scenario is documented here). It's also worth mentioning that a malicious app can't simply show the acceptance page of your legitimate app on a user's device, since the Client IDs you generated are tied to your app's cert signature, as shown in the link you provide. Hope everything is clearer now, otherwise just let me know! |
Does that mean the id token is worthless without the client ID? I had a problem a few months ago, whereby my This has been working fine for me, except that I worry that the querystring is not a secure place to have sensitive data. Has anyone else had that problem (of having to use a querystring instead of POST data)? This is getting off topic, but if I'd been sending the JSON incorrectly, I'd like to know how it should be done. And maybe the docs could use a clarification. |
Hi Keith, sorry to hear that you're having trouble with this. After some testing I've confirmed that sending the token via POST with JSON body is working correctly. Keep in mind that you probably need to use some kind of middleware to parse the request body, such as body-parser. var bodyParser = require('body-parser');
app.use(bodyParser.json()); After adding this, Passport should be able to access body contents (you can use |
Oh! Maybe that was it. I do have To be honest, if the query string is secure, I'll just keep using that. Unless |
@keith24 The query string is not a secure means of communicating information that needs to remain secure. Over HTTPS request headers and body are secure but the URL is not. It must be sent in the clear for routing purposes (DNS etc.). However, I wouldn't put Google ID Token into category of things which need to remain secure. Take for example Google's own service for validating these tokens takes the token via a query string. There are a few risk mitigation factors of ID tokens to consider:
Even if someone did successfully decompile your app to get your client id then subsequently man-in-the-middle users so that they could see the request between their phone/computer and your servers, the only thing an ID token can be used to gather is that users profile details. While this is likely to be a privacy policy violation, which can be very serious for a business, the fact that an attacker was able to do all of this to begin with probably indicates some more serious breach. |
is fix yet ? ? |
I was doing a POC on oauth using Android and nodejs and I below are my observations:
Below are my doubts
I have also asked this question on SO. I felt its more appropriate to ask here as I am using this node package.
The text was updated successfully, but these errors were encountered: