Repository navigation
Replies: 1 comment
|
Short answer: no, and it can't be done in react-native-firebase itself. RNFB doesn't build these requests. On iOS and Android, On iOS you can see it in urlString = "\(apiProtocol)//\(apiHostAndPathPrefix)/identitytoolkit/v3/relyingparty/\(endpoint)?key=\(apiKey)"There's no setting for this. The only headers the backend adds are For the security review, these points are usually what settles it:
If this solves it, please mark it as the answer so others with the same problem can find it. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I've recently been tasked with finding a solution to a concern that's been raised with regards to password reset, and more broadly, how requests are transmitted to Google.
In the current flow, in order to request a password reset, we call
auth().sendPasswordResetEmail(), with the users email provided as the single argument.When doing some digging/proxying of requests, it's been noted that this makes a call to
/identitytoolkit/v3/relyingparty/getOobConfirmationCode, and passes thekeyquery parameter, with the value of that parameter being the API key for our project.There have been concerns raised by some parties that this represents a security vulnerability, and has been given a high risk rating from their perspective, stating that 'authentication tokens should not be passed via the URL#, and that this approach 'significantly increases the risk of token disclosure'.
I don't disagree with them on the point of minimizing surface area exposed, and using headers rather than query paramaters where possible. However, from my perspective, that API key isn't considered sensitive as it's shipped within our binary and it alone can't be used to obtain access to an account or any info in it (a JWT would still be needed), so I don't understand how they've come to the conclusion that this is a vulnerability that can be exploited.
However, I've still been asked to try and identify a way to resolve this - i.e. to have the key not be present in the URL, and instead to have it in the headers.
I came across the following: https://docs.cloud.google.com/docs/authentication/api-keys-use#using-with-rest
This suggests that instead of a
keyparameter, we could instead use anX-goog-api-keyheader. From a quick test (POST request to that URL via Insomnia), using the header and removing the key from the URL does work with Firebase too (as opposed to being limited to some unrelated Google Cloud service).I've dug down into the react-native-firebase code in our project (i.e. the one in node_modules, which is version 23.5.0), hoping that there might be a way for me to remove the query param and implement the header approach instead (and then use patch-package), but it looks like the functionality itself lives deep within the native code - something I'm not particularly well-versed in.
Can anyone identify if RN-FB already supports this header-based approach (e.g. a config option), or identify what changes would need to be made in order to support it?
Thanks
All reactions