When an application uses the Drive Realtime API in conjunction with a user's file stored in Drive, it gets access to the realtime collaborative model which is associated with that file. It has been documented in both the official reference material [1] and in a previous answer here on StackOverflow [2] that when two different applications [3] use the Realtime API with the same Drive file, they will be accessing different collaborative models.
Let's assume that I have a server-side application with a client_secret
and the user's OAuth refresh_token
stored on a server that only I can access, and that the user's access_token
only leaves that server when making direct calls (over HTTPS) to various Google APIs. Consider the case where my application has used the realtime.get
and realtime.update
methods of the Drive API to keep some sensitive data in the collaborative model of the user's Drive file, such as an encryption key or a long-lived OAuth refresh_token
for a third-party service.
Is this sensitive data safe from disclosure to another application, even when that application also uses the Realtime API on the same file?
I don't think any other application could impersonate my application, since they wouldn't have access to my client_secret
and wouldn't have a chance to intercept either the refresh_token
or the user's access_token
that is associated with my app.
Bonus question: Can the user bypass my application and gain access to this sensitive data?
I can't see a way for the user to impersonate my application. The user can use my application's public client_id
and grant himself permission through the normal OAuth flow, but would have no way to exchange the resultant code
for a valid access_token
without knowing the client_secret
.
- "Models are isolated by application. If a user opens the same file with two different collaborative apps, separate documents are created." Using Collaborative Models with Existing File Types
- "When you create a doc in the realtime playground, it is owned by the realtime playground app. When you try to then
get
the response in thetry-it
feature, it uses an app specific totry-it
which can't see the realtime model you created." Official answer to question "How to work with Realtimeget
andupdate
api requests?" - That is, when the applications use different
client_id
values to obtain OAuth credentials for the user.