Repository navigation
fix: an unknown token no longer crashes the service - #11
Merged
Merged
Conversation
handleForm is async and was called without await: any rejection (unknown token, SMTP or hook failure) was unhandled and killed the process, so every form of every site answered 502 until Docker restarted it. One request with a bad token was enough. - check the token before answering: unknown token gets a 400 - catch handleForm rejections after the answer - handleError uses err.statusCode - stop logging the TO env var and the hook option (recipients and credentials) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKxujRGhykGAoph1Vcyi8z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One POST with an unknown token crashed the whole service:
handleFormis async and was called withoutawait, so the error thrown bygetRecipientbecame an unhandled rejection and Node exited. Every form of every site then answered 502 until Docker restarted the container (seen 4 times on 2026-10-29 on submit.i2k.site). SMTP or hook failures had the same effect.handleFormrejections after the answer is senthandleErroruseserr.statusCode(500 by default)TOenv var and thehookoption, which exposed every recipient and the hook credentials in the logsTests: new
tests/process.test.js(unknown token gets 400 and the server keeps answering; known token redirects and the server survives an SMTP failure). They fail without the fix; all 9 tests pass with it.🤖 Generated with Claude Code
https://claude.ai/code/session_01MKxujRGhykGAoph1Vcyi8z