yakuza0 2.22.30 → 2.22.31
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/server/proxy/csrf.js +1 -2
- package/template/storage.plugin.js +20 -6
package/package.json
CHANGED
package/server/proxy/csrf.js
CHANGED
|
@@ -274,7 +274,7 @@ exports.default = function () {
|
|
|
274
274
|
// referrerPolicy: { policy: "strict-origin-when-cross-origin" },
|
|
275
275
|
// referrerPolicy: yConf.stupid.referrerPolicy.policy,
|
|
276
276
|
// referrerPolicy: { policy: "origin-when-crossorigin" },
|
|
277
|
-
|
|
277
|
+
referrerPolicy: _config2.default.server.stupid.referrerPolicy
|
|
278
278
|
// crossOriginResourcePolicy: yConf.server.hm.crossOriginEmbedderPolicy,
|
|
279
279
|
// crossOriginEmbedderPolicy: true,
|
|
280
280
|
// crossOriginResourcePolicy: { policy: "cross-origin" },
|
|
@@ -300,7 +300,6 @@ exports.default = function () {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
if (_config2.default.security.isStupid) {
|
|
303
|
-
// helmetOptions.referrerPolicy = yConf.server.stupid.referrerPolicy;
|
|
304
303
|
// helmetOptions.crossOriginResourcePolicy = yConf.server.stupid.crossOriginResourcePolicy;
|
|
305
304
|
}
|
|
306
305
|
|
|
@@ -4,10 +4,12 @@ import {shtml} from 'yakuza1/lib/xss';
|
|
|
4
4
|
import yConf from 'yakuza0/config';
|
|
5
5
|
import {connect, req} from 'yakuza1/lib/ws';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const shtmlFilterGet = (obj, options) => {
|
|
8
8
|
if (obj && typeof obj !== "string") {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
const str = JSON.stringify(obj);
|
|
11
|
+
const filter = shtml(str, options);
|
|
12
|
+
return JSON.parse(filter)
|
|
11
13
|
} catch (e) {
|
|
12
14
|
return obj
|
|
13
15
|
}
|
|
@@ -16,6 +18,18 @@ const oToStr = (obj) => {
|
|
|
16
18
|
return obj
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
const shtmlFilterSet = (obj, options) => {
|
|
22
|
+
if (obj && typeof obj !== "string") {
|
|
23
|
+
try {
|
|
24
|
+
obj = JSON.stringify(obj);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return obj
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return shtml(obj, options);
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
export default async (ctx, inject) => {
|
|
20
34
|
const { $http, $utils, $yk } = ctx;
|
|
21
35
|
const event = {
|
|
@@ -40,7 +54,7 @@ export default async (ctx, inject) => {
|
|
|
40
54
|
[key, data] = args;
|
|
41
55
|
break;
|
|
42
56
|
}
|
|
43
|
-
data =
|
|
57
|
+
data = shtmlFilterSet(data, options);
|
|
44
58
|
|
|
45
59
|
const result = await $http.post('$/feapiv1/storage/set', {
|
|
46
60
|
key,
|
|
@@ -63,7 +77,7 @@ export default async (ctx, inject) => {
|
|
|
63
77
|
})
|
|
64
78
|
|
|
65
79
|
if ($yk.security.stupid) {
|
|
66
|
-
return
|
|
80
|
+
return shtmlFilterGet(result && result.data, options);
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
return result && result.data
|
|
@@ -100,7 +114,7 @@ export default async (ctx, inject) => {
|
|
|
100
114
|
break;
|
|
101
115
|
}
|
|
102
116
|
|
|
103
|
-
data =
|
|
117
|
+
data = shtmlFilterSet(data, options);
|
|
104
118
|
|
|
105
119
|
return await req('storage/set', {
|
|
106
120
|
body: {
|
|
@@ -120,7 +134,7 @@ export default async (ctx, inject) => {
|
|
|
120
134
|
})
|
|
121
135
|
|
|
122
136
|
if ($yk.security.stupid) {
|
|
123
|
-
return
|
|
137
|
+
return shtmlFilterGet(data, options);
|
|
124
138
|
}
|
|
125
139
|
|
|
126
140
|
return data;
|