JWT encoder signs payloads that aren't JSON objects, and the decoder then rejects them
维护者通常 1 天内回复
@MugdhoAI 已经在做这个了。
开始于 2026年10月22日。
评估
这个 Issue 还没有评估数据。
描述
In the JWT decoder's Encode tab, a payload of [1, 2, 3], "hello", 42 or null is signed without complaint. Paste the token into Decode, as the panel suggests, and you get "Payload is not a JSON object". A JWT's claims set has to be a JSON object (RFC 7519), and decodeJwt already checks that (lib/jwt-utils.ts, lines 89 to 91).
generate (app/(tools)/jwt-decoder/components/EncoderTab.tsx, lines 37 to 51) only checks that the payload is valid JSON (line 39) before it signs it (line 51).
What to do
- After the JSON check, refuse anything that isn't a plain object (arrays, strings, numbers, booleans and
null) with an error like "The payload must be a JSON object", shown where the JSON error shows today. - Objects sign exactly as before.
Where to look
app/(tools)/jwt-decoder/components/EncoderTab.tsx:generate(lines 37 to 51)lib/jwt-utils.ts: the same check indecodeJwt(lines 89 to 91)app/(tools)/jwt-decoder/components/DecodedCard.test.tsx: a component test for this tool
Acceptance criteria
-
[1, 2, 3],"hello",42,trueandnullshow the error and produce no token - An object payload still produces a token that Decode accepts
- Tests for these cases
-
npm run lint,npm run testandnpm run buildpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #253 in the description.
- 主要语言
- TypeScript
- 星标
- 1
- 派生
- 9
- 平均合并
- 9 小时 9 分钟
- 30 天内合并 PR
- 118
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/toolbelt 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 55/100
维护者通常 1 天内回复
-
JSON to YAML: control characters are written raw, so PyYAML and js-yaml can't read the output可能已有人在做 @anurag2787 于 2 天前认领。 未关闭bug good first issue hacktoberfest
codercops/toolbelt#234 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
JSON formatter: Escape for code gives broken Python when the text has a run of single quotes可能已有人在做 @anurag2787 于 2 天前认领。 未关闭bug good first issue hacktoberfest
codercops/toolbelt#233 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add the URL encoder to the README, the home share card and package.json可能已有人在做 @Abhishek764 于 4 天前认领。 未关闭documentation good first issue hacktoberfest
codercops/toolbelt#153 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
hacktoberfest
难度 1/5 1 小时以内 新手友好度 1/100
codercops/toolbelt#101 · 1 条评论 ·
维护者通常 1 天内回复
查看 codercops/toolbelt 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 82/100
source-cooperative/docs.source.coop#41 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
Nimblesite/SharpLsp#468 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
solidjs-community/solid-primitives#1082 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复