

You know what? Rather than over-complicate things you can probably just check that filenames contain a small set of white-listed chars. [a-zA-z-._] (and != ‘…’ or ‘.’) or something.
And one other nit-pick if you’re up for more code-review - your authentication logic should probably be inverted:
if !ok || user != session.config.username ||
pass != session.config.password
I’d change that to be something like
if ok && user == session.config.username && pass == session.config.password {
// do login
} else {
// not auth
}
There’s a whole category of security errors where an exception in logic like that causes the code to skip the “you’re not allowed” logic and go right to the “you’re allowed!” block. It’s more of an issue with languages that support exceptions but it’s still considered a best practice generally (it’s also typically easier to read).


What “other technology” is going to make sure your API doesn’t have SQL injection and bad authentication vulnerabilities?