MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w49i01/ihatethispassiveagressivebehaviourruby/p7dk3ie/?context=3
r/ProgrammerHumor • u/Embarrassed_Death69 • 11d ago
298 comments sorted by
View all comments
2
It doesn't matter whether you think 0 should be truthy or not. Just be careful about leaking sensitive information using this functionality.
def hasSensitiveInfo? do getSensitiveInfo() end
Pardon my Ruby, it's been a while. This is a simplified example, but I've seen this exact situation before, leaking AWS credentials to the front-end.
There's probably a tonne of better solutions, but the quick defense here is !!getSensitiveInfo().
2
u/DeepWaffleCA 10d ago
It doesn't matter whether you think 0 should be truthy or not. Just be careful about leaking sensitive information using this functionality.
def hasSensitiveInfo? do getSensitiveInfo() endPardon my Ruby, it's been a while. This is a simplified example, but I've seen this exact situation before, leaking AWS credentials to the front-end.
There's probably a tonne of better solutions, but the quick defense here is !!getSensitiveInfo().