[Java] add more defensive version of deserialize(byte, class)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先定位 Java 的 deserialize(byte, class) 实现,并跟踪编码的类标记和类注册是如何处理的。完成的标准是:防御性变体会验证标记,并且在创建实例之前只接受请求的类或其子类;为匹配数据、子类数据和意外类数据添加覆盖。
由索引模型根据 Issue 内容生成。
描述
Feature Request
I debugged the method deserialize(byte, class) and found that it does not check the deserialized data matches the class - that it just info for the compiler to know what the expected return type is.
Would it be possible to add a deserializeWithClassCheck(byte, class) that validates the byte data has a class marker saved into the byte data and that class data relates to a class that is the class expected (the one passed in the parameter list of deserializeWithClassCheck) or a subclass?
Is your feature request related to a problem? Please describe
The idea is that users who have a secure network can avoid registering all the classes that they need on the Fory instance but have the deserializeWithClassCheck call validate the encoded data is not related to some unexpected class.
deserialize(byte, class) will deserialize and you will get a Class Cast Exception but it is good to have a method that avoids creating class instances when the encoded data is of wrong type.
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
- 主要语言
- Java
- 星标
- 4.6k
- 派生
- 470
- 平均合并
- 9 小时 28 分钟
- 30 天内合并 PR
- 33
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/fory 的其他 Issue
-
[Python] Compatible xlang read silently drops fields when the peer writes camelCase/PascalCase names未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
[Build] Add ASF license headers to config files that allow comments可能重新可做 @Swatantra-66 于 29 天前认领,目前没有进行中的 PR。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
xlang: the snake_case conversion of field names is not specified, and the runtimes do not agree可能重新可做 @dhruv-dagar 于 17 天前认领,目前没有进行中的 PR。 未关闭bug
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
[Rust] Add an option to use Rust native enum可能已有人在做 @BaldDemian 于 21 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
apache/fory#4177 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Untyped read collapses a number literal that does not fit a double可能已有人在做 @mohitjoshi-hey 于 23 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 68/100
apache/fory#4170 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
Type: Bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
MCP add-on: JSON responses with non-ASCII characters are truncated (wrong Content-Length)可能已有人在做 @dhanushbs10 今天认领。 未关闭add-on bug in:mcp
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
vaadin-map
难度 2/5 1-3 小时 新手友好度 70/100
vaadin/flow-components#10586 ·
维护者通常 1 天内回复
-
WeReadInstaller writes the launcher database on the main thread at handover (Activity pause timeout)未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 63/100
wpilibsuite/SystemcoreTesting#446 ·
维护者通常 1 天内回复