Skip to content

Commit c0d2ac5

Browse files
authored
bugfix: Unsafe deserialization in processorYaml.java #6839 (#6840)
1 parent fa6bdda commit c0d2ac5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

changes/en-us/2.x.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Add changes here for all PR submitted to the 2.x branch.
4141
- [[#6825](https://github.com/apache/incubator-seata/pull/6825)] Fix the issue of XA mode transaction timeout and inability to roll back in Postgres
4242
- [[#6833](https://github.com/apache/incubator-seata/pull/6833)] SQLIntegrityConstraintViolationException capture incorrectly when inserting a globallock
4343
- [[#6835](https://github.com/apache/incubator-seata/pull/6835)] Fix the issue of missing request body of post method in HttpClientUtil
44+
- [[#6840](https://github.com/apache/incubator-seata/pull/6840)] Fix the issue of unsafe deserialization in ProcessorYaml.java
4445

4546

4647

@@ -140,7 +141,6 @@ Thanks to these contributors for their code commits. Please report an unintended
140141
- [lightClouds917](https://github.com/lightClouds917)
141142
- [l81893521](https://github.com/l81893521)
142143
- [laywin](https://github.com/laywin)
143-
- [xingfudeshi](https://github.com/xingfudeshi)
144144
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
145145
- [LegGasai](https://github.com/LegGasai)
146146
- [yangli-stu](https://github.com/yangli-stu)

changes/zh-cn/2.x.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- [[#6825](https://github.com/apache/incubator-seata/pull/6825)] 修复Postgres的XA模式事务超时无法回滚问题
4343
- [[#6833](https://github.com/apache/incubator-seata/pull/6833)] 插入全局锁时 SQLIntegrityConstraintViolationException 捕获不正确
4444
- [[#6835](https://github.com/apache/incubator-seata/pull/6835)] 修复HttpClientUtil中post方法请求体缺失的问题
45+
- [[#6840](https://github.com/apache/incubator-seata/pull/6840)] 修复ProcessorYaml中不安全的反序列化
4546

4647

4748
### optimize:
@@ -141,7 +142,6 @@
141142
- [lightClouds917](https://github.com/lightClouds917)
142143
- [l81893521](https://github.com/l81893521)
143144
- [laywin](https://github.com/laywin)
144-
- [xingfudeshi](https://github.com/xingfudeshi)
145145
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
146146
- [LegGasai](https://github.com/LegGasai)
147147
- [yangli-stu](https://github.com/yangli-stu)

config/seata-config-core/src/main/java/org/apache/seata/config/processor/ProcessorYaml.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
import org.apache.seata.common.loader.LoadLevel;
2121
import org.apache.seata.common.util.MapUtil;
22+
import org.yaml.snakeyaml.LoaderOptions;
2223
import org.yaml.snakeyaml.Yaml;
24+
import org.yaml.snakeyaml.constructor.SafeConstructor;
2325

2426
import java.util.Map;
2527
import java.util.Properties;
@@ -34,7 +36,7 @@ public class ProcessorYaml implements Processor {
3436
@Override
3537
public Properties processor(String config) {
3638
Properties properties = new Properties();
37-
Map<String, Object> configMap = MapUtil.asMap(new Yaml().load(config));
39+
Map<String, Object> configMap = MapUtil.asMap(new Yaml(new SafeConstructor(new LoaderOptions())).load(config));
3840
properties.putAll(MapUtil.getFlattenedMap(configMap));
3941
return properties;
4042
}

0 commit comments

Comments
 (0)