Score:0

Bucket retention policies and malicious actors

cn flag

I am thinking about how one would implement a good system for guaranteeing that some files are available for a certain set of time. In this particular case it is a backup catalog of some 150 MiB per file.

As part of my implementation I have a bucket with a retention policy set to 1 month. The system that writes this catalog file has a service account which it uses to upload the catalog to the bucket. All good, very simple.

However, when implementing this I started to wonder: "What happens if an attacker gains access to this service account and starts filling the bucket with loads and loads of data?". We would be forced to retain that, and supposedly pay for it. 1 PiB could probably be uploaded without too much fuzz, and with Nearline in Finland that would be $10,000 USD. I would definitely want to ensure that does not happen.

Then I started to think one step further. Imagine a disgruntled employee that creates a bucket, uploads a few PiB, and sets the retention to 10 years before his/her last day. How would that be handled?

The documentation that I have read unsurprisingly puts pressure on how things cannot be deleted under retention, but it seems like there has to exist a way to deal with accidental and malicious uploads. Especially since GCP does not have any form of cost control or at least bucket size limit setting.

What are your thoughts on dealing with this threat vector sensibly? Relying on the hope that GCP billing support will discount any mistakes or attacks?

John Hanley avatar
cn flag
1) Your question asks for opinions and for advice about a vendor's policies. That is off-topic. 2) Uploading a Petabyte of data? Create realistic scenarios. 2) Security requires work. This includes establishing and enforcing policies; monitoring and alerting to detect issues; implementing resolution plans. 3) Do not rely upon a vendor to pay for your mistakes and/or management failure.
Christian Svensson avatar
cn flag
1) The question is platform specific, sure - but I don't see why it would be off-topic. 2) 1 PiB is easily achieved using something as low as a 10 Gbps uplink for 10 days. Easy this day and age, many large companies have links larger than that and it would likely be undetected if run at the same time as e.g. backup jobs
John Hanley avatar
cn flag
Your reply to my comment is exactly why this is off-topic. I have my opinion, you have yours, neither are facts.
Christian Svensson avatar
cn flag
What is an opinion in my comment? The fact that 10 Gbps for 10 days creates a 1 PiB file? Surely that's fact.
Score:1
it flag

You can use the Pub/Sub notifications for Cloud Storage to get notifications about different events done to your storage objects:

Pub/Sub notifications sends information about changes to objects in your buckets to Pub/Sub, where the information is added to a Pub/Sub topic of your choice in the form of messages. For example, you can track objects that are created and deleted in your bucket. Each notification contains information describing both the event that triggered it and the object that changed.

As for the notifications about uploads, it looks like you could use the OBJECT_FINALIZE event.

Alternatively, have a look at the Object change notifications.

For the expenditure control there is also a way to set up notifications as described in the budget alerts documentation:

A budget enables you to track your actual Google Cloud spend against your planned spend. After you've set a budget amount, you set budget alert threshold rules that are used to trigger email notifications. Budget alert emails help you stay informed about how your spend is tracking against your budget. You can also use budgets to automate cost control responses.

There are also some examples of cost control responses like sending alerts to Slack or disabling billing to stop usage.

Wytrzymały Wiktor avatar
it flag
Hello @ChristianSvensson and welcome to ServerFault! Please remember to [react to answers for your questions](https://stackoverflow.com/help/someone-answers). That way we know if the answers were helpful and other community members could also benefit from them. Try to [accept answer](https://stackoverflow.com/help/accepted-answer) that is the final solution for your issue, upvote answers that are helpful and comment on those which could be improved or require additional attention. Enjoy your stay!
Christian Svensson avatar
cn flag
While Pub/Sub would certainly notify me that something has happened, it is the same as having a fire alarm that tells me the house has already burned down in this case. I need to be able to prevent, not detect.
Michael Hampton avatar
cz flag
@ChristianSvensson You can only prevent by revoking everyone's access. But then nobody can do their work.
Christian Svensson avatar
cn flag
@MichaelHampton Right, that's a problem. I guess I will have to find a non-cloud way of doing this then as I am not OK with accepting the risk of bugs uploading too much data and being stuck with paying for data for ages. Bluray or tape comes to mind.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.