The comments of coderabbitai are ... well.
+ const safeToken = typeof token === "string" && token.length > 0 && token.length < 256 ? token : "";
Of arguable quality I would say. The length size limit is arbitrary and the > 0 is ridiculous.