Skip to content

fix: an unknown token no longer crashes the service - #11

Merged
lexoyo merged 1 commit into
masterfrom
fix/jeton-inconnu
Oct 29, 2026
Merged

lexoyo merged 1 commit into
masterfrom
fix/jeton-inconnu

Conversation

@lexoyo

@lexoyo lexoyo commented Oct 29, 2026

Copy link
Copy Markdown
Owner

One POST with an unknown token crashed the whole service: handleForm is async and was called without await, so the error thrown by getRecipient became 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.

  • check the token before answering: an unknown token now gets a 400
  • catch handleForm rejections after the answer is sent
  • handleError uses err.statusCode (500 by default)
  • stop logging the TO env var and the hook option, which exposed every recipient and the hook credentials in the logs

Tests: 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

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
@lexoyo
lexoyo merged commit d6f5a0a into master Oct 29, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant