mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 10:48:06 -05:00
CodeQL alert #430, js/disabling-certificate-validation, High: `reqOptions.rejectUnauthorized = false` in the outgoing-webhook path. It is right, and the switch is gone. `rejectUnauthorized: false` accepts ANY certificate - including the one a man in the middle presents - which is the attack the handshake exists to stop. What #6553 and #6551 actually need is not "verify nothing", it is "this certificate is legitimate", so that is what WeKan takes now: WEBHOOK_TLS_CA_CERT the certificate (or CA) to TRUST for outgoing webhooks MAIL_TLS_CA_CERT the same for the mail server MAIL_TLS_SERVERNAME the name to verify the mail certificate AGAINST, for the wildcard-one-level-short case the report describes Each is the PEM itself or a path to a file holding it. A self-signed certificate is its own issuer, so naming it here is exactly what makes it valid - and verification stays ON, the chain is still checked, the hostname is still checked. A path that cannot be read is not fatal: it logs which setting failed and keeps the system trust store, rather than stopping mail or webhooks. The SSRF protections are untouched: the address is still resolved once and pinned, private ranges are still refused, redirects are still blocked. CodeQL alert #429, js/incomplete-sanitization, High: `helper.replace(/\./g, '\\.')` in a test escaped dots only, so a backslash in the value could change the meaning of the pattern it was spliced into. It uses the same escape-everything helper tests/testsAreRegistered.test.cjs already has, with the backslash escaped FIRST. tests/mailTransportTls.test.cjs now fails if `rejectUnauthorized: false`, that same assignment, or NODE_TLS_REJECT_UNAUTHORIZED appears in either file - so the pattern cannot come back quietly - and covers the certificate-from-PEM, certificate-from-path and unreadable-path cases. Thanks to GitHub CodeQL code scanning and xet7 !