this post was submitted on 18 Aug 2023
168 points (97.7% liked)

Technology

60082 readers
4249 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each another!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed

Approved Bots


founded 2 years ago
MODERATORS
 

STS (Secure Time Seeding) uses server time from SSL handshakes, which is fine when talking to other Microsoft servers, but other implementations put random data in that field to prevent fingerprinting.

you are viewing a single comment's thread
view the rest of the comments
[–] SzethFriendOfNimi 10 points 1 year ago (2 children)

That’ll be one weird regression test. Imagine the comment you’ll have to write to explain “why” this test exists.

[–] Z4rK 13 points 1 year ago* (last edited 1 year ago) (2 children)

While the root issue was still unknown, we actually wrote one. It sort of made sense. Check that the date from isn’t later than date to in the generated range used for the synchronization request. Obviously. You never know what some idiot future coder (usually yourself some weeks from now) would do, am I right?

However, it was far worse to write the code that fulfilled the test. In the very same few lines of code, we fetched the current date from time.now() plus some time span as date.to, fetched the last synchronization timestamp from db as date.from, and then validated that date.from wasn’t greater than date.to, and if so, log an error about it.

The validation code made no logic sense when looking at it.

[–] SzethFriendOfNimi 6 points 1 year ago

Feels like writing

Assert.is(false,"This should never happen");

and seeing it pop up one time?

[–] [email protected] 1 points 1 year ago

I feel like the 3rd party API should have had some error checking, although that might have strayed too far into a client's business logic.
If it is an API of incidents, that suggests past incidents. And the whole "never trust user data" kinda implies they should throw an error if you request information about a tinerange in the future.
I guess, not throwing an error does allow the 3rd party to "schedule" an incident in the future, eg planned maintenance/downtime.

But then, that isn't separation of concerns. Ideally those endpoint would be separate. One for planned hypothetical incidents and one for historical concrete incidents.

It's definitely an odd scenario where you are taking your trusted data (from your systems and your database), then having to validate it.

[–] [email protected] 9 points 1 year ago (1 children)
// for possible time travel scenarios
// DO NOT DELETE!
[–] Z4rK 2 points 1 year ago

lol I have to add this to the code now 😝