funky-eyes commented on code in PR #7973:
URL: https://github.com/apache/incubator-seata/pull/7973#discussion_r2992004956


##########
json-common/src/main/java/org/apache/seata/common/json/impl/FastjsonJsonSerializer.java:
##########
@@ -132,13 +138,57 @@ public <T> T parseObject(String text, Class<T> type, 
boolean ignoreAutoType) {
             if ("[]".equals(text)) {
                 return (T) new java.util.ArrayList<>();
             }
+
+            if (!ignoreAutoType) {
+                checkAutoTypeClasses(text);
+            }
+
             if (ignoreAutoType) {
                 return JSON.parseObject(text, type, 
READER_FEATURES_IGNORE_AUTO_TYPE);
             } else {
                 return JSON.parseObject(text, type, 
READER_FEATURES_SUPPORT_AUTO_TYPE);
             }
+        } catch (SecurityException e) {
+            throw e;
         } catch (Exception e) {
             throw new JsonParseException("FastJSON deserialize error", e);
         }
     }
+
+    /**
+     * Parse JSON with DisableSpecialKeyDetect (treats @type as a normal key 
without triggering
+     * AutoType resolution) and check all real @type fields against the 
allowlist.
+     */
+    private void checkAutoTypeClasses(String json) {

Review Comment:
   Why not utilize the ContextAutoTypeBeforeHandler feature?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to