333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';
 
/**
 * safe curl with ssrf protect
 * @param {String} url request url
 * @param {Object} options request options
 * @return {Promise} response
 */
module.exports = function safeCurl(url, options = {}) {
  const config = this.config || this.app.config;
  if (config.security.ssrf && config.security.ssrf.checkAddress) {
    options.checkAddress = config.security.ssrf.checkAddress;
  } else {
    this.logger.warn('[egg-security] please configure `config.security.ssrf` first');
  }
 
  return this.curl(url, options);
};