Authored by 郝肖肖

'white'

@@ -9,13 +9,23 @@ const cache = global.yoho.cache.master; @@ -9,13 +9,23 @@ const cache = global.yoho.cache.master;
9 const helpers = global.yoho.helpers; 9 const helpers = global.yoho.helpers;
10 const pathToRegexp = require('path-to-regexp'); 10 const pathToRegexp = require('path-to-regexp');
11 11
  12 +const IP_WHITE_LIST = [
  13 + '106.38.38.146',
  14 + '106.38.38.147',
  15 + '106.39.86.227',
  16 + '218.94.75.58',
  17 + '218.94.75.50',
  18 + '218.94.77.166'
  19 +];
  20 +
12 module.exports = () => { 21 module.exports = () => {
13 return (req, res, next) => { 22 return (req, res, next) => {
  23 + let ip = _.get(req.yoho, 'clientIp', '');
14 let path = req.path || ''; 24 let path = req.path || '';
15 let router = {}; 25 let router = {};
16 let risks = _.get(req.app.locals.wap, 'json.risk', []); 26 let risks = _.get(req.app.locals.wap, 'json.risk', []);
17 27
18 - if (_.isEmpty(path) || _.isEmpty(risks)) { 28 + if (_.isEmpty(path) || _.isEmpty(risks) || IP_WHITE_LIST.indexOf(ip) > -1) {
19 return next(); 29 return next();
20 } 30 }
21 31
@@ -42,7 +52,6 @@ module.exports = () => { @@ -42,7 +52,6 @@ module.exports = () => {
42 return next(); 52 return next();
43 } 53 }
44 54
45 - let ip = _.get(req.yoho, 'clientIp', '');  
46 let key = `wap:risk:${_.trim(path, '/').replace(/\//g, ':')}:${ip}`; 55 let key = `wap:risk:${_.trim(path, '/').replace(/\//g, ':')}:${ip}`;
47 let checkUrl = helpers.urlFormat('/3party/check', { 56 let checkUrl = helpers.urlFormat('/3party/check', {
48 pid: key 57 pid: key