...
|
...
|
@@ -9,13 +9,23 @@ const cache = global.yoho.cache.master; |
|
|
const helpers = global.yoho.helpers;
|
|
|
const pathToRegexp = require('path-to-regexp');
|
|
|
|
|
|
const IP_WHITE_LIST = [
|
|
|
'106.38.38.146',
|
|
|
'106.38.38.147',
|
|
|
'106.39.86.227',
|
|
|
'218.94.75.58',
|
|
|
'218.94.75.50',
|
|
|
'218.94.77.166'
|
|
|
];
|
|
|
|
|
|
module.exports = () => {
|
|
|
return (req, res, next) => {
|
|
|
let ip = _.get(req.yoho, 'clientIp', '');
|
|
|
let path = req.path || '';
|
|
|
let router = {};
|
|
|
let risks = _.get(req.app.locals.wap, 'json.risk', []);
|
|
|
|
|
|
if (_.isEmpty(path) || _.isEmpty(risks)) {
|
|
|
if (_.isEmpty(path) || _.isEmpty(risks) || IP_WHITE_LIST.indexOf(ip) > -1) {
|
|
|
return next();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -42,7 +52,6 @@ module.exports = () => { |
|
|
return next();
|
|
|
}
|
|
|
|
|
|
let ip = _.get(req.yoho, 'clientIp', '');
|
|
|
let key = `wap:risk:${_.trim(path, '/').replace(/\//g, ':')}:${ip}`;
|
|
|
let checkUrl = helpers.urlFormat('/3party/check', {
|
|
|
pid: key
|
...
|
...
|
|