takahe icon indicating copy to clipboard operation
takahe copied to clipboard

Sendgrid option doesn't accept valid keys

Open andrewgodwin opened this issue 2 years ago • 6 comments

Some keys are in the format SG.something.-something-xxx which are not valid hostnames and fail Pydantic validation

andrewgodwin avatar Dec 26 '22 17:12 andrewgodwin

Probably need to pass the key through urllib.parse.unquote like we did with the AWS keys (and other secrets), though it will require the user to convert it on the way in.

tabletcorry avatar Dec 26 '22 22:12 tabletcorry

Will also need to address TAKAHE_MEDIA_BACKEND with the same changes, when using the access key + secret key in the URL it also hits a validation error when special chars are used

gwagstaff avatar Dec 27 '22 22:12 gwagstaff

The AWS media backend should already accept url encoded input. Not sure I documented that though.

Functionally, the inputs should always be encoded.

tabletcorry avatar Dec 28 '22 02:12 tabletcorry

I kinda wonder if these URL strings are the best way to load these config values. Asking everyone to urlencode all the inputs is a hassle, and may be a constant headache.

I can make a script to convert input strings, but that seems like a bit of a crazy hack compared to passing values in using more environment variables.

tabletcorry avatar Dec 28 '22 02:12 tabletcorry

The URL strings are handy up until a point, but we did start out with just separate TAKAHE_SENDGRID_KEY env vars and stuff. Need to think about it.

andrewgodwin avatar Dec 28 '22 02:12 andrewgodwin

@tabletcorry Ahh url encoding ended up fixing my deployment, but the env variable was being passed in dynamically so encoding that may not be an option for folk who use an automated pipeline.

In my opinion, we should keep most of the validation in (as it works for 95% of usecases) but add in additional setup env variables to control specifics (like TAKAHE_SENDGRID_KEY).

gwagstaff avatar Dec 28 '22 16:12 gwagstaff