3 ms·
I'll be honest I don't have much experience with Redis specifically, I do however think that the caching layer is likely the wrong place to handle data security
by contravariant 4y ago
I'll be honest I don't have much experience with Redis specifically, I do however think that the caching layer is likely the wrong place to handle data security. It seems too easy for someone to accidentally circumvent the cache and thereby the security. I do think that organising the cache to catch problems early is a good idea though.
The thing is that a function like
def get_profile(user_id):
profile = fetch_profile(user_id)
assert profile.user_id == user_id
return user_id
makes it a lot harder to fuck up, doesn't matter if you swap some ids somewhere (i.e. fetch_profile actually uses the customer id, not the user_id), or if the cache fucks up, or if you accidentally wrote 'SELECT * FROM user_profile WHERE user_id = user_id'.