|
|
@@ -1,7 +1,7 @@
|
|
|
module.exports = function(crowi) {
|
|
|
var debug = require('debug')('crowi:models:revision')
|
|
|
, mongoose = require('mongoose')
|
|
|
- , xss = require('xss')
|
|
|
+ , Xss = require('../util/xss')
|
|
|
, ObjectId = mongoose.Schema.Types.ObjectId
|
|
|
, revisionSchema;
|
|
|
|
|
|
@@ -13,20 +13,17 @@ module.exports = function(crowi) {
|
|
|
createdAt: { type: Date, default: Date.now }
|
|
|
});
|
|
|
|
|
|
- // create a XSS Filter instance
|
|
|
- const myxss = new xss.FilterXSS({
|
|
|
- stripIgnoreTag: true,
|
|
|
- css: false,
|
|
|
- // allow all attributes
|
|
|
- onTagAttr: function (tag, name, value, isWhiteAttr) {
|
|
|
- return `${name}="${value}"`;
|
|
|
- }
|
|
|
- });
|
|
|
- // prevent XSS when pre save
|
|
|
- revisionSchema.pre('save', function(next) {
|
|
|
- this.body = myxss.process(this.body);
|
|
|
- next();
|
|
|
- });
|
|
|
+ /*
|
|
|
+ * preparation for https://github.com/weseek/crowi-plus/issues/216
|
|
|
+ */
|
|
|
+ // // create a XSS Filter instance
|
|
|
+ // // TODO read options
|
|
|
+ // this.xss = new Xss(true);
|
|
|
+ // // prevent XSS when pre save
|
|
|
+ // revisionSchema.pre('save', function(next) {
|
|
|
+ // this.body = xss.process(this.body);
|
|
|
+ // next();
|
|
|
+ // });
|
|
|
|
|
|
revisionSchema.statics.findLatestRevision = function(path, cb) {
|
|
|
this.find({path: path})
|