Make JsonMasker load mask keys from jars and be thread-safe
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in JsonMasker: the singleton INSTANCE() double-checked locking, the INSTANCE(Set) key loading via Files.readAllLines(Path.of(uri)), and mask(..) are all in the same class. Change resource loading to URL.openStream(), replace the TreeSet with a concurrent set, skip blank lines, and handle non-JSON byte[] and nested arrays in mask(..). Add tests that load META-INF/mask.keys from a jar plus cases for blank keys, byte[] input and arrays inside arrays; done when the existing directory-based tests still pass alongside the new ones.
由索引模型根据 Issue 内容生成。
描述
JsonMasker loads the keys to mask from META-INF/mask.keys resources using Files.readAllLines(Path.of(uri)). For a resource inside a jar (for example a fat jar deployed to AWS Lambda) the jar: URI cannot be converted to a Path unless a zip file system is already open, so loading fails, a warning is logged and the key set stays empty. As a result nothing is masked in packaged deployments. The existing tests do not notice because their mask.keys is loaded from a directory.
Related problems in the same class:
- the singleton field is not volatile, so the double-checked locking in
INSTANCE()does not guarantee safe publication - the set of keys is a plain
TreeSetthat is modified byINSTANCE(Set)while other threads may be reading it inmask(..) - a blank line in
mask.keysregisters an empty string as a key mask(..)throwsClassCastExceptionfor abyte[]input that is not JSON- an array nested directly inside an array is not searched for keys to mask
Proposed change:
- read the resources with
URL.openStream()so that they also work from jars - create the instance with a holder class and keep the keys in a concurrent set
- skip blank entries
- return the text for non-JSON
byte[]input - mask keys in nested arrays
- add tests for loading keys from a jar and for the cases above
Public method signatures stay the same.
- 主要语言
- Java
- 星标
- 1.1k
- 派生
- 655
- 平均合并
- 4 小时 54 分钟
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
spring-cloud/spring-cloud-function 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
spring-cloud/spring-cloud-function#1542 ·
维护者通常 1 天内回复
-
GcfJarLayout omits GcfJarLauncher$NestedUrlStreamHandlerFactory, causing NoClassDefFoundError under the GCF invoker可能已有人在做 @zemiles 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 32/100
spring-cloud/spring-cloud-function#1544 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
spring-cloud/spring-cloud-function#1538 · 1 条评论 ·
维护者通常 1 天内回复
-
Kotlin function wrapper treats empty input as no input可能已有人在做 @seonwooj0810 今天认领。 未关闭5.0.x backport bug
难度 3/5 半天 新手友好度 30/100
spring-cloud/spring-cloud-function#1537 ·
维护者通常 1 天内回复
-
5.0.x backport bug
难度 4/5 3-5 天 新手友好度 22/100
spring-cloud/spring-cloud-function#1536 ·
维护者通常 1 天内回复
查看 spring-cloud/spring-cloud-function 的全部 Issue
相似的 Issue
-
[FEAT] Lambda: support the nodejs26.x runtime可能已有人在做 @lBroth 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
apache/camel-website#1872 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
area/backend component/c8-api kind/task
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
bug devops low
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复