소스 검색

Security fix to ReactionBleed in WeKan. It is XSS in feature "Reaction to comment".

Thanks to Alexander Starikov at Jet Infosystems (https://jetinfosystems.com/).
Lauri Ojansivu 2 년 전
부모
커밋
47ac33d6c2
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      models/cardCommentReactions.js

+ 10 - 1
models/cardCommentReactions.js

@@ -1,5 +1,14 @@
 const commentReactionSchema = new SimpleSchema({
-  reactionCodepoint: { type: String, optional: false },
+  reactionCodepoint: {
+    type: String,
+    optional: false,
+    max: 9, // max length of reaction code
+    custom() {
+      if (!this.value.match(/^&#\d{4,6};$/)) { // regex for only valid reactions
+        return "incorrectReactionCode";
+      }
+    },
+  },
   userIds: { type: [String], defaultValue: [] }
 });