wingbot 3.76.15 → 3.76.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Processor.js +16 -1
package/package.json
CHANGED
package/src/Processor.js
CHANGED
|
@@ -116,6 +116,7 @@ const LLMDispatcher = require('./LLMDispatcher');
|
|
|
116
116
|
* @prop {number} [sessionDuration] - Session duration for analytic purposes
|
|
117
117
|
* @prop {LLMGlobalConfig} [llm] - LLM model configuration
|
|
118
118
|
* @prop {Preloader<R>} [preloader]
|
|
119
|
+
* @prop {string[]} [allowedPostBacks]
|
|
119
120
|
*/
|
|
120
121
|
|
|
121
122
|
/**
|
|
@@ -208,7 +209,8 @@ class Processor extends EventEmitter {
|
|
|
208
209
|
autoSeen: false,
|
|
209
210
|
redirectLimit: 20,
|
|
210
211
|
nameFromState: NAME_FROM_STATE,
|
|
211
|
-
sessionDuration: 1800000 // 30 minutes
|
|
212
|
+
sessionDuration: 1800000, // 30 minutes,
|
|
213
|
+
allowedPostBacks: []
|
|
212
214
|
};
|
|
213
215
|
|
|
214
216
|
Object.assign(this.options, options);
|
|
@@ -657,6 +659,19 @@ class Processor extends EventEmitter {
|
|
|
657
659
|
configuration
|
|
658
660
|
);
|
|
659
661
|
|
|
662
|
+
const reqActionNorm = req.action()?.replace(/^\/?/, '/');
|
|
663
|
+
if (req.isPostBack()
|
|
664
|
+
&& fromEvent
|
|
665
|
+
&& reqActionNorm
|
|
666
|
+
&& this.options.allowedPostBacks.length > 0
|
|
667
|
+
&& !this.options.allowedPostBacks.some((pb) => {
|
|
668
|
+
const norm = pb.replace(/^\/?/, '/');
|
|
669
|
+
return norm === reqActionNorm;
|
|
670
|
+
})) {
|
|
671
|
+
|
|
672
|
+
throw Object.assign(new Error(`Invalid postback error "${req.action()}"`), { code: 400 });
|
|
673
|
+
}
|
|
674
|
+
|
|
660
675
|
// process session
|
|
661
676
|
if (fromEvent) {
|
|
662
677
|
let {
|