yakuza0 2.22.37 → 2.22.39-beta.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.22.37",
3
+ "version": "2.22.39-beta.0",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -273,18 +273,20 @@ exports.default = function () {
273
273
  // const browsers = Object.keys(yConf.allowBrowsers);
274
274
 
275
275
  if (_config2.default.security.helmet) {
276
- helmetOptions = {
276
+ helmetOptions = (0, _extends3.default)({
277
277
  // referrerPolicy: { policy: "no-referrer-when-downgrade" },
278
278
  // referrerPolicy: { policy: "strict-origin-when-cross-origin" },
279
279
  // referrerPolicy: yConf.stupid.referrerPolicy.policy,
280
280
  // referrerPolicy: { policy: "origin-when-crossorigin" },
281
- referrerPolicy: _config2.default.server.stupid.referrerPolicy
281
+ referrerPolicy: _config2.default.server.stupid.referrerPolicy,
282
282
  // crossOriginResourcePolicy: yConf.server.hm.crossOriginEmbedderPolicy,
283
283
  // crossOriginEmbedderPolicy: true,
284
284
  // crossOriginResourcePolicy: { policy: "cross-origin" },
285
285
  // crossOriginResourcePolicy: { policy: "same-origin" }
286
286
  // contentSecurityPolicy: yConf.server.csp.decoration,
287
- };
287
+ // xFrameOptions: false,
288
+ xFrameOptions: _config2.default.server.stupid.xFrameOptions
289
+ }, _config2.default.server.stupid.helmet);
288
290
 
289
291
 
290
292
  if (_config2.default.server.csp.decoration === true) {
@@ -68,6 +68,10 @@ export default (ctx, inject) => {
68
68
  global.__yk_gu__[variable.guRouteVerHeader] = req.headers[variable.guRouteVerHeader] || global.__yk_gu__[variable.guRouteVerHeader];
69
69
  defaults.headers[variable.adjoinIpHeader] = req.headers[variable.adjoinIpHeader];
70
70
  defaults.headers[variable.forwardedForHeader] = req.headers[variable.forwardedForHeader];
71
+
72
+ if (!req.headers.Cookie || (typeof req.headers.Cookie === "string" && req.headers.Cookie.indexOf(variable.csrfCookie) === -1)) {
73
+ defaults.headers.Cookie = global.__http_bd__;
74
+ }
71
75
  }
72
76
  }
73
77
  }
@@ -529,13 +529,15 @@ var render = function () {
529
529
  stupid: {
530
530
  referrerPolicy: { policy: "strict-origin-when-cross-origin" },
531
531
  crossOriginResourcePolicy: { policy: "same-origin" },
532
+ xFrameOptions: { action: "sameorigin" },
532
533
  standard: "v23", // v13
533
534
  v23: {
534
535
  // aMark: '__cfo_complete_',
535
536
  enabled: true,
536
537
  tsLoading: 5000,
537
538
  tsLoaded: 120000
538
- }
539
+ },
540
+ helmet: {}
539
541
  },
540
542
  tire: {
541
543
  guPath: '/gu',
package/utils/secret.js CHANGED
@@ -62,6 +62,7 @@ var secret = {};
62
62
  // import {asymmetric, getKey, symmetry} from "yakuza1/lib/encrypt/sm";
63
63
 
64
64
  _yakuza.global.__yk_gu__ = _yakuza.global.__yk_gu__ || {};
65
+ _yakuza.global.__http_bd__ = _yakuza.global.__http_bd__ || '';
65
66
 
66
67
  // const allowHeaders = {
67
68
  // 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
@@ -303,14 +304,14 @@ var set = exports.set = function set(_ref3) {
303
304
 
304
305
  getUc = function () {
305
306
  var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
306
- var ucBody, _spi, _spiQuery, _spiSecret, defDomain, bodyStr, Cookie, ucHeaders, hs, rs, resCookie;
307
+ var ucBody, _spi, _spiQuery, _spiSecret, defDomain, bodyStr, Cookie, ucHeaders, hs, rs, resCookie, resCookieArr;
307
308
 
308
309
  return _regenerator2.default.wrap(function _callee4$(_context4) {
309
310
  while (1) {
310
311
  switch (_context4.prev = _context4.next) {
311
312
  case 0:
312
313
  if (!((0, _yakuza.checkServer)() || !$yk.appConf.ssr)) {
313
- _context4.next = 22;
314
+ _context4.next = 23;
314
315
  break;
315
316
  }
316
317
 
@@ -346,15 +347,17 @@ var set = exports.set = function set(_ref3) {
346
347
  Cookie: Cookie
347
348
  }, _def.variable.clientKeyHeader, mixin.symmetry.CBC.encrypt((0, _yakuza.md5)((0, _yakuza.uuid)())));
348
349
  _context4.prev = 11;
350
+
351
+ _yakuza.global.__http_bd__ = '';
349
352
  hs = "Set-Cookie";
350
- _context4.next = 15;
353
+ _context4.next = 16;
351
354
  return _universal2.default.post(($yk.appConf.ssr ? $yk.origin + '/' : $yk.server.basePathMU) + "apiv2/support/svc/uc", {
352
355
  body: bodyStr,
353
356
  headers: ucHeaders,
354
357
  timeout: timeout
355
358
  });
356
359
 
357
- case 15:
360
+ case 16:
358
361
  rs = _context4.sent;
359
362
  resCookie = rs.headers.get(hs);
360
363
 
@@ -364,21 +367,37 @@ var set = exports.set = function set(_ref3) {
364
367
  var at = rt.split("=");
365
368
  return at[1] ? rt : false;
366
369
  })).join(";");
367
- res.setHeader(hs, resCookie.split(','));
370
+ resCookieArr = resCookie.split(',');
371
+
372
+
373
+ resCookieArr.forEach(function (r) {
374
+ var single_rc = r.split(';');
375
+ if (single_rc.length > 0) {
376
+ var single_bd = single_rc[0].split(_def.variable.csrfCookie)[1];
377
+ if (single_bd.length > 2) {
378
+ if (_yakuza.global.__http_bd__) {
379
+ _yakuza.global.__http_bd__ += '; ';
380
+ }
381
+
382
+ _yakuza.global.__http_bd__ += _yakuza._.trim(single_rc[0]);
383
+ }
384
+ }
385
+ });
386
+ res.setHeader(hs, resCookieArr);
368
387
  }
369
- _context4.next = 22;
388
+ _context4.next = 23;
370
389
  break;
371
390
 
372
- case 20:
373
- _context4.prev = 20;
391
+ case 21:
392
+ _context4.prev = 21;
374
393
  _context4.t0 = _context4["catch"](11);
375
394
 
376
- case 22:
395
+ case 23:
377
396
  case "end":
378
397
  return _context4.stop();
379
398
  }
380
399
  }
381
- }, _callee4, undefined, [[11, 20]]);
400
+ }, _callee4, undefined, [[11, 21]]);
382
401
  }));
383
402
 
384
403
  return function getUc() {