News for hackers. Stuff that matters.
Re:Bypassing GitHub's OAuth Flow with a Head Request by ryandrake on Thursday November 07, 2019 @03:55PM (#21477152)
Cool language feature! I’ve done this in other languages using a code style policy where all “naked” else statements and ‘default’ inside a switch statement must throw an uncaught exception or otherwise deliberately crash.

    if(option==1)
        do_somethimg();
    else
        do_something_else();
...must then be rewritten as:

    if(option==1)
        do_somethimg();
    else if(option==2)
        do_something_else();
    else
        abort();
This kind of defensive coding would have helped to prevent the famous ‘goto fail’ bug from a few years ago.

There are no comments on this comment yet.