My project allow users to write their own content. Each person's content is private, and should not be allowed to seen by others. However, there is a polling logic from client side where I use AWS S3 SDK (Web JavaScript) to wait for object (file in S3) to exist. The point is, I want the information "Whether this object exists or not?" to be public but "What exactly is this object's data?" to be private. However, by allowing the GetObjectAttributes permission alone this doesn't allow the HeadObject function to work. So to allow fetching from client side I must also enable GetObject which contradicts my goal. So is there a way to implement this?
Nevertheless, if there is no good way of doing this I'm planning to create another lambda function to do the HeadObject with admin access and basic client authorization. The drawbacks are: it is more complicated, it is (logically, presumably) more time-consuming due to overhead of the lambda and it would be more expensive (even though it's just a "hobby" scale, but this would amount to an extra factor).
The current solution in my mind is to (painfully) allow GetObject but with the key (filename) appended with crypto-random-string. (which is still not an acceptable way for me).
Any solution to this case would be appreciated.