pypi / warehouse

The Python Package Index
https://pypi.org
Apache License 2.0
3.55k stars 955 forks source link

Add resilience to the network call to fetch the SNS signing certificate #4463

Open dstufft opened 6 years ago

dstufft commented 6 years ago

Whenever we're verifying a SNS message, we have to fetch the public certificate from an HTTP url provided to us by Amazon. If fetching this fails for any reason, we will error and will rely on SNS retrying the request to get it accurately recorded.

We can do better!

There are two possible strategies I can think of here, and the right answer might be to use one or the other, or both.

My opinion is I'd start with caching, ideally with a redis based cache and see where that leaves us. It will likely make the failures infrequent enough as to not be worth worrying about, and will make verifying the signature faster as well.

dstufft commented 6 years ago

With retries and https://github.com/pypa/warehouse/pull/4526 this is alrgely done. I'm going to leave this open because I believe that adding caching here would still be a good step.