Re:Trivial authentication bypass in libssh leaves servers wi...
by vbezhenar on Thursday October 18, 2018 @06:01AM
(#18247141)
Array of callbacks (or long switch which is essentially the same) is a standard method to implement state machine.
[ Parent
| on HN ]
Re:Trivial authentication bypass in libssh leaves servers wi...
by ernst_klim on Thursday October 18, 2018 @02:59PM
(#18251126)
You can use type system to ensure that there are no wrong state transitions, e.g. you could transit to another state only if you are authorized.
Re:Trivial authentication bypass in libssh leaves servers wi...
by kaoD on Thursday October 18, 2018 @07:04AM
(#18247325)
And that's why you should use a thoroughly tested implementation instead of implementing a bug-ridden ad-hoc square wheel.
"Whoopsies, I forgot to ban some state transitions" won't happen if all you're writing is a state machine spec, and not a state machine spec and its ad-hoc implementation.
Don't roll your own crypto? Extend it to "don't roll your own low-level constructs".