The application I'm working on allows users to create businesses on the map, and upload associated images.
I use Cloud Functions to resize images for various screen resolutions and upload those back to GCS.
To make those images accessible to the public, I generate signed URL which gets saved in the associated entity in Real-time Database.
const [signedUrl] = await bucket.file(path).getSignedUrl({
action: "read",
expires: "01-01-2500",
})
Until today, URLs generated as per the code above would allow anyone to view the images. Then suddenly, all of the previously generated URLs became inaccessible and instead show the following error:
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
</Message>
<StringToSign>
GET 16725225600 /project-name.appspot.com/placeImage%2F300w%2FUPfppRM1ZyjbwBNiakgzyQ%3D%3D.jpg
</StringToSign>
</Error>
I see the above message for all of the previously uploaded images. Newly uploaded images can be viewed just fine.
My code closely mimics this example provided by functions-samples, however I'm worried about taking this to production in case the issue becomes a recurring one.
What could be the source of this problem and is there any way to protect ourselves against it in the future?