Plans to expand Essex school nursery at risk of closure
Meryl Streep and Anne Hathaway film Devil Wears Prada sequel just blocks away from NYC mass shooting that killed four
How Labour is doing compared to its own economic targets - and why it must deliver growth
Jailed in Essex: The 14 individuals put behind bars in the county this month
Moment Alessia Russo playfully tries to put off Ella Toone during Lioness photo as the childhood best friends get red carpet treatment at Downing Street
Victorious Lionesses are our 'national pride' say MPs and call for squad to be given damehoods following stunning Euros victory
Chaos breaks out on board an airplane as passenger is accused of despicable act after dispute breaks out over the toilet before takeoff
Monty Don claims a garden 'doesn't need a single plant in it' - this is why
Woman reveals what REALLY happens when you get lip filler dissolved
Eddie Howe admits Alexander Isak's future is 'not in my full control' - but Newcastle boss stresses there has not been a Liverpool offer for the forward
Sydney Sweeney sparks romance rumors with hunky mystery man on PDA-filled lakefront date after split
CodeSOD: IsValidToken
To ensure that several services could only be invoked by trusted parties, someone at Ricardo P's employer had the brilliant idea of requiring a token along with each request. Before servicing a request, they added this check:
private bool IsValidToken(string? token) { if (string.Equals("xxxxxxxx-xxxxxx+xxxxxxx+xxxxxx-xxxxxx-xxxxxx+xxxxx", token)) return true; return false; }The token is anonymized here, but it's hard-coded into the code, because checking security tokens into source control, and having tokens that never expire has never caused anyone any trouble.
Which, in the company's defense, they did want the token to expire. The problem there is that they wanted to be able to roll out the new token to all of their services over time, which meant the system had to be able to support both the old and new token for a period of time. And you know exactly how they handled that.
private bool IsValidToken(string? token) { if (string.Equals("xxxxxxxx-xxxxxx+xxxxxxx+xxxxxx-xxxxxx-xxxxxx+xxxxx", token)) return true; else if (string.Equals("yyyyyyy-yyyyyy+yyyyy+yyyyy-yyyyy-yyyyy+yyyy", token)) return true; return false; }For a change, I'm more mad about this insecurity than the if(cond) return true pattern, but boy, I hate that pattern.